Open nrempel opened 3 months ago
Yes, I think this would be a great complement! Was thinking about this myself at some point. Probably in a separate crate in the workspace?
I wonder if the mapping of the macros is sufficient already to be able to express XSD itself in it...
It's worth a shot! I'll think about it.
Do you have any suggestions for crates to look at for managing the codegen step?
Not sure what you mean? Look at the gcp stuff in bolt?
Thinking about this more, if you mean how to best generate Rust code, there are basically two viable approaches:
For the latter, you can try to generate somewhat formatted code (which takes a little bit more work but isn't that hard -- Askama does this), or you can just run the code through rustfmt (or the prettyplease crate) for formatting.
Thanks! Yeah I experimented a bit with quote which works well.
I'm generating roughly the right shape but mapping xml types to Rust is a bit tricky since all xml schemas seem to define their own types which inherit other types. I need to recursively trace the inheritance back to the base type--most likely across multiple schema definitions!
Ah yeah, that does sound tricky! Feel free to open a draft PR if you'd like a second pair of eyes.
It would be convenient to be able to generate Rust structs with the relevant
instant-xml
decorations from xsd schema definitions. Do you think this could be considered in scope for this repo?