Details
-
Bug
-
Status: Open
-
Major
-
Resolution: Unresolved
-
None
-
None
-
None
Description
I would expect this schema to allow building an Avro Issue without providing a value for severity but it fails:
{ "protocol" : "Protocol", "namespace" : "com.namespace", "types" : [ { "type" : "record", "name" : "Issue", "fields" : [ { "name" : "id", "type" : "string" }, { "name" : "severity", "type" : { "type" : "enum", "name" : "Severity", "symbols" : [ "Unknown", "Mild", "Moderate", "Severe" ], "default" : "Unknown" } } ] } ], "messages" : { } }
Issue.newBuilder().setId("someId").build();
Error:
Field severity type:ENUM pos:4 not set and has no default value Path in schema: --> severity at org.apache.avro.generic.GenericData.getDefaultValue(GenericData.java:1173) at org.apache.avro.data.RecordBuilderBase.defaultValue(RecordBuilderBase.java:142)