Allow YAML processors to create a flattened map with nulls included by philwebb · Pull Request #36197 · spring-projects/spring-framework

@philwebb

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>