Feature Request
Add #[serde(flatten)] support to Rust codegen for base types
Use Case
When deserializing Concerto JSON AST into Rust structs, Declaration silently drops subtype-specific fields like properties, isAbstract, and superType.
Possible Solution
In rustvisitor.js, detect when a class is Declaration and add a #[serde(flatten)] pub extra: HashMap<String, serde_json::Value> catch-all field. Also add the necessary HashMap and serde_json imports.
Context
Currently this is hand-edited in concerto-rust with a TODO comment (see accordproject/concerto-rust#7). Attempted in #205 but the change touched snapshots across multiple generated files. Moving it to the codegen ensures it survives regeneration.
Detailed Description
Scoped to Declaration only -- adding flatten to all base types causes stack overflow from nested serde deserialization on types like MapKeyType/MapValueType.
Feature Request
Add
#[serde(flatten)]support to Rust codegen for base typesUse Case
When deserializing Concerto JSON AST into Rust structs,
Declarationsilently drops subtype-specific fields likeproperties,isAbstract, andsuperType.Possible Solution
In
rustvisitor.js, detect when a class isDeclarationand add a#[serde(flatten)] pub extra: HashMap<String, serde_json::Value>catch-all field. Also add the necessaryHashMapandserde_jsonimports.Context
Currently this is hand-edited in
concerto-rustwith a TODO comment (see accordproject/concerto-rust#7). Attempted in #205 but the change touched snapshots across multiple generated files. Moving it to the codegen ensures it survives regeneration.Detailed Description
Scoped to
Declarationonly -- adding flatten to all base types causes stack overflow from nested serde deserialization on types likeMapKeyType/MapValueType.