Details
-
Bug
-
Status: Open
-
Major
-
Resolution: Unresolved
-
1.8.1
-
None
-
None
Description
With an avro schema like
{ "name": "myfield", "type": "string", "default": "" }
the following code should throw an exception
MyObject myObject = MyObject.newBuilder().setMyfield(null).build();
But instead the value of myfield is set to null, which causes an exception later when serializing myObject, because null is not a valid value for myfield.
I believe in this case setMyfield(null) should throw an exception, independent of the value of default.
See also
https://stackoverflow.com/questions/38509279/generated-avro-builder-set-null-doesnt-overwrite-with-default