Closed Chuckame closed 2 months ago
Seems like you are aiming for static access, while in the current version, there is a default instance (Avro.default) to use, but also the option to create a custom instance. This is quite important when working with custom logical types .. am I missing st. or would we loose the option of configuring a custom instance?
Seems like you are aiming for static access, while in the current version, there is a default instance (Avro.default) to use, but also the option to create a custom instance. This is quite important when working with custom logical types .. am I missing st. or would we loose the option of configuring a custom instance?
To encode in single data object mode, then you are forced to not use the default avro instance but you need to create your own instance. Avro {...}
is the new constructor, exactly the same way as Json
from official kotlinx format.
So to sum up, technically it's exactly the same as before (you can use the default instance Avro
, that was previously Avro.default
, or you can create and customize your own instance with Avro{...}
, that is the same as Avro({...})
, were before it was Avro(AvroConfiguration(...))
), while now we have a more kotlin-esque api.
Here is the new proposed avro entrypoint 🥳
Goal
Provide an unified, easy and extensible way of encoding and decoding avro. Unified and easy as it should only have methods on the
Avro
class (no streams, no builders, ...). Extensible as avro can be used in multiple contexts, and some requires adding some metadata (data files) or schema info (confluent schema registry, single object).Closes #163 #141
Requirements to merge:
Breaking changes:
AvroInputStream
andAvroOutputStream
, thanks to theencodeSequenceXxx
anddecodeSequenceXxx
replacements withAvroSerializationDelegate
encodeToByteArray
anddecodeFromByteArray
will now be pure avro (no header, just the encoded data itself without decorators) while before it was inData
mode (avro data file format)Tickets to open after that:
The methods
Each base method having a
Schema
and aSerializerStrategy
orDeserializerStrategy
has its related extension method to automagically get theSerializerStrategy
orDeserializerStrategy
and the schema from the reified type.We now fully support java streams and ByteArray.
We are now able of streaming the avro contents with the new
encodeSequence
anddecodeSequence
methods, useful for reading avro files by example!Example of usage