Repository navigation
fix: Choose correct schema when serializing an Option<Enum> - #337
Merged
Merged
Conversation
Contributor
|
I was about to comment if the entire loop cannot be removed, but you already removed it😁. I do have a concern about how this handles nested Options, if you provide a Some(None) won't it use the Schema::Null from the outer Union? |
Contributor
Author
|
What would a nested option map to in terms of an avro schema? |
Contributor
|
Ah, that would map to a nested Union which is not allowed by spec, so we don't need to worry about that. |
Kriskras99
approved these changes
Nov 20, 2025
Kriskras99
left a comment
Contributor
There was a problem hiding this comment.
Looks good! I'll give @martin-g some time to share his thoughts and will otherwise merge it tomorrow or Saturday.
martin-g
approved these changes
Nov 20, 2025
martin-g
left a comment
Member
There was a problem hiding this comment.
Just some nits.
Thank you, @PookieBuns !
Closed
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
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.
There is a bug currently in serialization in which if you are serializing an
Option<Enum>for a Union Schema (with null), it will automatically try to use the first not-null schema if you choose a not-null enum. This fix allows the serializer to correctly resolve the proper schema to serialize the Enum variant with.Notes
camelCaseon the Enum. However, this is pre-existing behavior so its not a regression from pre-existing behaviorPlease let me know if there are any questions or things to address!