julianpeeters / avrohugger

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

Fixing missing shapeless import #105

Closed franciscodr closed 5 years ago

franciscodr commented 5 years ago

This pull request fixes an issue that happens when using a decimal logical type within a union type.

So an IDL file like this one:

@namespace("example.idl")

protocol LogicalOptionalIDL {
  record LogicalOptionalIdl {
    union {decimal(9, 2), null} maybeDec = 9999.99;
  }
}

causes a compilation error because the shapeless.tag.@@ import is missing.

The root cause is the importsForUnionType method doesn't check if the contained types require more imports so that leads to a compilation error.

julianpeeters commented 5 years ago

awesome, thanks a ton @franciscodr . I've been out for holiday, but I'll take a closer look and merge ASAP

julianpeeters commented 5 years ago

Hi @franciscodr, I made a minor change after using your examples avrohugger's scripted tests (they live in sbt-avrohugger so the scripted plugin works). Please take a look, and if everything looks good I can publish early this week.

franciscodr commented 5 years ago

Hi @julianpeeters, thanks for reviewing my pull request. Your proposed change looks good to me :)

julianpeeters commented 5 years ago

Thanks again @franciscodr , your changes should now be available as avrohugger 1.0.0-RC15 and sbt-avrohugger 2.0.0-RC15, up at sonatype now and making their way to maven central shortly.

franciscodr commented 5 years ago

Great!! Thanks, @julianpeeters Really glad to help :)