We're updating the issue view to help you get more done. 

Cascading validation does not work on classes which implement Iterable.

Description

I had a class which implemented Iterable, but also had constraints I expected to be validated. Everything worked as expected when validating this class directly, but when this class was part of a cascading validation, it's annotated fields were never validated. I found the code in org.hibernate.validator.internal.engine.ValidatorImpl#createIteratorForCascadedValue which looks culpable. If the given type is Iterable, only the elements in the result of invoking iterator() will be validated. I think it should also validate any annotated members of the type itself. In other words, I don't think being iterable should preclude having constraints validated. I've attached a simple test case illustrating the problem. Thank you.

Environment

None

Status

Assignee

Unassigned

Reporter

William Kemper

Components

Fix versions

Affects versions

5.1.1.Final

Priority

Major