Spring 5 is supposed to support Bean Validation 2.0 which introduced validation on List types but I can't seem to get it to work for me.
I have the following endpoint in my @RestController
:
@PostMapping("/foos")
public List<Foo> analysePoints(@RequestBody @Valid List<@Valid Foo> request) {
...
}
Where the class Foo has some JSR validation annotations on its properties.
Unfortunately, this doesn't seem to validate it at all. Prior to Spring 5 I got around this by wrapping the List<Foo>
in a separate request bean object and this does work in this case too but I don't want to have to do this because it changes the format of the json required.
Is there any way to get this working?