Open jangalinski opened 1 year ago
I will try to provide this feature.
see #142 142
Hello, after some work at revamping the Avro
api #186 (WIP), there is a new easier and promising way of implementing the single object (for the moment, named serialization delegate). The avro input and output stream would be removed. Don't hesitate to comment it as you worked hard to integrate this single object format in the current version of avro4k.
Thanks for being patient and sorry for the delay again.
Currently, the README states that single object encoding is not supported.
Following up on the discussion in #138, I believe this should be possible to implement.
From the Specification:
Single Avro objects are encoded as follows:
Binary encoding is already supported, and the fingerprint of the schema should be accessible from
SchemaNormalization.parsingFingerprint64(Avro.default.schema(MySerializableDataClass.serializer()))
so serialization should come down to concatenating bytes.
For deserialization, we need to deconstruct the single object encoded byte array, check the first two marker bytes, extract the fingerprint, lookup the writer schema from a
SchemaStore
and decode the remaining binary payload to GenericRecord and then to the target data class.