Skip to content

Fix avro serialization of union types#367

Open
DaveWM wants to merge 2 commits intoFundingCircle:masterfrom
DaveWM:master
Open

Fix avro serialization of union types#367
DaveWM wants to merge 2 commits intoFundingCircle:masterfrom
DaveWM:master

Conversation

@DaveWM
Copy link
Contributor

@DaveWM DaveWM commented Jan 15, 2024

This is a fix for a bug in the avro serde, where serialization is sometimes ignoring default values that appear within a union type. This is only the case when the default value is false or nil.

The problem is that when match-clj? is called for a record type (as it is within UnionType's clj->avro method), it checks whether any fields missing from the clojure data have a default value in the avro schema. To do this it calls .defaultVal, but if the default value is nil or false this returns falsey. I've therefore replaced this call with .hasDefaultValue.

Checklist

  • tests
  • updated CHANGELOG (the "unreleased" section)

@DaveWM DaveWM requested a review from a team as a code owner January 15, 2024 16:23
@fc-infosec-sast
Copy link

✅ SAST Report

No issues found. Good job! 💪

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.

3 participants