Accept empty string as null in PluginModel deserializer and add Coerc…#6915
Open
Davidding4718 wants to merge 3 commits into
Open
Accept empty string as null in PluginModel deserializer and add Coerc…#6915Davidding4718 wants to merge 3 commits into
Davidding4718 wants to merge 3 commits into
Conversation
…ionConfig for settings conversion Signed-off-by: Siqi Ding <dingdd@amazon.com>
dlvenable
requested changes
Jun 11, 2026
| private static final ObjectMapper SERIALIZER_OBJECT_MAPPER = new ObjectMapper(); | ||
| static { | ||
| SERIALIZER_OBJECT_MAPPER.coercionConfigDefaults() | ||
| .setCoercion(CoercionInputShape.EmptyString, CoercionAction.AsNull); |
Member
There was a problem hiding this comment.
I'm not sure this is the right solution. It is going to affect all strings making them the same as null.
I think we should avoid this coercion.
In the plugin framework we handle the situation where the plugin is provided as:
something_using_a_plugin:
some_plugin: ""
Only when parsing the PluginModel should you treat an empty string ("") the same as null.
Contributor
Author
There was a problem hiding this comment.
You're right. The global CoercionConfig was too broad and would silently null out legitimate empty strings in plugin settings. I have removed it in the newest commit.
Remove the SERIALIZER_OBJECT_MAPPER CoercionConfig that globally coerced empty strings to null across all fields. The targeted VALUE_STRING check in the deserializer already handles bare YAML keys (e.g. stdout:) by treating empty string as null only at the plugin name level. Signed-off-by: Siqi Ding <dingdd@amazon.com>
dlvenable
approved these changes
Jun 16, 2026
dlvenable
left a comment
Member
There was a problem hiding this comment.
Thanks @Davidding4718 for the contribution!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
After Jackson-dataformat-yaml 2.13+, bare YAML keys (e.g.,
stdout:,newline:) produceVALUE_STRING ""instead ofVALUE_NULL. This change updates PluginModel to:stdout:are treated as plugins with null settings (same behavior as Jackson 2.12)EmptyString → AsNullso that when plugin settings are converted to typed model classes viaconvertValue(), empty strings from bare YAML keys are coerced to nullThis maintains backward compatibility for pipeline configurations that use bare keys for plugins with no settings, which is the standard YAML pattern for Data Prepper pipelines.
Issues Resolved
Resolves #6598 (follow-up — original PR rejected empty strings; this accepts them per team decision)
Check List
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.