schemars icon indicating copy to clipboard operation
schemars copied to clipboard

Preserve the order of flattened properties.

Open SamirTalwar opened this issue 2 years ago • 0 comments

Resolves #122.

When using #[serde(flatten)] in combination with the preserve_order feature, Schemars did not actually preserve the order; flattened properites would always be inserted last.

This change modifies the derive macro to insert flattened properties as they come.

I haven't added test cases as there don't seem to be any for preserve_order and I'm not sure how to go about doing this. However, I did add a flattened structure to the serde_attrs example, and tested it manually.

SamirTalwar avatar Nov 15 '23 14:11 SamirTalwar