goavro icon indicating copy to clipboard operation
goavro copied to clipboard

Converting default value string of null to nil breaks legitimate schema.

Open mokobrosli opened this issue 2 years ago • 2 comments

https://github.com/linkedin/goavro/blob/8eb9f0e2d756cea165f593f80c6780f4b0b4dbb6/record.go#L112

This line treats "null" and null as equivalent for default values, however that is not the case. Having a default value that is actually the string "null" will fail when creating a new Codec.

To reproduce simply try goavro.NewCodec(sample) where sample is :

{ "name": "test_str", "type": [ "string", "null" ], "default": "null" }

The above would pass if the union was defined with null type as its first element but that's a different case. This would fail as well if it was a simple string type.

mokobrosli avatar Nov 01 '23 16:11 mokobrosli

Is there anyone working on this bug?

wk989898 avatar Jan 23 '25 02:01 wk989898

@wk989898 Not that I'm aware. PRs are welcome!

mihaitodor avatar Jan 26 '25 21:01 mihaitodor