Skip to content

Support flattening Option<T> into the UnionSchema of T#528

Open
PookieBuns wants to merge 6 commits into
apache:mainfrom
PookieBuns:feat/schema_aware_ser_and_deser
Open

Support flattening Option<T> into the UnionSchema of T#528
PookieBuns wants to merge 6 commits into
apache:mainfrom
PookieBuns:feat/schema_aware_ser_and_deser

Conversation

@PookieBuns

Copy link
Copy Markdown
Contributor

closes #517. Original PR at #519

@PookieBuns PookieBuns changed the title Feat/schema aware ser and deser Support flattening Option<T> into the UnionSchema of T Apr 3, 2026
@Kriskras99 Kriskras99 force-pushed the feat/schema_aware_ser_and_deser branch from 69f3fd4 to 7c80e15 Compare July 14, 2026 14:34
@Kriskras99

Copy link
Copy Markdown
Contributor

Hi @PookieBuns,

I've finally had time to review this in depth. I think this is a good thing to add and it's almost at the point where we can merge it. I've pushed a commit which adds documentation and simplifies the code a bit.
Unfortunately there are 3 tests (which you had marked as should_panic) which I think should work. The issue common to these 3 tests is an (union) enum with only one variant inside an Option. To the serializer code it looks like an Option so it takes the wrong branch at serde/ser_schema/mod.rs:409. As I think this is a common case (there is no serde trickery here with untagged or other attributes) it needs to be fixed before we can merge it (it would be confusing for the user if this case does not work).
I'll therefore put it onto the 0.23 milestone and start thinking about how we can fix this without degrading performance for Options and without requiring more complex code.

@Kriskras99 Kriskras99 self-assigned this Jul 14, 2026
@Kriskras99 Kriskras99 added this to the 0.23.0 milestone Jul 14, 2026
@Kriskras99 Kriskras99 mentioned this pull request Jul 14, 2026
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.

Support flattening Option<T> into the UnionSchema of T

2 participants