avro-kotlin / avro4k

Avro format support for Kotlin
Apache License 2.0
188 stars 36 forks source link

Fail when annotations are weirdly set #181

Open Chuckame opened 5 months ago

Chuckame commented 5 months ago

Currently, annotating classes is totally open to mistakes, while they are just silently ignored when not appliable.

Let's take the following example. We can annotate a field with AvroFixed even if its type is a record. This can generate a schema, but it won't be able of encoding or decoding anything.

Similar examples with:

The idea is to have some validation during schema generation (and maybe in decode/encode, but thinking about perf...) to fail when the user put weird annotations together.