Improve method validation support for errors on elements within a container#31530
Closed
k-seth wants to merge 1 commit intospring-projects:mainfrom
Closed
Improve method validation support for errors on elements within a container#31530k-seth wants to merge 1 commit intospring-projects:mainfrom
k-seth wants to merge 1 commit intospring-projects:mainfrom
Conversation
Contributor
|
For additional context, see #30645 (comment). In short, currently we support |
rstoyanchev
pushed a commit
that referenced
this pull request
Nov 2, 2023
Contributor
|
Thanks for the report and changes. Element container handling is not only improved but also simpler. |
rstoyanchev
added a commit
that referenced
this pull request
Dec 18, 2023
Method validation needs to be used for a container such as a List or Map, but until now we were only checking for a List container. Moreover, in gh-31530 we improved method validation to also cover any Collection. This change aligns with HandlerMethod check for when method validation applies with the underlying ability of method validation.
rstoyanchev
added a commit
that referenced
this pull request
Dec 20, 2023
The goal for #31530 was to support bean validation on Set and other method parameters that are containers of value(s) for which there is a registered Jakarta Validation ValueExtractor. Unfortunately, bean validation does not expose the unwrapped value for a Path.Node, which we need for a method parameter in order to create a BindingResult for the specific bean within the container, and the leafBean that we tried to use is really the node at the very bottom of the property path (i.e. not what we need). This change removes the use of beanLeaf, restores the logic as it was before, adds support for arrays, and a new test class for scenarios with cascaded violations. See gh-31746
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.
Expands on the validation behaviour added as part of the work for #30645, motivated by an issue with Sets containing an object with nested Lists, introduced in #29825. The adapter should now better handle nested objects for types beyond those of List or Map.