Correctly follow GroupSequence definitions when validating
----------------------------------------------------------

                 Key: BVAL-47
                 URL: https://issues.apache.org/jira/browse/BVAL-47
             Project: BeanValidation
          Issue Type: Bug
          Components: jsr303
    Affects Versions: 0.1-incubating
            Reporter: Carlos Vara


I'm submitting this here for review as the solution involves many structural 
changes in ClassValidator. If you think the patch is fine, I can merge it once 
I get commit access.

Basically, when validating the default group in a bean:
- If a group sequence is defined in the bean class, iterate that sequence and 
stop if any violation is found.
- If no group sequence is defined in the bean class, get the hierarchy of 
classes in the bean, and for each class, check the constraints defined in that 
class or interface according to the group sequence defined in that class.

The same algorithm must be applied to related beans (@Valid), and validation 
starts again from the default group for them (groups defined in the group 
sequence of their parent bean must not be applied to their related beans).

I added 2 additional tests, those and the TCK tests in 
GroupSequenceIsolationTest should help clarify the spec regarding this.

Resulting ClassValidator is quite decoupled from BeanValidator (the class it 
inherits from, in bval-core). Some of the methods are similar in code, but the 
order in which they are called differs, so overriding wasn't an option. It 
could be an option to completely remove inheritance in the future to obtain a 
cleaner ClassValidator.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to