toolisticon / avro-kotlin

Opionionated set of extension functions and helpers for using Apache Avro with Kotlin
https://avro-kotlin.toolisticon.io/stable/
Apache License 2.0
3 stars 0 forks source link

Support custom logical type with value class implementation #64

Open jangalinski opened 2 months ago

jangalinski commented 2 months ago

Problem: Customer has an id ... this is a string (or uuid). We want to use this id in a type-safe, ddd way, thus we need a CustomerId. could define this as a record, but since we are not allowed to reuse schema definitions from another schema, we woul have n definitions of this CustomerId record. If we just provide it via conversion, we need to distribute libs containing the CustomerId.

Idea: Define a logical-type "value-id" and generate a value class based on naming conventions, so the type is alway present when we generate objects from schema.

Currently fails with value class CustomerId because of internal avro4k String/Charsequence erasure.

jangalinski commented 1 month ago

Currently fails with value class CustomerId because of internal avro4k String/Charsequence erasure.

This is fixed with 1.11.4.4, but the code generation part is still open