gogen-avro icon indicating copy to clipboard operation
gogen-avro copied to clipboard

null union should not generate union types

Open jiping-s opened this issue 2 years ago • 1 comments

Unions with null in code should be replaced by pointers or option types.

For example:

{
    "name": "Name",
    "type": [
        "null",
        "string"
    ]
},

Generates a NameUnion, which could have been:

type Entity struct ... {
    Name *string
}

jiping-s avatar Mar 30 '22 15:03 jiping-s

We too have found this to be very surprising behaviour... handling simple null unions as struct fields would align with how Avro Java codegen works and seems a much more intuitive representation.

@actgardner Any chance this could be addressed in a future release?

frankgrimes97 avatar Aug 15 '22 14:08 frankgrimes97