Uploaded image for project: 'Hibernate Validator'
  1. HV-1055

Default group sequence does not honour group hierarchy

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Blocker
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 5.2.4.Final, 5.3.0.CR1
    • Component/s: engine
    • Labels:
      None

      Description

      Assuming the following

      public interface Min {}
      
      public interface Max extends Min {}
      
      @GroupSequence({Max.class, A.class})
      public class A {
          @NotNull(groups=Max.class)
          public String foo;
      
          @NotNull(groups=Min.class)
          public String bar;
      }
      
      public class B {
          @NotNull(groups=Max.class)
          public String foo;
      
          @NotNull(groups=Min.class)
          public String bar;
      }
      

      The following code returns as expected

      assert validator.validate(new B(), Max.class, B.class).size() == 2
      

      But the following fails

      // bar is ignored as Min is not considered when Max is evaluated for default sequence
      // so size == 1
      assert validator.validate(new A(), Max.class, A.class).size() == 2
      

      Note that the actual test used group sequence provider but that's not relevant I think.

        Attachments

          Activity

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: