-
Notifications
You must be signed in to change notification settings - Fork 47
feat: Implement support for #[serde(flatten)]
#359
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
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7e403fa to
71adcf6
Compare
This is done by adding a `#[avro(flatten]` attribute so that the schema (for that field) is also flattened, and by adding support in `SchemaAwareWriteSerializer` for serializing a struct via Map instead of Struct. `flatten` does not work with `to_value`, as `to_value` does not have access to the schema.
71adcf6 to
f176b28
Compare
Contributor
Author
|
Rebased on main and merge conflict fixed |
martin-g
reviewed
Dec 8, 2025
Contributor
Author
|
Thanks for the review, was very helpful. I fixed everything I could and added two of your suggestions to #361 because they're a bit too big to add to this PR. |
martin-g
approved these changes
Dec 11, 2025
Member
|
Great work, @Kriskras99 ! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is done by adding a
#[avro(flatten]attribute so that the schema (for that field) is also flattened, and by adding support inSchemaAwareWriteSerializerfor serializing a struct via Map instead of Struct.flattendoes not work withto_value, asto_valuedoes not have access to the schema.I moved the Serde related modules to a separate
serdemodule as I needed to add another module for theStringSerializer(to decode Map keys) and that would make the root too messy. Putting it in the rootutilmodule would also work, but it's a lot of (filler) code and would make that module unreadable.Closes #247
Closes #311