As far as I understand, if a record field has a union type and a default value is specified, the type of the default value must match the first element of the union.
https://avro.apache.org/docs/1.12.0/specification/#complex-types
When using io.confluent:kafka-schema-registry-client and io.confluent:kafka-schema-serializer version 8.1.0, attempting to register a schema that violates this rule resulted in the following error:
org.apache.avro.AvroTypeException: Invalid default for field ...
However, after updating to version 8.1.1, these components allow such a schema to be registered without errors.
Is this behavior expected?
Does it comply with the Apache Avro specification?
I am the main contributor to the plugin
https://github.com/rudikone/avroschema-wizard-plugin
Here is an example demonstrating the behavior I described:
rudikone/avroschema-wizard-plugin@fd1bad4
As far as I understand, if a record field has a
uniontype and a default value is specified, the type of the default value must match the first element of theunion.https://avro.apache.org/docs/1.12.0/specification/#complex-types
When using io.confluent:kafka-schema-registry-client and io.confluent:kafka-schema-serializer version 8.1.0, attempting to register a schema that violates this rule resulted in the following error:
However, after updating to version 8.1.1, these components allow such a schema to be registered without errors.
Is this behavior expected?
Does it comply with the Apache Avro specification?
I am the main contributor to the plugin
https://github.com/rudikone/avroschema-wizard-plugin
Here is an example demonstrating the behavior I described:
rudikone/avroschema-wizard-plugin@fd1bad4