julianpeeters / avrohugger

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

Union with null and multiple types does not generate a valid avro class with Either and Option #175

Closed ShaneKilloran closed 11 months ago

ShaneKilloran commented 1 year ago

When trying to generate classes for a schema including a union like: [null, type1, type2], the resulting case class handles it with an Option of an Either, but trying to actually produce with this structure causes an "org.apache.avro.AvroRuntimeException: Unknown datum type scala.util.Left" as only the Option is unwrapped. Is this expected?

julianpeeters commented 1 year ago

That's not expected, no. Thanks for the report.

I see a round trip test for the Standard format, but not for Specific.

No ETA on a closer look, I'm afraid. This will be on my radar, but I no timeframe.

julianpeeters commented 11 months ago

fixed in avrohugger 1.5.4 https://github.com/julianpeeters/avrohugger/pull/178