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:
1 votes, 4 watchers
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:
I've managed to partially implement the functionality by extending the
LocalValidatorFactoryBeanand setting the nested path to the current list path ([i]) while callingsuper.validatein a loop. This almost works apart from the fact that theBeanWrappercannot 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:
@Validatedsupport on Iterables (and implementors)1 votes, 4 watchers