Skip to content

Conversation

@Kriskras99
Copy link
Contributor

@Kriskras99 Kriskras99 commented Dec 7, 2025

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.

I moved the Serde related modules to a separate serde module as I needed to add another module for the StringSerializer (to decode Map keys) and that would make the root too messy. Putting it in the root util module would also work, but it's a lot of (filler) code and would make that module unreadable.

Closes #247
Closes #311

@Kriskras99 Kriskras99 changed the base branch from main to serde_ub December 7, 2025 22:14
Base automatically changed from serde_ub to main December 8, 2025 12:10
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.
@Kriskras99
Copy link
Contributor Author

Rebased on main and merge conflict fixed

@Kriskras99
Copy link
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
Copy link
Member

Great work, @Kriskras99 !

@martin-g martin-g merged commit 2019363 into main Dec 11, 2025
20 checks passed
@Kriskras99 Kriskras99 deleted the feat/serde_flatten branch December 11, 2025 20:32
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.

missing support for #[serde(flatten)] for derive AvroSchema

2 participants