avro-kotlin / avro4k

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

Code generation from avro schema files #212

Open Chuckame opened 5 months ago

Chuckame commented 5 months ago

the need

Currently, there is no up-to-date or maintained kotlin plug-in that generates kotlin code from an avro schema file.

This plug-in would generate kotlin source code compatible with avro4k and using all the built-in avro4k annotations and serializers. It also makes a new life for avro, especially when the famous davidmc24's plug-in stopped its support in décembre of 2023, and is now the ownership of apache 😅

how / questions

To be used with a configured instance of Avro, we could just generate code with @Contextual for all the non primitive fields. That way, the built-in serializers will be taken by default as they are already bundled with the default Avro instance.

There is still a challenge: how to discover the kotlin type behind a custom logical avro type?

trdw commented 5 months ago

This would be very useful to us since we have a diverse collection of programming languages. For cases when teams prefer the schema-first approach (especially the non-JVM teams), we could have one .avsc file that drives code generation for all our languages, rather than Kotlin -> .avsc first.