-
-
Notifications
You must be signed in to change notification settings - Fork 145
Fixes #601: Jackson subtype schema unions are non-deterministic #613
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
Fixes #601: Jackson subtype schema unions are non-deterministic #613
Conversation
94b2377
to
0fcc23d
Compare
avro/src/main/java/com/fasterxml/jackson/dataformat/avro/schema/RecordVisitor.java
Show resolved
Hide resolved
avro/src/main/java/com/fasterxml/jackson/dataformat/avro/schema/RecordVisitor.java
Outdated
Show resolved
Hide resolved
Good start! PR much appreciated. One process thing: we need CLA (from either https://github.com/FasterXML/jackson/blob/main/contributor-agreement.pdf (individual) or https://github.com/FasterXML/jackson/blob/main/contributor-agreement.pdf (Corporate CLA)). This is only needed once per contributor, one is good for all future contributions. The usual way is to print, fill & sign, email to Looking forward to merging this PR (and backporting in 2.19, I think). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Ok ready to merge once we get CLA! Thank you again @beseder1 . |
CLA received, will now merge |
(fixes: #601)
With the current implementation of the
RecordVisitor
, Avro schema unions are handled in a non-deterministic way. This can cause deserialization errors when differentAvroMapper
instances are used for serialization and deserialization.Specifically, because the subtype ordering is unstable, deserialization may attempt to resolve a serialized object against the wrong subtype, resulting in errors.
This PR makes the ordering deterministic by using an
ArrayList
instead of aSet
, ensuring consistent behavior across serialization and deserialization.