forked from loafle/openapi-generator-original
@@ -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}}
|
||||
@@ -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}}
|
||||
@@ -0,0 +1 @@
|
||||
{{! PathParam is always required, no @NotNull necessary }}{{>beanValidationCore}}
|
||||
@@ -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}}
|
||||
@@ -1 +1 @@
|
||||
{{#isPathParam}}@PathParam("{{baseName}}") {{{dataType}}} {{paramName}}{{/isPathParam}}
|
||||
{{#isPathParam}}@PathParam("{{baseName}}"){{#useBeanValidation}}{{>beanValidationPathParams}}{{/useBeanValidation}} {{{dataType}}} {{paramName}}{{/isPathParam}}
|
||||
@@ -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")
|
||||
|
||||
@@ -49,9 +49,7 @@ public class FormatTest {
|
||||
* maximum: 100
|
||||
* @return integer
|
||||
**/
|
||||
@Min(10)
|
||||
@Max(100)
|
||||
public Integer getInteger() {
|
||||
@Min(10) @Max(100) public Integer getInteger() {
|
||||
return integer;
|
||||
}
|
||||
|
||||
@@ -70,9 +68,7 @@ public class FormatTest {
|
||||
* maximum: 200
|
||||
* @return int32
|
||||
**/
|
||||
@Min(20)
|
||||
@Max(200)
|
||||
public Integer getInt32() {
|
||||
@Min(20) @Max(200) public Integer getInt32() {
|
||||
return int32;
|
||||
}
|
||||
|
||||
@@ -109,9 +105,7 @@ public class FormatTest {
|
||||
* @return number
|
||||
**/
|
||||
@NotNull
|
||||
@DecimalMin("32.1")
|
||||
@DecimalMax("543.2")
|
||||
public BigDecimal getNumber() {
|
||||
@DecimalMin("32.1") @DecimalMax("543.2") public BigDecimal getNumber() {
|
||||
return number;
|
||||
}
|
||||
|
||||
@@ -130,9 +124,7 @@ public class FormatTest {
|
||||
* 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;
|
||||
}
|
||||
|
||||
@@ -151,9 +143,7 @@ public class FormatTest {
|
||||
* 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;
|
||||
}
|
||||
|
||||
@@ -170,8 +160,7 @@ public class FormatTest {
|
||||
* Get string
|
||||
* @return string
|
||||
**/
|
||||
@Pattern(regexp="/[a-z]/i")
|
||||
public String getString() {
|
||||
@Pattern(regexp="/[a-z]/i") public String getString() {
|
||||
return string;
|
||||
}
|
||||
|
||||
@@ -276,8 +265,7 @@ public class FormatTest {
|
||||
* @return password
|
||||
**/
|
||||
@NotNull
|
||||
@Size(min=10,max=64)
|
||||
public String getPassword() {
|
||||
@Size(min=10,max=64) public String getPassword() {
|
||||
return password;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user