Expand description
Rust model generation.
Emits a models.rs of plain structs with serde derives, one pub struct
per model and one pub enum per string union.
§Why plain structs with serde
Generated code inherits its shape onto every consumer. A schema describing
a file format (the motivating case is a DAW project document) wants to
describe the JSON it reads with the ecosystem’s standard round trip and no
framework in front of it. serde::Serialize/Deserialize derives cover
that, and nothing beyond serde is pulled in.
The cost is that this validates nothing beyond shape: an out-of-range value that the JSON Schema would reject still deserializes. Constraints in the IR are emitted as comments so they are visible, not enforced.
Functions§
- generate
- Generate Rust models for a schema.