Details
-
Bug
-
Status: Patch Available
-
Major
-
Resolution: Unresolved
-
None
-
None
-
None
Description
The Avro Schema Specification states that when a field has type Union, the type of its default value must match the first type in the Union. This quite useful when defining optional fields, we just need to define the Field type as Union and place the null type in the first index of the type array.
When parsing an Avro Schema represented in JSON with the Schema.Parser class, one has to set the field default to null, even with the type is defined as Union and null is in the first index of the type array.
The Schema.Parser should handle this corner case gracefully and allow omitting the default value key for fields with type Union and its first type null.