sbt-avro4s
sbt-avro4s copied to clipboard
Companion object for records with union fields are not being generated
When I compile:
{
"type":"record",
"name":"Union",
"namespace":"com.sksamuel.avro4s",
"fields":[ {
"name":"union",
"type": [ "int", "string", "boolean" ]
} ]
}
I get as a result in domain.scala
package com.sksamuel.avro4s
//auto generated code by avro4s
case class Union(
union: shapeless.:+:[Int, shapeless.:+:[String, shapeless.:+:[Boolean, shapeless.CNil]]]
)
But I miss the object companion specified https://github.com/sksamuel/sbt-avro4s/blob/master/src/main/scala/com/sksamuel/avro4s/ModuleRenderer.scala#L14-L17
object Union {
type UnionType = shapeless.:+:[Int, shapeless.:+:[String, shapeless.:+:[Boolean, shapeless.CNil]]]
}
Without this alias big union fields are not usable because we cannot specify before hand all the data structure in the client.
I'm using version 1.0.1
of the plugin.