Status
Current state: Under DiscussionAccepted
Discussion thread: https://lists.apache.org/thread/lxfq8y8co76mjwxhowwx6cjl0hw1mxpy
JIRA:
Jira |
---|
server | ASF JIRA |
---|
serverId | 5aa69414-a9e9-3523-82ec-879b028fb15b |
---|
key | KAFKA-8713 |
---|
|
Release: 3.5.0
Motivation
JsonConverter is used by Connect to convert raw JSON payloads, in bytes, to and from Connect schemas an values objects. When converting Connect objects to bytes, if the value is null and the field has a default value, JsonConverter always emits the default value. In some cases, for example when the value is explicitly set to null, it would be preferable to keep the null value instead.
...
Add a configuration to JsonConverter:
Name: replace.optional.null.with.default
Description: Whether to replace fields that have a default value and that are null to the default value. When set to true, the default value is used, otherwise null is used.
Type: Boolean
Default: true
...
Rejected Alternatives
- Always take
null
on an optional a null
field which has default value. It will break the compatibility and only cover partial cases. - Add the configuration to ConverterConfig