jdarais opened a new pull request, #395:
URL: https://github.com/apache/avro-rs/pull/395
I was playing around a bit with the latest avro-rs (thanks for taking my
last PR!) and I noticed that in some cases, the output of
`serde_json::to_string(&schema)` would result in the `logicalType` field being
written twice. It's not noticeable if you're reading the serialized json back
using serde_json, since it just ignores the duplicate key, (which is why all
the existing tests comparing schemas as structured json values still pass,) but
it's possible that some json parsers would fail to parse such a schema.
I eventually found that the duplicate was coming from the fact that in some
cases, `logicalType` shows up in the inner fixed schema's extra attributes, so
it could be written once when we call
`fixed_schema.serialize_to_map::<S>(map)`, and then a second time when we call
`map.serialize_entry("logicalType", "decimal')`.
I'm not sure if the `Serialize` implementation for `Schema` is the place to
fix it, or if we should be preventing `logicalType` from showing up in the
inner fixed schema's attributes in the first place, but here's a PR that fixes
it on the serialization side that you can merge if it looks good to you.
I added a few unit tests that fail with the latest from main, and pass with
the changes in this PR.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]