FasterXML / jackson-dataformats-binary

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

Add `AvroGenerator.canWriteBinaryNatively()` to support binary writes, fix `java.util.UUID` representation #179

Closed cowtowncoder closed 4 years ago

cowtowncoder commented 5 years ago

Looks like Avro backend is missing one crucial capability indicator, needed for (de)serializers to know that binary data can be handled natively. Adding this should allow for (more) efficient serialization of java.util.UUID, for example. Binary data reads/writes themselves are probably not affected since there are separate methods: this has more to do with binary representation of types like UUID.

cowtowncoder commented 5 years ago

Note: looks like Schema generation for UUID type just indicates String, and does not have good access to find out if binary available, or, if it did, way to indicate that.

Will probably need to add something in schema interfaces for jackson-core, too, but can't use that in 2.10 regardless, so need to add a work-around in Avro schema handler.

cowtowncoder commented 5 years ago

Looks like I may have to leave default UUID serialization, schema type, as String for 2.10, and add some low-level support to be able to fix this in 2.11.