-
Notifications
You must be signed in to change notification settings - Fork 40.9k
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
server.error.include-binding-errors does not recognize MethodValidationResult exceptions #39858
Labels
Comments
spring-projects-issues
added
the
status: waiting-for-triage
An issue we've not yet triaged
label
Mar 8, 2024
quaff
added a commit
to quaff/spring-boot
that referenced
this issue
Mar 11, 2024
quaff
added a commit
to quaff/spring-boot
that referenced
this issue
Mar 11, 2024
wilkinsona
added
type: bug
A general bug
and removed
status: waiting-for-triage
An issue we've not yet triaged
labels
Mar 18, 2024
wilkinsona
changed the title
server.error.include-binding-errors does not recognize MethodValidationResult exceptions
Mar 18, 2024
server.error.include-binding-errors
does not recognize MethodValidationResult exceptions
quaff
added a commit
to quaff/spring-boot
that referenced
this issue
Apr 12, 2024
quaff
added a commit
to quaff/spring-boot
that referenced
this issue
Apr 13, 2024
Closing in favor of #39865. |
wilkinsona
added
the
status: superseded
An issue that has been superseded by another
label
Apr 22, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
DefaultErrorAttributes
recognizesBindingResult
exceptions such asMethodArgumentNotValidException
, and adds an "errors" field to the response. This is further controlled with the propertyserver.error.include-binding-errors
.As of Spring Framework 6.1, built-in method validation can raise
HandlerMethodValidationException
instead when there are method parameter constraints. Beyond web endpoints, any Spring component with a validation proxy can raiseMethodValidationException
. Both implementMethodValidationResult
.BindingResult
includes errors for a single method parameter (command object), whileMethodValidationResult
includes errors for all validated method parameters, eitherParameterValidationResult
(for constraints directly on method parameter) orParameterErrors
(constraints on properties of command object). The latter is the equivalent of aBindingResult
for the method parameter when method validation is used.DefaultErrorAttributes
should support exceptions of typeMethodValidationResult
in addition toBindingResult
. I thinkserver.error.include-binding-errors
could be extended to cover errors for all parameters, but it should at least properly handle and include anyParameterErrors
, or otherwise there is no "errors" field at all as reported in spring-projects/spring-framework#32396.The text was updated successfully, but these errors were encountered: