julianpeeters / avrohugger

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

add output examples of unions to README.md #179

Closed LeonPoon closed 11 months ago

LeonPoon commented 11 months ago

(No need to make a new release for now...)

Field Type ⬇️ / Behaviour ➡️ OptionShapelessCoproduct OptionEitherShapelessCoproduct OptionalShapelessCoproduct
[{"type": "map", "values": "string"}] Map[String, String] Map[String, String] Map[String, String] :+: CNil
["null", "double"] Option[Double] Option[Double] Option[Double :+: CNil]
["int", "string"] Int :+: String :+: CNil Either[Int, String] Int :+: String :+: CNil
["null", "int", "string"] Option[Int :+: String :+: CNil] Option[Either[Int, String]] Option[Int :+: String :+: CNil]
["boolean", "int", "string"] Boolean :+: Int :+: String :+: CNil Boolean :+: Int :+: String :+: CNil Boolean :+: Int :+: String :+: CNil
["null", "boolean", "int", "string"] Option[Boolean :+: Int :+: String :+: CNil] Option[Boolean :+: Int :+: String :+: CNil] Option[Boolean :+: Int :+: String :+: CNil]
LeonPoon commented 11 months ago

By the way rather than OptionalShapelessCoproduct, I think it might be more appropriate to say: OptionAllShapelessCoproduct