goavro
goavro copied to clipboard
Empty arrays are not encoded into native correctly
nativeOutput is not identical to nativeInput:
codec, err := goavro.NewCodec(`
{
"type": "record",
"name": "name",
"fields" : [
{"name": "a", "type": [{
"items": "string",
"type": "array"
}]}
]
}`)
if err != nil {
fmt.Println(err)
}
nativeInput := map[string]interface{}{
"a": map[string]interface{}{"array": []interface{}{}},
}
textual, err := codec.TextualFromNative(nil, nativeInput)
if err != nil {
fmt.Println(err)
}
nativeOutput, _, err := codec.NativeFromTextual(textual)
if err != nil {
fmt.Println(err)
}
fmt.Println(reflect.DeepEqual(nativeInput, nativeOutput)) // RETURNS false!!!