forked from loafle/openapi-generator-original
[jaxrs-reasteasy-eap] Fix invalid Bean Validation annotations for Longs (#5659)
* fix issue #5658 * update samples
This commit is contained in:
@@ -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}}
|
||||
20
modules/openapi-generator/src/main/resources/JavaJaxRS/resteasy/eap/beanValidationCore.mustache
vendored
Normal file
20
modules/openapi-generator/src/main/resources/JavaJaxRS/resteasy/eap/beanValidationCore.mustache
vendored
Normal file
@@ -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}}L){{/minimum}}{{#maximum}} @Max({{maximum}}L){{/maximum}}{{/isLong}}{{!
|
||||
Not Integer, not Long => we have a decimal value!
|
||||
}}{{^isInteger}}{{^isLong}}{{#minimum}} @DecimalMin({{#exclusiveMinimum}}value={{/exclusiveMinimum}}"{{minimum}}"{{#exclusiveMinimum}},inclusive=false{{/exclusiveMinimum}}){{/minimum}}{{#maximum}} @DecimalMax({{#exclusiveMinimum}}value={{/exclusiveMinimum}}"{{maximum}}"{{#exclusiveMinimum}},inclusive=false{{/exclusiveMinimum}}){{/maximum}}{{/isLong}}{{/isInteger}}
|
||||
@@ -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 @@
|
||||
{{! PathParam is always required, no @NotNull necessary }}{{#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}}
|
||||
{{! 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}}
|
||||
@@ -54,7 +54,7 @@ public interface PetApi {
|
||||
}, tags={ "pet", })
|
||||
@io.swagger.annotations.ApiResponses(value = {
|
||||
@io.swagger.annotations.ApiResponse(code = 400, message = "Invalid pet value", response = Void.class) })
|
||||
public Response deletePet( @PathParam("petId") Long petId, @ApiParam(value = "" ) @HeaderParam("api_key") String apiKey,@Context SecurityContext securityContext);
|
||||
public Response deletePet( @PathParam("petId") Long petId, @ApiParam(value = "" ) @HeaderParam("api_key") String apiKey,@Context SecurityContext securityContext);
|
||||
@GET
|
||||
@Path("/findByStatus")
|
||||
|
||||
@@ -69,7 +69,7 @@ public interface PetApi {
|
||||
@io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Pet.class, responseContainer = "List"),
|
||||
|
||||
@io.swagger.annotations.ApiResponse(code = 400, message = "Invalid status value", response = Void.class) })
|
||||
public Response findPetsByStatus( @NotNull @QueryParam("status") List<String> status,@Context SecurityContext securityContext);
|
||||
public Response findPetsByStatus( @NotNull @QueryParam("status") List<String> status,@Context SecurityContext securityContext);
|
||||
@GET
|
||||
@Path("/findByTags")
|
||||
|
||||
@@ -84,7 +84,7 @@ public interface PetApi {
|
||||
@io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Pet.class, responseContainer = "List"),
|
||||
|
||||
@io.swagger.annotations.ApiResponse(code = 400, message = "Invalid tag value", response = Void.class) })
|
||||
public Response findPetsByTags( @NotNull @QueryParam("tags") List<String> tags,@Context SecurityContext securityContext);
|
||||
public Response findPetsByTags( @NotNull @QueryParam("tags") List<String> tags,@Context SecurityContext securityContext);
|
||||
@GET
|
||||
@Path("/{petId}")
|
||||
|
||||
|
||||
@@ -58,7 +58,7 @@ public interface StoreApi {
|
||||
@io.swagger.annotations.ApiResponse(code = 400, message = "Invalid ID supplied", response = Void.class),
|
||||
|
||||
@io.swagger.annotations.ApiResponse(code = 404, message = "Order not found", response = Void.class) })
|
||||
public Response getOrderById( @Min(1) @Max(5) @PathParam("orderId") Long orderId,@Context SecurityContext securityContext);
|
||||
public Response getOrderById( @Min(1L) @Max(5L) @PathParam("orderId") Long orderId,@Context SecurityContext securityContext);
|
||||
@POST
|
||||
@Path("/order")
|
||||
|
||||
|
||||
@@ -82,7 +82,7 @@ public interface UserApi {
|
||||
@io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = String.class),
|
||||
|
||||
@io.swagger.annotations.ApiResponse(code = 400, message = "Invalid username/password supplied", response = Void.class) })
|
||||
public Response loginUser( @NotNull @QueryParam("username") String username, @NotNull @QueryParam("password") String password,@Context SecurityContext securityContext);
|
||||
public Response loginUser( @NotNull @QueryParam("username") String username, @NotNull @QueryParam("password") String password,@Context SecurityContext securityContext);
|
||||
@GET
|
||||
@Path("/logout")
|
||||
|
||||
|
||||
@@ -54,7 +54,7 @@ public interface PetApi {
|
||||
}, tags={ "pet", })
|
||||
@io.swagger.annotations.ApiResponses(value = {
|
||||
@io.swagger.annotations.ApiResponse(code = 400, message = "Invalid pet value", response = Void.class) })
|
||||
public Response deletePet( @PathParam("petId") Long petId, @ApiParam(value = "" ) @HeaderParam("api_key") String apiKey,@Context SecurityContext securityContext);
|
||||
public Response deletePet( @PathParam("petId") Long petId, @ApiParam(value = "" ) @HeaderParam("api_key") String apiKey,@Context SecurityContext securityContext);
|
||||
@GET
|
||||
@Path("/findByStatus")
|
||||
|
||||
@@ -69,7 +69,7 @@ public interface PetApi {
|
||||
@io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Pet.class, responseContainer = "List"),
|
||||
|
||||
@io.swagger.annotations.ApiResponse(code = 400, message = "Invalid status value", response = Void.class) })
|
||||
public Response findPetsByStatus( @NotNull @QueryParam("status") List<String> status,@Context SecurityContext securityContext);
|
||||
public Response findPetsByStatus( @NotNull @QueryParam("status") List<String> status,@Context SecurityContext securityContext);
|
||||
@GET
|
||||
@Path("/findByTags")
|
||||
|
||||
@@ -84,7 +84,7 @@ public interface PetApi {
|
||||
@io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Pet.class, responseContainer = "List"),
|
||||
|
||||
@io.swagger.annotations.ApiResponse(code = 400, message = "Invalid tag value", response = Void.class) })
|
||||
public Response findPetsByTags( @NotNull @QueryParam("tags") List<String> tags,@Context SecurityContext securityContext);
|
||||
public Response findPetsByTags( @NotNull @QueryParam("tags") List<String> tags,@Context SecurityContext securityContext);
|
||||
@GET
|
||||
@Path("/{petId}")
|
||||
|
||||
|
||||
@@ -58,7 +58,7 @@ public interface StoreApi {
|
||||
@io.swagger.annotations.ApiResponse(code = 400, message = "Invalid ID supplied", response = Void.class),
|
||||
|
||||
@io.swagger.annotations.ApiResponse(code = 404, message = "Order not found", response = Void.class) })
|
||||
public Response getOrderById( @Min(1) @Max(5) @PathParam("orderId") Long orderId,@Context SecurityContext securityContext);
|
||||
public Response getOrderById( @Min(1L) @Max(5L) @PathParam("orderId") Long orderId,@Context SecurityContext securityContext);
|
||||
@POST
|
||||
@Path("/order")
|
||||
|
||||
|
||||
@@ -82,7 +82,7 @@ public interface UserApi {
|
||||
@io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = String.class),
|
||||
|
||||
@io.swagger.annotations.ApiResponse(code = 400, message = "Invalid username/password supplied", response = Void.class) })
|
||||
public Response loginUser( @NotNull @QueryParam("username") String username, @NotNull @QueryParam("password") String password,@Context SecurityContext securityContext);
|
||||
public Response loginUser( @NotNull @QueryParam("username") String username, @NotNull @QueryParam("password") String password,@Context SecurityContext securityContext);
|
||||
@GET
|
||||
@Path("/logout")
|
||||
|
||||
|
||||
@@ -54,7 +54,7 @@ public interface PetApi {
|
||||
}, tags={ "pet", })
|
||||
@io.swagger.annotations.ApiResponses(value = {
|
||||
@io.swagger.annotations.ApiResponse(code = 400, message = "Invalid pet value", response = Void.class) })
|
||||
public Response deletePet( @PathParam("petId") Long petId, @ApiParam(value = "" ) @HeaderParam("api_key") String apiKey,@Context SecurityContext securityContext);
|
||||
public Response deletePet( @PathParam("petId") Long petId, @ApiParam(value = "" ) @HeaderParam("api_key") String apiKey,@Context SecurityContext securityContext);
|
||||
@GET
|
||||
@Path("/findByStatus")
|
||||
|
||||
@@ -69,7 +69,7 @@ public interface PetApi {
|
||||
@io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Pet.class, responseContainer = "List"),
|
||||
|
||||
@io.swagger.annotations.ApiResponse(code = 400, message = "Invalid status value", response = Void.class) })
|
||||
public Response findPetsByStatus( @NotNull @QueryParam("status") List<String> status,@Context SecurityContext securityContext);
|
||||
public Response findPetsByStatus( @NotNull @QueryParam("status") List<String> status,@Context SecurityContext securityContext);
|
||||
@GET
|
||||
@Path("/findByTags")
|
||||
|
||||
@@ -84,7 +84,7 @@ public interface PetApi {
|
||||
@io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Pet.class, responseContainer = "List"),
|
||||
|
||||
@io.swagger.annotations.ApiResponse(code = 400, message = "Invalid tag value", response = Void.class) })
|
||||
public Response findPetsByTags( @NotNull @QueryParam("tags") List<String> tags,@Context SecurityContext securityContext);
|
||||
public Response findPetsByTags( @NotNull @QueryParam("tags") List<String> tags,@Context SecurityContext securityContext);
|
||||
@GET
|
||||
@Path("/{petId}")
|
||||
|
||||
|
||||
@@ -58,7 +58,7 @@ public interface StoreApi {
|
||||
@io.swagger.annotations.ApiResponse(code = 400, message = "Invalid ID supplied", response = Void.class),
|
||||
|
||||
@io.swagger.annotations.ApiResponse(code = 404, message = "Order not found", response = Void.class) })
|
||||
public Response getOrderById( @Min(1) @Max(5) @PathParam("orderId") Long orderId,@Context SecurityContext securityContext);
|
||||
public Response getOrderById( @Min(1L) @Max(5L) @PathParam("orderId") Long orderId,@Context SecurityContext securityContext);
|
||||
@POST
|
||||
@Path("/order")
|
||||
|
||||
|
||||
@@ -82,7 +82,7 @@ public interface UserApi {
|
||||
@io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = String.class),
|
||||
|
||||
@io.swagger.annotations.ApiResponse(code = 400, message = "Invalid username/password supplied", response = Void.class) })
|
||||
public Response loginUser( @NotNull @QueryParam("username") String username, @NotNull @QueryParam("password") String password,@Context SecurityContext securityContext);
|
||||
public Response loginUser( @NotNull @QueryParam("username") String username, @NotNull @QueryParam("password") String password,@Context SecurityContext securityContext);
|
||||
@GET
|
||||
@Path("/logout")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user