Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Preserve the order of flattened properties. #253

Closed

Conversation

SamirTalwar
Copy link

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.

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.
@SamirTalwar SamirTalwar force-pushed the preserve-order-when-flattening branch from a8f3591 to 6028136 Compare May 27, 2024 09:00
@SamirTalwar
Copy link
Author

Closing this PR as this is fixed in schemars v1.0.0-alpha.3, according to #122 (comment).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Serde flatten does not preserve order
1 participant