Skip to content

Commit

Permalink
Merge pull request #10887 from renanr0/issue-5643-contribute
Browse files Browse the repository at this point in the history
add support for message to most used validations
  • Loading branch information
HugoMario authored Oct 31, 2023
2 parents 4b96fd2 + 88e41a6 commit 933996b
Showing 1 changed file with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
{{#pattern}}@Pattern(regexp="{{{pattern}}}"{{#vendorExtensions.x-pattern-message}}, message="{{vendorExtensions.x-pattern-message}}"{{/vendorExtensions.x-pattern-message}}) {{/pattern}}{{!
minLength && maxLength set
}}{{#minLength}}{{#maxLength}}@Size(min={{minLength}},max={{maxLength}}) {{/maxLength}}{{/minLength}}{{!
}}{{#minLength}}{{#maxLength}}@Size(min={{minLength}},max={{maxLength}}{{#vendorExtensions.x-length-message}}, message="{{vendorExtensions.x-length-message}}"{{/vendorExtensions.x-length-message}}) {{/maxLength}}{{/minLength}}{{!
minLength set, maxLength not
}}{{#minLength}}{{^maxLength}}@Size(min={{minLength}}) {{/maxLength}}{{/minLength}}{{!
}}{{#minLength}}{{^maxLength}}@Size(min={{minLength}}{{#vendorExtensions.x-length-message}}, message="{{vendorExtensions.x-length-message}}"{{/vendorExtensions.x-length-message}}) {{/maxLength}}{{/minLength}}{{!
minLength not set, maxLength set
}}{{^minLength}}{{#maxLength}}@Size(max={{maxLength}}) {{/maxLength}}{{/minLength}}{{!
}}{{^minLength}}{{#maxLength}}@Size(max={{maxLength}}{{#vendorExtensions.x-length-message}}, message="{{vendorExtensions.x-length-message}}"{{/vendorExtensions.x-length-message}}) {{/maxLength}}{{/minLength}}{{!
@Size: minItems && maxItems set
}}{{#minItems}}{{#maxItems}}@Size(min={{minItems}},max={{maxItems}}) {{/maxItems}}{{/minItems}}{{!
}}{{#minItems}}{{#maxItems}}@Size(min={{minItems}},max={{maxItems}}{{#vendorExtensions.x-items-message}}, message="{{vendorExtensions.x-items-message}}"{{/vendorExtensions.x-items-message}}) {{/maxItems}}{{/minItems}}{{!
@Size: minItems set, maxItems not
}}{{#minItems}}{{^maxItems}}@Size(min={{minItems}}) {{/maxItems}}{{/minItems}}{{!
}}{{#minItems}}{{^maxItems}}@Size(min={{minItems}}{{#vendorExtensions.x-items-message}}, message="{{vendorExtensions.x-items-message}}"{{/vendorExtensions.x-items-message}}) {{/maxItems}}{{/minItems}}{{!
@Size: minItems not set && maxItems set
}}{{^minItems}}{{#maxItems}}@Size(max={{maxItems}}) {{/maxItems}}{{/minItems}}{{!
}}{{^minItems}}{{#maxItems}}@Size(max={{maxItems}}{{#vendorExtensions.x-items-message}}, message="{{vendorExtensions.x-items-message}}"{{/vendorExtensions.x-items-message}}) {{/maxItems}}{{/minItems}}{{!
check for integer or long / all others=decimal type with @Decimal*
isInteger set
}}{{#isInteger}}{{#minimum}}@Min({{minimum}}){{/minimum}}{{#maximum}} @Max({{maximum}}) {{/maximum}}{{/isInteger}}{{!
}}{{#isInteger}}{{#minimum}}@Min({{minimum}}{{#vendorExtensions.x-minimum-message}}, message="{{vendorExtensions.x-minimum-message}}"{{/vendorExtensions.x-minimum-message}}){{/minimum}}{{#maximum}} @Max({{maximum}}{{#vendorExtensions.x-maximum-message}}, message="{{vendorExtensions.x-maximum-message}}"{{/vendorExtensions.x-maximum-message}}) {{/maximum}}{{/isInteger}}{{!
isLong set
}}{{#isLong}}{{#minimum}}@Min({{minimum}}L){{/minimum}}{{#maximum}} @Max({{maximum}}L) {{/maximum}}{{/isLong}}{{!
}}{{#isLong}}{{#minimum}}@Min({{minimum}}L{{#vendorExtensions.x-minimum-message}}, message="{{vendorExtensions.x-minimum-message}}"{{/vendorExtensions.x-minimum-message}}){{/minimum}}{{#maximum}} @Max({{maximum}}L{{#vendorExtensions.x-maximum-message}}, message="{{vendorExtensions.x-maximum-message}}"{{/vendorExtensions.x-maximum-message}}) {{/maximum}}{{/isLong}}{{!
Not Integer, not Long => we have a decimal value!
}}{{^isInteger}}{{^isLong}}{{#minimum}}@DecimalMin("{{minimum}}"){{/minimum}}{{#maximum}} @DecimalMax("{{maximum}}") {{/maximum}}{{/isLong}}{{/isInteger}}
}}{{^isInteger}}{{^isLong}}{{#minimum}}@DecimalMin("{{minimum}}"{{#vendorExtensions.x-minimum-message}}, message="{{vendorExtensions.x-minimum-message}}"{{/vendorExtensions.x-minimum-message}}){{/minimum}}{{#maximum}} @DecimalMax("{{maximum}}"{{#vendorExtensions.x-maximum-message}}, message="{{vendorExtensions.x-maximum-message}}"{{/vendorExtensions.x-maximum-message}}) {{/maximum}}{{/isLong}}{{/isInteger}}

0 comments on commit 933996b

Please sign in to comment.