jackson-dataformats-binary
jackson-dataformats-binary copied to clipboard
[Avro] JsonInclude.Include.NON_NULL does not use default values
In the following example, I'd expect that the default value defined for the property map would be used. Instead, null is passed, which produces an error as null is not allowed for this field.
Schema
{"type": "map", "values": "string", "default": []}
POJO
class Foo {
@JsonProperty("map")
@JsonInclude(JsonInclude.Include.NON_EMPTY)
Map<String, String> getMap();
}
Error
com.fasterxml.jackson.databind.JsonMappingException: null of map in field map of Foo
Thank you for reporting the problem!
Handling of default values is probably bit incomplete, but it should be possible to improve that esp. for case of of empty array/Collection.
Thanks for the feedback @cowtowncoder :)
Please let me know if I can help in any way.