Generate cap'n'proto schemas from ocaml values

I’m having a look at capnp as a way to provide a binary schema for the Tezos project.
My idea, but I’m not even sure if capnp is the right format for us, is to create capnp schema files from our data-encoding library ( released in opam recently ).

I could write all the combinators, and then pretty print the resulting capnp schema myself, but I’m wondering if I could re-use some code/library to make this task a bit easier and less error prone.

thanks !

I am not 100% sure that this is what you need, but rpclib allows to serialize/deserialize ocaml values and comes with a ppx deriver for both the ser/de generation. It should not be hard to extend it to support capnp.

1 Like