You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is there a way to use schemas with union types like the one below?
With these union fields we are getting errors like "msg:"Id: avro: int is unsupported for Avro union"", and the only workaround I've found so far is defining our struct fields as pointer types, but that is error prone due to nil pointer dereference.
t.Run("Schema union type field", func(t *testing.T) {
type TestRecord struct {
Id int `avro:"id"`
}
schema, err := avro.Parse(`{
"type":"record",
"name":"TestRecord",
"namespace":"namespace",
"fields":[
{"name":"id","type":["null","int"]}
]}`)
assert.Nil(t, err)
in := TestRecord{Id: 5}
recordBinary, err := avro.Marshal(schema, in)
assert.Nil(t, err)
out := TestRecord{}
err = avro.Unmarshal(schema, recordBinary, &out)
assert.Nil(t, err)
})
The text was updated successfully, but these errors were encountered:
Is there a way to use schemas with union types like the one below?
With these union fields we are getting errors like "
msg:"Id: avro: int is unsupported for Avro union"
", and the only workaround I've found so far is defining our struct fields as pointer types, but that is error prone due to nil pointer dereference.The text was updated successfully, but these errors were encountered: