avro-kotlin / avro4k

Avro format support for Kotlin
Apache License 2.0
198 stars 37 forks source link

Full reflection-less encoding and schema generation #199

Closed Chuckame closed 4 months ago

Chuckame commented 6 months ago

Currently, in v2, we set a class using AvroSchema and AvroLogicalType annotations to be able to customize the final schemas and add logical types, but this requires kotlin reflection to allow creating the instance of the given class. In v1, we unwrap the nullable SerialDescriptors to get back the AvroDescriptor to access the custom methods for generating the schemas.

A PR has been done to be able of unwrapping a nullable descriptor, that now allows us to retrieve the original descriptor, so we can get rid of reflection for logical types and custom schemas, and it allows us to create brand new methods and interfaces on a standard SerialDescriptor.

This has been done here: https://github.com/Kotlin/kotlinx.serialization/commit/c7bcaf1cb92685ffb6c2d46c9e22d0b7e6e20811

When kotlin-serialization is released, avro4k v2 will be allowed to be released

Chuckame commented 4 months ago

Released in v2.0.0