Open GavinRay97 opened 2 years ago
HI! Thanks for the question and sorry for the delay in a response.
There isn't something built-in currently. Options are:
--target=custom
command line argument.) The domain model exposed to the freemarker template isn't well documented currently, but here it is. (The domains
property becomes the global variable of the same name in the freemarker template.) The freemarker template for the html
target target also uses the same domain model--you could by copying and modifying that.I should also add, to get the data classes to work with Jackson, it would be necessary to add a command-line option --enable-jackson
(that applies only to the Kotlin target) and then modify the Kotlin template here to emit the appropriate Jackson annotations. I'm not sure if the current maintainers of this package would want this feature, though.
Ah awesome, looks like it's fairly straightforward to do custom codegen via templates!
Thanks, when I get some free time I'll play around with this and see if I can get it to spit out a wire-friendly JSON representation for sending to other services/languages 👌
I've been meaning to do a blogpost on building a query expression language + IR-translator with PartiQL anyways
Taking the example of the Calculator AST from the docs, serializing a simple
plus(3, 5)
expression as JSON:You get:
For languages that don't have an Ion SDK, the object
["binary",["plus"],["lit",3],["lit",5]]
isn't very easily constructed or comprehended.Is there any way to define or write custom (de)serializers to allow serializing it as something like:
Thank you =)