avro-kotlin / avro4k

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

Could it support generate data classes from avsc file? #96

Closed msampaioatbigw closed 3 years ago

kossi commented 3 years ago

Isn't that a bit out-of-scope of this project? Anyways @thake have made this project that you could use: https://github.com/thake/avro4k-compiler

Or just use avro java libs to read schema files and generate from those schemas kotlin data classes with https://square.github.io/kotlinpoet/ for an example. From my personal experiences kotlinpoet have quite neat API for generating kotlin classes compared to templating.

Probably in the end it doesn't really matter and code generating can be really use-case / project specific if you wan't enrich those generated classes with certain interfaces or metadata. Or anything issue could be how you glue together the code generating with actual project build. Example should that generator be gradle, maven or something else plugin. Anyways probably better to do it yourself?

thake commented 3 years ago

@msampaioatbigw: Closing this issue as this is out of scope.

As already pointed out by @kossi you can take a look at https://github.com/thake/avro4k-compiler which is actually another project of mine. If you have any questions / issues with it, you can raise a issue there.