Any good template/code generation library?

Hey everyone, to refresh my rust knowledge I would like to create a library that parses openapi specs and produces rust structures. Kinda like this library for go but easier

I was wondering if there is any library that lets one create rust code at runtime without having to create a bunch of boilerplate.

All my googling produced either macros (not applicable in this case since I want to generate the code at runtime) or HTML templating (I want rust templating).

Any idea? Thanks in advance

The OpenAPI Generator uses mustache as its templating engine for Rust. You can find the template here. There are mustache bindings for Rust, but I'd say handlebars is preferable (which happens to be pretty much compatible with mustache, in case you want to re-use some parts of the OpenAPI Generator template).

1 Like

Thanks a lot. Actually I found some great suggestions in the "other questions" below my post. Clearly next time I should use the search before ask

1 Like

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.