HandlerMethodValidationException.Visitor should support RequestBody with method parameter constraints #34549
Labels
in: web
Issues in web modules (web, webmvc, webflux, websocket)
type: enhancement
A general enhancement
Milestone
Environment
Spring Boot: 3.4.3
Spring Web: 6.2.3
Java: 17
Expected Behavior
When a
@RequestBody
value is invalid,HandlerMethodValidationException.Visitor
should call the appropriate method.Observed Behavior
Instead,
HandlerMethodValidationException.Visitor
throwsIllegalStateException
with"Expected ParameterErrors"
message.Example code
Example request
Insights
In
HandlerMethodValidationException#visitResults(HandlerMethodValidationException.Visitor)
:the condition
if (requestBody != null)
istrue
, but theasErrors(result)
is throwing the exception because in this caseresult
is not an instance ofParameterErrors
butParameterValidationResult
.The text was updated successfully, but these errors were encountered: