Skip to content

Method validation is not triggered when constraints are applied to the elements of a List #31870

@mcso

Description

@mcso

In Spring Boot 3.2.0 it seems method validation is not always happening as expected, if the constraint is on list elements only. It can be worked around by applying @Valid or a @Constraint to the list, or by having another argument for the endpoint which has a @Constraint, but otherwise it seems to miss them.
I have attached a small demo project to illustrate it. I would expect all of the test cases to be a success, but the one with only a @Constraint applied to the list elements fails.
I haven't tested if the parameter is for example a map (if it is even possible in this context), but my guess is it has the same issue.

Spring Boot version: 3.2.0
Java version: OpenJDK 19 (19+36-2238)

demo.zip

Metadata

Metadata

Assignees

Labels

in: webIssues in web modules (web, webmvc, webflux, websocket)type: enhancementA general enhancement

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions