flipp-oss / deimos

Framework to work with Kafka, Avro and ActiveRecord
Other
59 stars 22 forks source link

Support unions in schema classes #185

Open dorner opened 1 year ago

dorner commented 1 year ago

Right now, schema classes only support null as a union type. We don't generate a proper union type out of it. Other code generation tools actually generate a new class representing the union, e.g.

{
  "name": "field-name",
  "type": ["int", "string"]
} 

This should generate an "String" type that allows us to inspect which of the two are given. It should have both int and string attributes so we can retrieve them, and also a more generic value method to retrieve whichever one is set.