Uploaded image for project: 'Errai'
  1. Errai
  2. ERRAI-839

Class level validation does not execute in some cases

    Details

    • Workaround:
      Workaround Exists
    • Workaround Description:
      Hide

      Include a field into the domain model like so

          @NotNull private transient Boolean forceClassLevelValidation = true;
      
      Show
      Include a field into the domain model like so @NotNull private transient Boolean forceClassLevelValidation = true ;

      Description

      Class level class validation does not occur unless there is at least one field level validation annotation on the class.

      
      @Portable
      @Bindable
      @ApplicationScoped
      @PropertySearchParamsValid
      public class PropertySearchParams extends PagingInfo {
          // -----------------------------------------------------------------------------
          // Instance Variables
          // -----------------------------------------------------------------------------
          private String addressOrPropertyKey;
          private Date dateFrom;
          private Date dateTo;
          private String agencyText;
          private String agentText;
          private String phoneText;
          private String supplierListingKey;
          private String supplier;
          
          // This is required to force validation at the class level, otherwise class level validation is omitted on the client side
          @NotNull private transient Boolean forceClassLevelValidation = true;
      
        ...
      }
      
      @Retention(RetentionPolicy.RUNTIME)
      @Target(ElementType.TYPE)
      @Constraint(validatedBy = PropertySearchParamsValidator.class)
      public @interface PropertySearchParamsValid {
          String message() default "";
          Class<?>[] groups() default { };
          Class<? extends Payload>[] payload() default { };
      }
      
      

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Assignee:
                ddadlani Divya Dadlani
                Reporter:
                pmwqld Paul Wills
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: