Details
-
Bug
-
Status: Open
-
Minor
-
Resolution: Unresolved
-
1.10.2
-
None
-
None
-
Debian
Description
We have a schema with a record with a union-type field with the "null" type being the first type and with a default value of `null`. When given a JSON datum without that field, decoding fails. I'd expect decoding to succeed with that field being given a value of `null`. Repro unit test to place in CodecTests.cc. (Apologies I can't get the code-formatting directives to work, so the code is a bit jumbled.)
{{static void optionalFieldNotSupported() {
const char *text = "
";
InputStreamPtr in =
memoryInputStream(reinterpret_cast<const uint8_t *>(text),
::strlen(text));
const char *schemaStr = "{\"type\":\"record\",\"name\":\"r\",\"fields\":["
"
,"
"
"
"]}";
ValidSchema schema = parsing::makeValidSchema(schemaStr);
DecoderPtr d = jsonDecoder(schema);
}}}