FasterXML / jackson-dataformats-binary

Uber-project for standard Jackson binary format backends: avro, cbor, ion, protobuf, smile
Apache License 2.0
310 stars 133 forks source link

[Avro] Fix MapWriteContext not correctly resolving union values #136

Closed baharclerode closed 6 years ago

baharclerode commented 6 years ago

We recently discovered a bug with the Avro serializer where using a map whose values are a union of multiple record schemas fails because the MapWriteContext does not pass each item to createChildObjectContext(), so Jackson can't resolve which schema in the union should be used.

I've added a test that demonstrates the issue and the associated fix in MapWriteContext.

It looks like this issue was fixed upstream as a part of the refactoring in 8b9171c5ba724f9d56f27ec70a120f6aaa89be8c for 3.0, but we'd like to utilize this in 2.9.

cowtowncoder commented 6 years ago

Thank you for the fix! Sounds good, and based on earlier work I assume this to be valid. But I will try to go over this just to make sure I understand it. Should make it in 2.9.6.