Description
Will May opened SPR-12312 and commented
Add support for being able to validate a list of objects similar to the example below, where Foo is a class which has various JSR 303 annotations on its fields:
@RequestMapping(value = "/foo", method = RequestMethod.POST)
public void insertFoos(@Valid @RequestBody List<Foo> foos) {
...
}
I've managed to partially implement the functionality by extending the LocalValidatorFactoryBean
and setting the nested path to the current list path ([i]
) while calling super.validate
in a loop. This almost works apart from the fact that the BeanWrapper
cannot retrieve an invalid value if one fails validation and so throws an exception while trying to throw an exception.
So, in summary, the BeanWrapper needs to be able to work directly on lists rather than only being able to work on objects containing lists.
Affects: 4.0.7
Issue Links:
- @Validated support on Iterables (and implementors) [SPR-13428] #18007
@Validated
support on Iterables (and implementors) - Validate values in top-level Map parameters [SPR-14615] #19182 Validate values in top-level Map parameters
1 votes, 4 watchers