Skip to content

Add origin support for empty YAML list and map #21704

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from

Conversation

unix1982
Copy link
Contributor

@unix1982 unix1982 commented Jun 4, 2020

Add the fix for CollectionNode
Add some test

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Jun 4, 2020
@unix1982 unix1982 closed this Jun 9, 2020
@unix1982 unix1982 reopened this Jun 9, 2020
@mbhave mbhave added type: enhancement A general enhancement and removed status: waiting-for-triage An issue we've not yet triaged labels Jun 11, 2020
@mbhave mbhave added this to the 2.4.x milestone Jun 11, 2020
@snicoll snicoll changed the title gh-20506 Add origin support for empty YAML list and map Add origin support for empty YAML list and map Jul 9, 2020
@yan-khonski-it

This comment has been minimized.

@wilkinsona

This comment has been minimized.

philwebb pushed a commit that referenced this pull request Sep 22, 2020
Update `OriginTrackedYamlLoader` to better deal with empty maps
and collections.

See gh-21704
@philwebb philwebb closed this in 3bcbb0e Sep 22, 2020
@philwebb
Copy link
Member

Thanks very much for the contribution @unix1982. This is in master and will be part of 2.4.

@philwebb philwebb modified the milestones: 2.4.x, 2.4.0-RC1 Sep 22, 2020
wilkinsona added a commit that referenced this pull request Sep 10, 2024
Adding origin support caused an unexpected and unwanted change
in behavior where configuration property binding would fail. The
failure would occur because there was no way to convert from the
entry in the environment that represents the empty map to the
target type.

The commit changes the YAML loader to drop empty maps,
effectively reverting the map portion of
3bcbb0e and gh-21704. This aligns
the behavior with the decision we made in gh-19095.

Origin support for an empty list has been retained as it does not
have a negative effect on configuration property binding. Prior to
these changes, an empty YAML list was mapped to an origin tracked
value that contains an empty list. Fully reverting
3bcbb0e would have resulted in an
empty YAML list being mapped to an empty string. To avoid adding a
collection type to the environment, we now map an empty YAML list
to an origin tracked value that contains an empty string.

Closes gh-35403
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement A general enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants