java-micronaut.common.params.beanValidation.mustache Maven / Gradle / Ivy
{{!First handle the nullable - it should be present unless otherwise specified}}
{{#isNullable}}@Nullable {{/isNullable}}{{^isNullable}}{{^required}}@Nullable {{/required}}{{/isNullable}}{{!
All the validation
}}{{#useBeanValidation}}{{!
nullable overrides required
}}{{^isNullable}}{{#required}}@NotNull {{/required}}{{/isNullable}}{{!
validate all pojos and enums
}}{{^isContainer}}{{#isModel}}@Valid {{/isModel}}{{/isContainer}}{{!
pattern
}}{{#pattern}}{{^isByteArray}}@Pattern(regexp="{{{pattern}}}") {{/isByteArray}}{{/pattern}}{{!
both minLength && maxLength
}}{{#minLength}}{{#maxLength}}@Size(min={{minLength}}, max={{maxLength}}) {{/maxLength}}{{/minLength}}{{!
just minLength
}}{{#minLength}}{{^maxLength}}@Size(min={{minLength}}) {{/maxLength}}{{/minLength}}{{!
just maxLength
}}{{^minLength}}{{#maxLength}}@Size(max={{maxLength}}) {{/maxLength}}{{/minLength}}{{!
@Size: both minItems && maxItems
}}{{#minItems}}{{#maxItems}}@Size(min={{minItems}}, max={{maxItems}}) {{/maxItems}}{{/minItems}}{{!
@Size: just minItems
}}{{#minItems}}{{^maxItems}}@Size(min={{minItems}}) {{/maxItems}}{{/minItems}}{{!
@Size: just maxItems
}}{{^minItems}}{{#maxItems}}@Size(max={{maxItems}}) {{/maxItems}}{{/minItems}}{{!
@Email
}}{{#isEmail}}@Email {{/isEmail}}{{!
check for integer or long / all others=decimal type with @Decimal*
isInteger set
}}{{#isInteger}}{{#minimum}}@Min({{minimum}}) {{/minimum}}{{#maximum}}@Max({{maximum}}) {{/maximum}}{{/isInteger}}{{!
isLong set
}}{{#isLong}}{{#minimum}}@Min({{minimum}}L) {{/minimum}}{{#maximum}}@Max({{maximum}}L) {{/maximum}}{{/isLong}}{{!
Not Integer, not Long => we have a decimal value!
}}{{^isInteger}}{{^isLong}}{{!
minimum for decimal value
}}{{#minimum}}@DecimalMin({{#exclusiveMinimum}}value={{/exclusiveMinimum}}"{{minimum}}"{{#exclusiveMinimum}}, inclusive=false{{/exclusiveMinimum}}) {{/minimum}}{{!
maximal for decimal value
}}{{#maximum}}@DecimalMax({{#exclusiveMaximum}}value={{/exclusiveMaximum}}"{{maximum}}"{{#exclusiveMaximum}}, inclusive=false{{/exclusiveMaximum}}) {{/maximum}}{{!
close decimal values
}}{{/isLong}}{{/isInteger}}{{/useBeanValidation}}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy