Closed Chuckame closed 2 months ago
Should be solved together with #80 as both cases require an extension of the RootRecordEncoder. The problem is that primitives are not wrappable in an Avro record. Therefore the API of avro4k needs to change to support this use case. I've not yet had the time to come up with a good API design that supports both the use cases (record and primitives). Feel free to contribute a proposal.
Maybe #116 can also be solved together. The API change should be capable of this.
I begun my work on avro4k to handle primitive types, but as you said, this lib is totally independant from kafka libs. This lib is more an avro encoder, while we need another lib for kafka. I think this lib is not dedicated for this kind of thing, because it will be too much generic. Like a decode
func that will returns a T?
or Any?
that is not type-safe.
Maybe the best is to really have 2 different kafka serializers: one for records, and another for primitives. I'll create a PR if needed on your other avro4k-kafka-serializer
lib
I just discovered that AvroFixed
can be put on a value class as the documentation say. Since the value classes would be natively handled, then this annotation should just be possible on properties.
Done in #183
Hey,
Is there a way to have value classes ? (previously called inlined classes)
The goal is to wrap primitive types (string, int, in our example) inside a value class, to be used with a primitive avro schema.
error:
To reproduce:
I can help if you want, since this feature should be awesome for handling primitive keys while having a readable code (instead of ask "hey, what's inside the string key ? hexadecimal ? the name ? from whhich other field it comes ?" 😄 )