Allow YAML processors to create a flattened map with nulls included#36197
Merged
jhoeller merged 1 commit intospring-projects:mainfrom Jan 23, 2026
Merged
Allow YAML processors to create a flattened map with nulls included#36197jhoeller merged 1 commit intospring-projects:mainfrom
jhoeller merged 1 commit intospring-projects:mainfrom
Conversation
Add an additional `getFlattenedMap` method to `YamlProcessor` to allow
the resulting flattened map to include nulls.
This update will allow processor subclasses to tell the difference
between YAML that is defined with an empty object vs missing the key
entirely:
e.g.:
application:
name: test
optional: {}
vs
application:
name: test
optional: {}
Closes spring-projectsgh-36197
Signed-off-by: Phillip Webb <phil.webb@broadcom.com>
philwebb
added a commit
to philwebb/spring-framework
that referenced
this pull request
Jan 24, 2026
Update `YamlProcessor` to allow any value to be inserted for empty entries. This update will allow blank strings to be used instead of `null` which better aligns with the way that `.properties` files are loaded. This update also allows allows the specified `emptyValue` to be inserted instead of a blank String when the YAML contains `null` or `~` values. See spring-projectsgh-36197 See spring-projectsgh-19986 Signed-off-by: Phillip Webb <phil.webb@broadcom.com>
philwebb
added a commit
to philwebb/spring-framework
that referenced
this pull request
Jan 24, 2026
Update `YamlProcessor` to allow any value to be inserted for empty entries. This update will allow blank strings to be used instead of `null` which better aligns with the way that `.properties` files are loaded. This update also allows allows the specified `emptyValue` to be inserted instead of a blank String when the YAML contains `null` or `~` values. See spring-projectsgh-36197 See spring-projectsgh-19986 Signed-off-by: Phillip Webb <phil.webb@broadcom.com>
jhoeller
pushed a commit
that referenced
this pull request
Jan 24, 2026
Update `YamlProcessor` to allow any value to be inserted for empty entries. This update will allow blank strings to be used instead of `null` which better aligns with the way that `.properties` files are loaded. This update also allows allows the specified `emptyValue` to be inserted instead of a blank String when the YAML contains `null` or `~` values. See gh-36197 See gh-19986 Signed-off-by: Phillip Webb <phil.webb@broadcom.com>
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.
Whilst looking into spring-projects/spring-boot#48920 I realized we don't currently have a good way to flatten a YAML map and retain
nullvalues. Whilst we could do this in Spring Boot, it would mean duplicating code so I wonder if we can add a new method here instead.