typical icon indicating copy to clipboard operation
typical copied to clipboard

parser/ast as separate library

Open cemoktra opened this issue 2 months ago • 2 comments

Description I wanted to play around with typical and evetually integrating it into tonic. For this purpose it would be convenient to have schema parsing as a library.

Alternatives considered I coul dtake inspiration and rewrite parsing, but it exists ;)

cemoktra avatar Oct 11 '25 12:10 cemoktra

Integrating into tonic seems worthwhile! But I'm not sure what it would take exactly. Does tonic allow prost to be swapped with something else?

BTW, if you want to prototype it, the parser is in parser.rs. This is the entrypoint:

https://github.com/stepchowfun/typical/blob/fbef90eafa1069f4fef0c28c83b1473f6e16b92d/src/parser.rs#L195-L199

stepchowfun avatar Oct 11 '25 15:10 stepchowfun

tonic recently pushed out all prost related code into two crates that implement some traits. so that should be quite easy.

https://github.com/hyperium/tonic/tree/master/tonic-prost https://github.com/hyperium/tonic/tree/master/tonic-prost-build

one crate handles message (and service; which i could hard code for tests) generation, and the other crate implements a "codec" and defines how messages are de-/serialized

cemoktra avatar Oct 13 '25 06:10 cemoktra