Skip to content
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

Fix avro serialization of union types #367

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

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