avro-kotlin / avro4k

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

RecordDecoder including aliases from AvroAlias annotation for possible field names #170

Closed trdw closed 5 months ago

trdw commented 7 months ago

Problem: We want to read some data using Avro evolution mechanism for field renaming. Current behavior is to use the property name, serial name, or avro name only which does not account for AvroAlias annotation.

Proposed solution: fieldValue() function iterates through list of possible field names, starting with the resolvedFieldName. For each attempt, if non-null value returned from record.get(...) then return it, else continue.