julianpeeters / avrohugger

Generate Scala case class definitions from Avro schemas
Apache License 2.0
201 stars 120 forks source link

UUID LogicalType support for avdl #134

Open niqdev opened 4 years ago

niqdev commented 4 years ago

Hi,

we are sharing avdl schema (which in theory I can't touch) between teams and some strings are mapped like this

@logicalType("uuid")
string myUuid;

but in the generated class the annotations is completely ignored

// ...
case 0 => this.myUuid = {
  value.toString
}.asInstanceOf[String]
// ...

I saw in the code and from the example that it works perfectly for avsc schema, I also tried with

uuid myUuid;

similar to timestamp_ms like shown here which is mapped to an Instant instead of long, but that doesn't work either.

Any hints or how is it suppose to work? If it's a bug, I'm more than happy to fix it with some guidance! 😅

Thanks in advance for the help!