Closed GijsbertvanVliet closed 1 year ago
Check the Enums docs. The solution for this are ordering annotations, though it maybe not supported by Avro hugger.
Yes, Avro hugger unfortunately does not support this.
The problem does not occur if the Schema
object is generated from the case classes instead of generating it from the .avsc
file.
But even if the schema is generated from the .avsc
file, is there a reason why case objects are not matched to the enum symbols purely by matching the names Unknown
, None
, Email
and Sms
?
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
I think just issue should not have been closed. The issue still exists. I looked into SubtypeOrdering and it looks like it is sorting one the names of the types. I think this is wrong, as the AVRO spec explicitly states the order is based on the symbols position in the enum schema: https://avro.apache.org/docs/1.11.1/specification/#sort-order
This is an issue regarding the scala3 version of avro4s, but I don't seem to be able to add the required label to this issue for some reason. I have an issue with the support for sealed traits in avro4s. The avro schema has the following datatype:
which is converted to the following sealed trait by the avrohugger plugin:
The SealedTraits decoder, however, seems to scramble these values. It looks like this has something to do with the fact that
ctx.subtypes.sorted(SubtypeOrdering)
returns elements in orderEmail, None, Sms, Unknown
whileschema.getEnumSymbols
returns elements in orderUnknown, None, Email, Sms
.