actgardner/gogen-avro

JSON-encode unions with fully-qualified type names

Closed this issue · 2 comments

The spec is not explicit, but other avro libraries encode the fully-qualified name of a type into the key when JSON-encoding a union. We should do the same.

When using gogen-avro v7 generated structs for union type, there is an issue in combination with linkedin/goavro and apache-pulsar.

The pulsar client code Encode uses three steps to get the binary data, first marshal the struct to json, then json -> native, which uses json field names as the codec key. In the case of unions, the codec key is namespace.name but the json textual representation field is just name.

I am hopeful that switching to the fully-qualified name (namespace.name) will fix this and will be testing it out via the v8-beta branch
f02e44d

I'm assuming the commit will fix the issue, so I'm interested if there is there a timeline for a v8 release?

@samuelhewitt This should be fixed in the 8.0 release I just cut, feel free to reopen this issue if it isn't!