Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,53 +1,4 @@
{{#required}}
@NotNull
{{/required}}
{{#pattern}}
@Pattern(regexp="{{pattern}}")
{{/pattern}}
{{#minLength}}
{{#maxLength}}
@Size(min={{minLength}},max={{maxLength}})
{{/maxLength}}
{{/minLength}}
{{#minLength}}
{{^maxLength}}
@Size(min={{minLength}})
{{/maxLength}}
{{/minLength}}
{{^minLength}}
{{#maxLength}}
@Size(max={{maxLength}})
{{/maxLength}}
{{/minLength}}
{{#minItems}}
{{#maxItems}}
@Size(min={{minItems}},max={{maxItems}})
{{/maxItems}}
{{/minItems}}
{{#minItems}}
{{^maxItems}}
@Size(min={{minItems}})
{{/maxItems}}
{{/minItems}}
{{^minItems}}
{{#maxItems}}
@Size(max={{maxItems}})
{{/maxItems}}
{{/minItems}}
{{! check for integer / number=decimal type}}
{{#isInteger}}
{{#minimum}}
@Min({{minimum}})
{{/minimum}}
{{#maximum}}
@Max({{maximum}})
{{/maximum}}
{{/isInteger}}
{{^isInteger}}
{{#minimum}}
@DecimalMin("{{minimum}}")
{{/minimum}}
{{#maximum}}
@DecimalMax("{{maximum}}")
{{/maximum}}
{{/isInteger}}
{{>beanValidationCore}}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{{#pattern}} @Pattern(regexp="{{pattern}}"){{/pattern}}{{!
minLength && maxLength set
}}{{#minLength}}{{#maxLength}} @Size(min={{minLength}},max={{maxLength}}){{/maxLength}}{{/minLength}}{{!
minLength set, maxLength not
}}{{#minLength}}{{^maxLength}} @Size(min={{minLength}}){{/maxLength}}{{/minLength}}{{!
minLength not set, maxLength set
}}{{^minLength}}{{#maxLength}} @Size(max={{maxLength}}){{/maxLength}}{{/minLength}}{{!
@Size: minItems && maxItems set
}}{{#minItems}}{{#maxItems}} @Size(min={{minItems}},max={{maxItems}}){{/maxItems}}{{/minItems}}{{!
@Size: minItems set, maxItems not
}}{{#minItems}}{{^maxItems}} @Size(min={{minItems}}){{/maxItems}}{{/minItems}}{{!
@Size: minItems not set && maxItems set
}}{{^minItems}}{{#maxItems}} @Size(max={{maxItems}}){{/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}}{{!
isLong set
}}{{#isLong}}{{#minimum}} @Min({{minimum}}){{/minimum}}{{#maximum}} @Max({{maximum}}){{/maximum}}{{/isLong}}{{!
Not Integer, not Long => we have a decimal value!
}}{{^isInteger}}{{^isLong}}{{#minimum}} @DecimalMin("{{minimum}}"){{/minimum}}{{#maximum}} @DecimalMax("{{maximum}}"){{/maximum}}{{/isLong}}{{/isInteger}}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{{! PathParam is always required, no @NotNull necessary }}{{>beanValidationCore}}
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{{#required}} @NotNull{{/required}}{{#pattern}} @Pattern(regexp="{{pattern}}"){{/pattern}}{{#minLength}}{{#maxLength}} @Size(min={{minLength}},max={{maxLength}}){{/maxLength}}{{/minLength}}{{#minLength}}{{^maxLength}} @Size(min={{minLength}}){{/maxLength}}{{/minLength}}{{^minLength}}{{#maxLength}} @Size(max={{maxLength}}){{/maxLength}}{{/minLength}}{{#minItems}}{{#maxItems}} @Size(min={{minItems}},max={{maxItems}}){{/maxItems}}{{/minItems}}{{#minItems}}{{^maxItems}} @Size(min={{minItems}}){{/maxItems}}{{/minItems}}{{^minItems}}{{#maxItems}} @Size(max={{maxItems}}){{/maxItems}}{{/minItems}}{{#minimum}} @Min({{minimum}}){{/minimum}}{{#maximum}} @Max({{maximum}}){{/maximum}}
{{#required}} @NotNull{{/required}}{{>beanValidationCore}}
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{{#isPathParam}}@PathParam("{{baseName}}") {{{dataType}}} {{paramName}}{{/isPathParam}}
{{#isPathParam}}@PathParam("{{baseName}}"){{#useBeanValidation}}{{>beanValidationPathParams}}{{/useBeanValidation}} {{{dataType}}} {{paramName}}{{/isPathParam}}
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public interface StoreApi {
@Path("/store/order/{orderId}")
@Produces({ "application/xml", "application/json" })
@ApiOperation(value = "Find purchase order by ID", tags={ "store", })
public Order getOrderById(@PathParam("orderId") Long orderId);
public Order getOrderById(@PathParam("orderId") @Min(1) @Max(5) Long orderId);

@POST
@Path("/store/order")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,7 @@ public class FormatTest {
* maximum: 100
* @return integer
**/
@Min(10)
@Max(100)
public Integer getInteger() {
@Min(10) @Max(100) public Integer getInteger() {
return integer;
}

Expand All @@ -69,9 +67,7 @@ public FormatTest integer(Integer integer) {
* maximum: 200
* @return int32
**/
@Min(20)
@Max(200)
public Integer getInt32() {
@Min(20) @Max(200) public Integer getInt32() {
return int32;
}

Expand Down Expand Up @@ -108,9 +104,7 @@ public FormatTest int64(Long int64) {
* @return number
**/
@NotNull
@DecimalMin("32.1")
@DecimalMax("543.2")
public BigDecimal getNumber() {
@DecimalMin("32.1") @DecimalMax("543.2") public BigDecimal getNumber() {
return number;
}

Expand All @@ -129,9 +123,7 @@ public FormatTest number(BigDecimal number) {
* maximum: 987.6
* @return _float
**/
@DecimalMin("54.3")
@DecimalMax("987.6")
public Float getFloat() {
@DecimalMin("54.3") @DecimalMax("987.6") public Float getFloat() {
return _float;
}

Expand All @@ -150,9 +142,7 @@ public FormatTest _float(Float _float) {
* maximum: 123.4
* @return _double
**/
@DecimalMin("67.8")
@DecimalMax("123.4")
public Double getDouble() {
@DecimalMin("67.8") @DecimalMax("123.4") public Double getDouble() {
return _double;
}

Expand All @@ -169,8 +159,7 @@ public FormatTest _double(Double _double) {
* Get string
* @return string
**/
@Pattern(regexp="/[a-z]/i")
public String getString() {
@Pattern(regexp="/[a-z]/i") public String getString() {
return string;
}

Expand Down Expand Up @@ -275,8 +264,7 @@ public FormatTest uuid(String uuid) {
* @return password
**/
@NotNull
@Size(min=10,max=64)
public String getPassword() {
@Size(min=10,max=64) public String getPassword() {
return password;
}

Expand Down