actgardner/gogen-avro

null union should not generate union types

Opened this issue · 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
}

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?