avro-kotlin / avro4k

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

Use kotlinx serializer native features #148

Closed Chuckame closed 9 months ago

Chuckame commented 1 year ago

This issue will be the follow up to assist the long way of using native kotlinx serialization features like @Contextual, @SerialName, serializerModules and much more to unlock native features like value classes, serialization modules declaration, custom serializers.

This work would touch to the schema generation and the encoding/decoding codebase, while we will try to not touch the user entrypoint Avro.

Chuckame commented 1 year ago

Feature for @SerialName: Since there isn't native serial namespace annotation, when we set a serial name that contains dots, we can set the namespace using everything before the latest dot, and set the schema name from the last word after the latest dot

Chuckame commented 1 year ago

Thanks to @thake fixed the release issue, I'll work on it in next weeks

Chuckame commented 1 year ago

@thake Currently working on it, and found a way of encode every possible schema. I'll push the pr (wip) in next days. It will come with other fixes and optimisations.

Chuckame commented 1 year ago

Some primitives (char, byte, short) are going to be handled by default as int

Chuckame commented 1 year ago

We will be allowed of serializing unions with non-record types (like union of double, string and records by example)

Chuckame commented 1 year ago

AvroInline will be removed in favour of kotlin native value class because this annotation is only targeting classes with only one field. If users want to migrate, just @AvroInline data class Something(val field: Data) will become @JvmInline value class Something(val field: Data), that's all.

Chuckame commented 9 months ago

Closing this issue as it is too global to be implemented atomically. Also, it will be covered by multiple issues #114 #187 #166 #165 #160 #151 #114 #131