-
Notifications
You must be signed in to change notification settings - Fork 6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #10887 from renanr0/issue-5643-contribute
add support for message to most used validations
- Loading branch information
Showing
1 changed file
with
9 additions
and
9 deletions.
There are no files selected for viewing
18 changes: 9 additions & 9 deletions
18
modules/swagger-codegen/src/main/resources/JavaSpring/beanValidationCore.mustache
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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}} |