From fd17955685c2b862cf2da3757ac9b0a9cd9c5761 Mon Sep 17 00:00:00 2001 From: Andrea Polci Date: Thu, 4 May 2017 11:12:13 +0200 Subject: [PATCH 1/2] #5548 Avoid html escaping of pattern in bean validation (#5549) * Issue #5548 Avoid html escaping of pattern in bean validation * Run spring-all-petstore.sh and java-petstore-all.sh scripts --- .../Java/beanValidationCore.mustache | 2 +- .../JavaJaxRS/beanValidationCore.mustache | 2 +- .../cxf-cdi/beanValidationCore.mustache | 2 +- .../JavaJaxRS/cxf/beanValidationCore.mustache | 2 +- .../resteasy/beanValidationCore.mustache | 2 +- .../resteasy/eap/beanValidation.mustache | 2 +- .../eap/beanValidationPathParams.mustache | 2 +- .../eap/beanValidationQueryParams.mustache | 2 +- .../spec/beanValidationCore.mustache | 2 +- .../JavaPlayFramework/beanValidation.mustache | 2 +- .../beanValidationPathParams.mustache | 2 +- .../beanValidationQueryParams.mustache | 2 +- .../JavaSpring/beanValidationCore.mustache | 2 +- .../src/main/java/io/swagger/api/PetApi.java | 24 ++++------ .../main/java/io/swagger/api/StoreApi.java | 12 ++--- .../src/main/java/io/swagger/api/UserApi.java | 24 ++++------ .../main/java/io/swagger/model/Category.java | 6 +++ .../io/swagger/model/ModelApiResponse.java | 8 ++++ .../src/main/java/io/swagger/model/Order.java | 14 ++++++ .../src/main/java/io/swagger/model/Pet.java | 14 ++++++ .../src/main/java/io/swagger/model/Tag.java | 6 +++ .../src/main/java/io/swagger/model/User.java | 18 ++++++++ .../src/main/java/io/swagger/api/FakeApi.java | 2 +- .../io/swagger/api/FakeApiController.java | 19 ++++---- .../src/main/java/io/swagger/api/PetApi.java | 4 +- .../java/io/swagger/api/PetApiController.java | 26 +++++------ .../io/swagger/api/StoreApiController.java | 19 ++++---- .../src/main/java/io/swagger/api/UserApi.java | 2 +- .../io/swagger/api/UserApiController.java | 21 +++++---- .../src/main/java/io/swagger/api/FakeApi.java | 9 ++-- .../io/swagger/api/FakeApiController.java | 29 +++++++----- .../src/main/java/io/swagger/api/PetApi.java | 24 ++++------ .../java/io/swagger/api/PetApiController.java | 43 ++++++++++-------- .../main/java/io/swagger/api/StoreApi.java | 12 ++--- .../io/swagger/api/StoreApiController.java | 26 ++++++----- .../src/main/java/io/swagger/api/UserApi.java | 24 ++++------ .../io/swagger/api/UserApiController.java | 44 ++++++++++--------- .../model/AdditionalPropertiesClass.java | 6 +++ .../main/java/io/swagger/model/Animal.java | 6 +++ .../java/io/swagger/model/AnimalFarm.java | 2 + .../model/ArrayOfArrayOfNumberOnly.java | 4 ++ .../io/swagger/model/ArrayOfNumberOnly.java | 4 ++ .../main/java/io/swagger/model/ArrayTest.java | 8 ++++ .../java/io/swagger/model/Capitalization.java | 14 ++++++ .../src/main/java/io/swagger/model/Cat.java | 4 ++ .../main/java/io/swagger/model/Category.java | 6 +++ .../java/io/swagger/model/ClassModel.java | 4 ++ .../main/java/io/swagger/model/Client.java | 4 ++ .../src/main/java/io/swagger/model/Dog.java | 4 ++ .../java/io/swagger/model/EnumArrays.java | 6 +++ .../main/java/io/swagger/model/EnumClass.java | 2 + .../main/java/io/swagger/model/EnumTest.java | 10 +++++ .../java/io/swagger/model/FormatTest.java | 42 +++++++++++++++--- .../io/swagger/model/HasOnlyReadOnly.java | 6 +++ .../main/java/io/swagger/model/MapTest.java | 6 +++ ...ropertiesAndAdditionalPropertiesClass.java | 8 ++++ .../io/swagger/model/Model200Response.java | 6 +++ .../io/swagger/model/ModelApiResponse.java | 8 ++++ .../java/io/swagger/model/ModelReturn.java | 4 ++ .../src/main/java/io/swagger/model/Name.java | 10 +++++ .../java/io/swagger/model/NumberOnly.java | 4 ++ .../src/main/java/io/swagger/model/Order.java | 14 ++++++ .../main/java/io/swagger/model/OuterEnum.java | 2 + .../src/main/java/io/swagger/model/Pet.java | 14 ++++++ .../java/io/swagger/model/ReadOnlyFirst.java | 6 +++ .../io/swagger/model/SpecialModelName.java | 4 ++ .../src/main/java/io/swagger/model/Tag.java | 6 +++ .../src/main/java/io/swagger/model/User.java | 18 ++++++++ .../src/main/java/io/swagger/api/FakeApi.java | 9 ++-- .../io/swagger/api/FakeApiController.java | 29 +++++++----- .../src/main/java/io/swagger/api/PetApi.java | 24 ++++------ .../java/io/swagger/api/PetApiController.java | 43 ++++++++++-------- .../main/java/io/swagger/api/StoreApi.java | 12 ++--- .../io/swagger/api/StoreApiController.java | 26 ++++++----- .../src/main/java/io/swagger/api/UserApi.java | 24 ++++------ .../io/swagger/api/UserApiController.java | 44 ++++++++++--------- .../model/AdditionalPropertiesClass.java | 6 +++ .../main/java/io/swagger/model/Animal.java | 6 +++ .../java/io/swagger/model/AnimalFarm.java | 2 + .../model/ArrayOfArrayOfNumberOnly.java | 4 ++ .../io/swagger/model/ArrayOfNumberOnly.java | 4 ++ .../main/java/io/swagger/model/ArrayTest.java | 8 ++++ .../java/io/swagger/model/Capitalization.java | 14 ++++++ .../src/main/java/io/swagger/model/Cat.java | 4 ++ .../main/java/io/swagger/model/Category.java | 6 +++ .../java/io/swagger/model/ClassModel.java | 4 ++ .../main/java/io/swagger/model/Client.java | 4 ++ .../src/main/java/io/swagger/model/Dog.java | 4 ++ .../java/io/swagger/model/EnumArrays.java | 6 +++ .../main/java/io/swagger/model/EnumClass.java | 2 + .../main/java/io/swagger/model/EnumTest.java | 10 +++++ .../java/io/swagger/model/FormatTest.java | 42 +++++++++++++++--- .../io/swagger/model/HasOnlyReadOnly.java | 6 +++ .../main/java/io/swagger/model/MapTest.java | 6 +++ ...ropertiesAndAdditionalPropertiesClass.java | 8 ++++ .../io/swagger/model/Model200Response.java | 6 +++ .../io/swagger/model/ModelApiResponse.java | 8 ++++ .../java/io/swagger/model/ModelReturn.java | 4 ++ .../src/main/java/io/swagger/model/Name.java | 10 +++++ .../java/io/swagger/model/NumberOnly.java | 4 ++ .../src/main/java/io/swagger/model/Order.java | 14 ++++++ .../main/java/io/swagger/model/OuterEnum.java | 2 + .../src/main/java/io/swagger/model/Pet.java | 14 ++++++ .../java/io/swagger/model/ReadOnlyFirst.java | 6 +++ .../io/swagger/model/SpecialModelName.java | 4 ++ .../src/main/java/io/swagger/model/Tag.java | 6 +++ .../src/main/java/io/swagger/model/User.java | 18 ++++++++ .../src/main/java/io/swagger/api/FakeApi.java | 5 +-- .../io/swagger/api/FakeApiController.java | 21 +++++---- .../src/main/java/io/swagger/api/PetApi.java | 12 +---- .../java/io/swagger/api/PetApiController.java | 40 ++++++++--------- .../main/java/io/swagger/api/StoreApi.java | 4 -- .../io/swagger/api/StoreApiController.java | 29 ++++++------ .../src/main/java/io/swagger/api/UserApi.java | 10 +---- .../io/swagger/api/UserApiController.java | 29 ++++++------ 115 files changed, 892 insertions(+), 409 deletions(-) diff --git a/modules/swagger-codegen/src/main/resources/Java/beanValidationCore.mustache b/modules/swagger-codegen/src/main/resources/Java/beanValidationCore.mustache index dc7a83922169..db2a80d7b545 100644 --- a/modules/swagger-codegen/src/main/resources/Java/beanValidationCore.mustache +++ b/modules/swagger-codegen/src/main/resources/Java/beanValidationCore.mustache @@ -1,4 +1,4 @@ -{{#pattern}} @Pattern(regexp="{{pattern}}"){{/pattern}}{{! +{{#pattern}} @Pattern(regexp="{{{pattern}}}"){{/pattern}}{{! minLength && maxLength set }}{{#minLength}}{{#maxLength}} @Size(min={{minLength}},max={{maxLength}}){{/maxLength}}{{/minLength}}{{! minLength set, maxLength not diff --git a/modules/swagger-codegen/src/main/resources/JavaJaxRS/beanValidationCore.mustache b/modules/swagger-codegen/src/main/resources/JavaJaxRS/beanValidationCore.mustache index dc7a83922169..db2a80d7b545 100644 --- a/modules/swagger-codegen/src/main/resources/JavaJaxRS/beanValidationCore.mustache +++ b/modules/swagger-codegen/src/main/resources/JavaJaxRS/beanValidationCore.mustache @@ -1,4 +1,4 @@ -{{#pattern}} @Pattern(regexp="{{pattern}}"){{/pattern}}{{! +{{#pattern}} @Pattern(regexp="{{{pattern}}}"){{/pattern}}{{! minLength && maxLength set }}{{#minLength}}{{#maxLength}} @Size(min={{minLength}},max={{maxLength}}){{/maxLength}}{{/minLength}}{{! minLength set, maxLength not diff --git a/modules/swagger-codegen/src/main/resources/JavaJaxRS/cxf-cdi/beanValidationCore.mustache b/modules/swagger-codegen/src/main/resources/JavaJaxRS/cxf-cdi/beanValidationCore.mustache index dc7a83922169..db2a80d7b545 100644 --- a/modules/swagger-codegen/src/main/resources/JavaJaxRS/cxf-cdi/beanValidationCore.mustache +++ b/modules/swagger-codegen/src/main/resources/JavaJaxRS/cxf-cdi/beanValidationCore.mustache @@ -1,4 +1,4 @@ -{{#pattern}} @Pattern(regexp="{{pattern}}"){{/pattern}}{{! +{{#pattern}} @Pattern(regexp="{{{pattern}}}"){{/pattern}}{{! minLength && maxLength set }}{{#minLength}}{{#maxLength}} @Size(min={{minLength}},max={{maxLength}}){{/maxLength}}{{/minLength}}{{! minLength set, maxLength not diff --git a/modules/swagger-codegen/src/main/resources/JavaJaxRS/cxf/beanValidationCore.mustache b/modules/swagger-codegen/src/main/resources/JavaJaxRS/cxf/beanValidationCore.mustache index dc7a83922169..db2a80d7b545 100644 --- a/modules/swagger-codegen/src/main/resources/JavaJaxRS/cxf/beanValidationCore.mustache +++ b/modules/swagger-codegen/src/main/resources/JavaJaxRS/cxf/beanValidationCore.mustache @@ -1,4 +1,4 @@ -{{#pattern}} @Pattern(regexp="{{pattern}}"){{/pattern}}{{! +{{#pattern}} @Pattern(regexp="{{{pattern}}}"){{/pattern}}{{! minLength && maxLength set }}{{#minLength}}{{#maxLength}} @Size(min={{minLength}},max={{maxLength}}){{/maxLength}}{{/minLength}}{{! minLength set, maxLength not diff --git a/modules/swagger-codegen/src/main/resources/JavaJaxRS/resteasy/beanValidationCore.mustache b/modules/swagger-codegen/src/main/resources/JavaJaxRS/resteasy/beanValidationCore.mustache index dc7a83922169..db2a80d7b545 100644 --- a/modules/swagger-codegen/src/main/resources/JavaJaxRS/resteasy/beanValidationCore.mustache +++ b/modules/swagger-codegen/src/main/resources/JavaJaxRS/resteasy/beanValidationCore.mustache @@ -1,4 +1,4 @@ -{{#pattern}} @Pattern(regexp="{{pattern}}"){{/pattern}}{{! +{{#pattern}} @Pattern(regexp="{{{pattern}}}"){{/pattern}}{{! minLength && maxLength set }}{{#minLength}}{{#maxLength}} @Size(min={{minLength}},max={{maxLength}}){{/maxLength}}{{/minLength}}{{! minLength set, maxLength not diff --git a/modules/swagger-codegen/src/main/resources/JavaJaxRS/resteasy/eap/beanValidation.mustache b/modules/swagger-codegen/src/main/resources/JavaJaxRS/resteasy/eap/beanValidation.mustache index 079eab89d1af..16573060a9d7 100644 --- a/modules/swagger-codegen/src/main/resources/JavaJaxRS/resteasy/eap/beanValidation.mustache +++ b/modules/swagger-codegen/src/main/resources/JavaJaxRS/resteasy/eap/beanValidation.mustache @@ -2,7 +2,7 @@ @NotNull {{/required}} {{#pattern}} - @Pattern(regexp="{{pattern}}") + @Pattern(regexp="{{{pattern}}}") {{/pattern}} {{#minLength}} {{#maxLength}} diff --git a/modules/swagger-codegen/src/main/resources/JavaJaxRS/resteasy/eap/beanValidationPathParams.mustache b/modules/swagger-codegen/src/main/resources/JavaJaxRS/resteasy/eap/beanValidationPathParams.mustache index e3060fa6c6ac..0b4d31b4bf10 100644 --- a/modules/swagger-codegen/src/main/resources/JavaJaxRS/resteasy/eap/beanValidationPathParams.mustache +++ b/modules/swagger-codegen/src/main/resources/JavaJaxRS/resteasy/eap/beanValidationPathParams.mustache @@ -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}} \ No newline at end of file +{{! 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}} \ No newline at end of file diff --git a/modules/swagger-codegen/src/main/resources/JavaJaxRS/resteasy/eap/beanValidationQueryParams.mustache b/modules/swagger-codegen/src/main/resources/JavaJaxRS/resteasy/eap/beanValidationQueryParams.mustache index 52440b122185..4bad1be63686 100644 --- a/modules/swagger-codegen/src/main/resources/JavaJaxRS/resteasy/eap/beanValidationQueryParams.mustache +++ b/modules/swagger-codegen/src/main/resources/JavaJaxRS/resteasy/eap/beanValidationQueryParams.mustache @@ -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}} \ No newline at end of file +{{#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}} \ No newline at end of file diff --git a/modules/swagger-codegen/src/main/resources/JavaJaxRS/spec/beanValidationCore.mustache b/modules/swagger-codegen/src/main/resources/JavaJaxRS/spec/beanValidationCore.mustache index dc7a83922169..db2a80d7b545 100644 --- a/modules/swagger-codegen/src/main/resources/JavaJaxRS/spec/beanValidationCore.mustache +++ b/modules/swagger-codegen/src/main/resources/JavaJaxRS/spec/beanValidationCore.mustache @@ -1,4 +1,4 @@ -{{#pattern}} @Pattern(regexp="{{pattern}}"){{/pattern}}{{! +{{#pattern}} @Pattern(regexp="{{{pattern}}}"){{/pattern}}{{! minLength && maxLength set }}{{#minLength}}{{#maxLength}} @Size(min={{minLength}},max={{maxLength}}){{/maxLength}}{{/minLength}}{{! minLength set, maxLength not diff --git a/modules/swagger-codegen/src/main/resources/JavaPlayFramework/beanValidation.mustache b/modules/swagger-codegen/src/main/resources/JavaPlayFramework/beanValidation.mustache index 079eab89d1af..16573060a9d7 100644 --- a/modules/swagger-codegen/src/main/resources/JavaPlayFramework/beanValidation.mustache +++ b/modules/swagger-codegen/src/main/resources/JavaPlayFramework/beanValidation.mustache @@ -2,7 +2,7 @@ @NotNull {{/required}} {{#pattern}} - @Pattern(regexp="{{pattern}}") + @Pattern(regexp="{{{pattern}}}") {{/pattern}} {{#minLength}} {{#maxLength}} diff --git a/modules/swagger-codegen/src/main/resources/JavaPlayFramework/beanValidationPathParams.mustache b/modules/swagger-codegen/src/main/resources/JavaPlayFramework/beanValidationPathParams.mustache index e3060fa6c6ac..0b4d31b4bf10 100644 --- a/modules/swagger-codegen/src/main/resources/JavaPlayFramework/beanValidationPathParams.mustache +++ b/modules/swagger-codegen/src/main/resources/JavaPlayFramework/beanValidationPathParams.mustache @@ -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}} \ No newline at end of file +{{! 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}} \ No newline at end of file diff --git a/modules/swagger-codegen/src/main/resources/JavaPlayFramework/beanValidationQueryParams.mustache b/modules/swagger-codegen/src/main/resources/JavaPlayFramework/beanValidationQueryParams.mustache index 52440b122185..4bad1be63686 100644 --- a/modules/swagger-codegen/src/main/resources/JavaPlayFramework/beanValidationQueryParams.mustache +++ b/modules/swagger-codegen/src/main/resources/JavaPlayFramework/beanValidationQueryParams.mustache @@ -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}} \ No newline at end of file +{{#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}} \ No newline at end of file diff --git a/modules/swagger-codegen/src/main/resources/JavaSpring/beanValidationCore.mustache b/modules/swagger-codegen/src/main/resources/JavaSpring/beanValidationCore.mustache index 982ee8208aad..84a26690f9b1 100644 --- a/modules/swagger-codegen/src/main/resources/JavaSpring/beanValidationCore.mustache +++ b/modules/swagger-codegen/src/main/resources/JavaSpring/beanValidationCore.mustache @@ -1,4 +1,4 @@ -{{#pattern}} @Pattern(regexp="{{pattern}}"){{/pattern}}{{! +{{#pattern}} @Pattern(regexp="{{{pattern}}}"){{/pattern}}{{! minLength && maxLength set }}{{#minLength}}{{#maxLength}} @Size(min={{minLength}},max={{maxLength}}){{/maxLength}}{{/minLength}}{{! minLength set, maxLength not diff --git a/samples/client/petstore/spring-stubs/src/main/java/io/swagger/api/PetApi.java b/samples/client/petstore/spring-stubs/src/main/java/io/swagger/api/PetApi.java index 1dd3421891e8..45f86ff8cbfe 100644 --- a/samples/client/petstore/spring-stubs/src/main/java/io/swagger/api/PetApi.java +++ b/samples/client/petstore/spring-stubs/src/main/java/io/swagger/api/PetApi.java @@ -31,12 +31,11 @@ public interface PetApi { }, tags={ "pet", }) @ApiResponses(value = { @ApiResponse(code = 405, message = "Invalid input", response = Void.class) }) - @RequestMapping(value = "/pet", produces = "application/json", consumes = "application/json", method = RequestMethod.POST) - ResponseEntity addPet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody Pet body); + ResponseEntity addPet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody Pet body, @RequestHeader("Accept") String accept); @ApiOperation(value = "Deletes a pet", notes = "", response = Void.class, authorizations = { @@ -47,12 +46,11 @@ public interface PetApi { }, tags={ "pet", }) @ApiResponses(value = { @ApiResponse(code = 400, message = "Invalid pet value", response = Void.class) }) - @RequestMapping(value = "/pet/{petId}", produces = "application/json", consumes = "application/json", method = RequestMethod.DELETE) - ResponseEntity deletePet(@ApiParam(value = "Pet id to delete",required=true ) @PathVariable("petId") Long petId,@ApiParam(value = "" ) @RequestHeader(value="api_key", required=false) String apiKey); + ResponseEntity deletePet(@ApiParam(value = "Pet id to delete",required=true ) @PathVariable("petId") Long petId,@ApiParam(value = "" ) @RequestHeader(value="api_key", required=false) String apiKey, @RequestHeader("Accept") String accept); @ApiOperation(value = "Finds Pets by status", notes = "Multiple status values can be provided with comma separated strings", response = Pet.class, responseContainer = "List", authorizations = { @@ -64,12 +62,11 @@ public interface PetApi { @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Pet.class), @ApiResponse(code = 400, message = "Invalid status value", response = Pet.class) }) - @RequestMapping(value = "/pet/findByStatus", produces = "application/json", consumes = "application/json", method = RequestMethod.GET) - ResponseEntity> findPetsByStatus( @NotNull @ApiParam(value = "Status values that need to be considered for filter", required = true, allowableValues = "available, pending, sold") @RequestParam(value = "status", required = true) List status) throws IOException; + ResponseEntity> findPetsByStatus( @NotNull@ApiParam(value = "Status values that need to be considered for filter", required = true, allowableValues = "available, pending, sold") @RequestParam(value = "status", required = true) List status, @RequestHeader("Accept") String accept) throws IOException; @ApiOperation(value = "Finds Pets by tags", notes = "Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.", response = Pet.class, responseContainer = "List", authorizations = { @@ -81,12 +78,11 @@ public interface PetApi { @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Pet.class), @ApiResponse(code = 400, message = "Invalid tag value", response = Pet.class) }) - @RequestMapping(value = "/pet/findByTags", produces = "application/json", consumes = "application/json", method = RequestMethod.GET) - ResponseEntity> findPetsByTags( @NotNull @ApiParam(value = "Tags to filter by", required = true) @RequestParam(value = "tags", required = true) List tags) throws IOException; + ResponseEntity> findPetsByTags( @NotNull@ApiParam(value = "Tags to filter by", required = true) @RequestParam(value = "tags", required = true) List tags, @RequestHeader("Accept") String accept) throws IOException; @ApiOperation(value = "Find pet by ID", notes = "Returns a single pet", response = Pet.class, authorizations = { @@ -96,12 +92,11 @@ public interface PetApi { @ApiResponse(code = 200, message = "successful operation", response = Pet.class), @ApiResponse(code = 400, message = "Invalid ID supplied", response = Pet.class), @ApiResponse(code = 404, message = "Pet not found", response = Pet.class) }) - @RequestMapping(value = "/pet/{petId}", produces = "application/json", consumes = "application/json", method = RequestMethod.GET) - ResponseEntity getPetById(@ApiParam(value = "ID of pet to return",required=true ) @PathVariable("petId") Long petId) throws IOException; + ResponseEntity getPetById(@ApiParam(value = "ID of pet to return",required=true ) @PathVariable("petId") Long petId, @RequestHeader("Accept") String accept) throws IOException; @ApiOperation(value = "Update an existing pet", notes = "", response = Void.class, authorizations = { @@ -114,12 +109,11 @@ public interface PetApi { @ApiResponse(code = 400, message = "Invalid ID supplied", response = Void.class), @ApiResponse(code = 404, message = "Pet not found", response = Void.class), @ApiResponse(code = 405, message = "Validation exception", response = Void.class) }) - @RequestMapping(value = "/pet", produces = "application/json", consumes = "application/json", method = RequestMethod.PUT) - ResponseEntity updatePet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody Pet body); + ResponseEntity updatePet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody Pet body, @RequestHeader("Accept") String accept); @ApiOperation(value = "Updates a pet in the store with form data", notes = "", response = Void.class, authorizations = { @@ -130,12 +124,11 @@ public interface PetApi { }, tags={ "pet", }) @ApiResponses(value = { @ApiResponse(code = 405, message = "Invalid input", response = Void.class) }) - @RequestMapping(value = "/pet/{petId}", produces = "application/json", consumes = "application/x-www-form-urlencoded", method = RequestMethod.POST) - ResponseEntity updatePetWithForm(@ApiParam(value = "ID of pet that needs to be updated",required=true ) @PathVariable("petId") Long petId,@ApiParam(value = "Updated name of the pet") @RequestPart(value="name", required=false) String name,@ApiParam(value = "Updated status of the pet") @RequestPart(value="status", required=false) String status); + ResponseEntity updatePetWithForm(@ApiParam(value = "ID of pet that needs to be updated",required=true ) @PathVariable("petId") Long petId,@ApiParam(value = "Updated name of the pet") @RequestPart(value="name", required=false) String name,@ApiParam(value = "Updated status of the pet") @RequestPart(value="status", required=false) String status, @RequestHeader("Accept") String accept); @ApiOperation(value = "uploads an image", notes = "", response = ModelApiResponse.class, authorizations = { @@ -146,11 +139,10 @@ public interface PetApi { }, tags={ "pet", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = ModelApiResponse.class) }) - @RequestMapping(value = "/pet/{petId}/uploadImage", produces = "application/json", consumes = "multipart/form-data", method = RequestMethod.POST) - ResponseEntity uploadFile(@ApiParam(value = "ID of pet to update",required=true ) @PathVariable("petId") Long petId,@ApiParam(value = "Additional data to pass to server") @RequestPart(value="additionalMetadata", required=false) String additionalMetadata,@ApiParam(value = "file detail") @RequestPart("file") MultipartFile file) throws IOException; + ResponseEntity uploadFile(@ApiParam(value = "ID of pet to update",required=true ) @PathVariable("petId") Long petId,@ApiParam(value = "Additional data to pass to server") @RequestPart(value="additionalMetadata", required=false) String additionalMetadata,@ApiParam(value = "file detail") @RequestPart("file") MultipartFile file, @RequestHeader("Accept") String accept) throws IOException; } diff --git a/samples/client/petstore/spring-stubs/src/main/java/io/swagger/api/StoreApi.java b/samples/client/petstore/spring-stubs/src/main/java/io/swagger/api/StoreApi.java index f09b9ae08c9e..5f8f31dffe28 100644 --- a/samples/client/petstore/spring-stubs/src/main/java/io/swagger/api/StoreApi.java +++ b/samples/client/petstore/spring-stubs/src/main/java/io/swagger/api/StoreApi.java @@ -26,12 +26,11 @@ public interface StoreApi { @ApiResponses(value = { @ApiResponse(code = 400, message = "Invalid ID supplied", response = Void.class), @ApiResponse(code = 404, message = "Order not found", response = Void.class) }) - @RequestMapping(value = "/store/order/{orderId}", produces = "application/json", consumes = "application/json", method = RequestMethod.DELETE) - ResponseEntity deleteOrder(@ApiParam(value = "ID of the order that needs to be deleted",required=true ) @PathVariable("orderId") String orderId); + ResponseEntity deleteOrder(@ApiParam(value = "ID of the order that needs to be deleted",required=true ) @PathVariable("orderId") String orderId, @RequestHeader("Accept") String accept); @ApiOperation(value = "Returns pet inventories by status", notes = "Returns a map of status codes to quantities", response = Integer.class, responseContainer = "Map", authorizations = { @@ -39,12 +38,11 @@ public interface StoreApi { }, tags={ "store", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Integer.class) }) - @RequestMapping(value = "/store/inventory", produces = "application/json", consumes = "application/json", method = RequestMethod.GET) - ResponseEntity> getInventory() throws IOException; + ResponseEntity> getInventory( @RequestHeader("Accept") String accept) throws IOException; @ApiOperation(value = "Find purchase order by ID", notes = "For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions", response = Order.class, tags={ "store", }) @@ -52,23 +50,21 @@ public interface StoreApi { @ApiResponse(code = 200, message = "successful operation", response = Order.class), @ApiResponse(code = 400, message = "Invalid ID supplied", response = Order.class), @ApiResponse(code = 404, message = "Order not found", response = Order.class) }) - @RequestMapping(value = "/store/order/{orderId}", produces = "application/json", consumes = "application/json", method = RequestMethod.GET) - ResponseEntity getOrderById( @Min(1) @Max(5)@ApiParam(value = "ID of pet that needs to be fetched",required=true ) @PathVariable("orderId") Long orderId) throws IOException; + ResponseEntity getOrderById( @Min(1) @Max(5)@ApiParam(value = "ID of pet that needs to be fetched",required=true ) @PathVariable("orderId") Long orderId, @RequestHeader("Accept") String accept) throws IOException; @ApiOperation(value = "Place an order for a pet", notes = "", response = Order.class, tags={ "store", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Order.class), @ApiResponse(code = 400, message = "Invalid Order", response = Order.class) }) - @RequestMapping(value = "/store/order", produces = "application/json", consumes = "application/json", method = RequestMethod.POST) - ResponseEntity placeOrder(@ApiParam(value = "order placed for purchasing the pet" ,required=true ) @Valid @RequestBody Order body) throws IOException; + ResponseEntity placeOrder(@ApiParam(value = "order placed for purchasing the pet" ,required=true ) @Valid @RequestBody Order body, @RequestHeader("Accept") String accept) throws IOException; } diff --git a/samples/client/petstore/spring-stubs/src/main/java/io/swagger/api/UserApi.java b/samples/client/petstore/spring-stubs/src/main/java/io/swagger/api/UserApi.java index 1c099b08d9c8..5a4cef2892df 100644 --- a/samples/client/petstore/spring-stubs/src/main/java/io/swagger/api/UserApi.java +++ b/samples/client/petstore/spring-stubs/src/main/java/io/swagger/api/UserApi.java @@ -25,46 +25,42 @@ public interface UserApi { @ApiOperation(value = "Create user", notes = "This can only be done by the logged in user.", response = Void.class, tags={ "user", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Void.class) }) - @RequestMapping(value = "/user", produces = "application/json", consumes = "application/json", method = RequestMethod.POST) - ResponseEntity createUser(@ApiParam(value = "Created user object" ,required=true ) @Valid @RequestBody User body); + ResponseEntity createUser(@ApiParam(value = "Created user object" ,required=true ) @Valid @RequestBody User body, @RequestHeader("Accept") String accept); @ApiOperation(value = "Creates list of users with given input array", notes = "", response = Void.class, tags={ "user", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Void.class) }) - @RequestMapping(value = "/user/createWithArray", produces = "application/json", consumes = "application/json", method = RequestMethod.POST) - ResponseEntity createUsersWithArrayInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody List body); + ResponseEntity createUsersWithArrayInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody List body, @RequestHeader("Accept") String accept); @ApiOperation(value = "Creates list of users with given input array", notes = "", response = Void.class, tags={ "user", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Void.class) }) - @RequestMapping(value = "/user/createWithList", produces = "application/json", consumes = "application/json", method = RequestMethod.POST) - ResponseEntity createUsersWithListInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody List body); + ResponseEntity createUsersWithListInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody List body, @RequestHeader("Accept") String accept); @ApiOperation(value = "Delete user", notes = "This can only be done by the logged in user.", response = Void.class, tags={ "user", }) @ApiResponses(value = { @ApiResponse(code = 400, message = "Invalid username supplied", response = Void.class), @ApiResponse(code = 404, message = "User not found", response = Void.class) }) - @RequestMapping(value = "/user/{username}", produces = "application/json", consumes = "application/json", method = RequestMethod.DELETE) - ResponseEntity deleteUser(@ApiParam(value = "The name that needs to be deleted",required=true ) @PathVariable("username") String username); + ResponseEntity deleteUser(@ApiParam(value = "The name that needs to be deleted",required=true ) @PathVariable("username") String username, @RequestHeader("Accept") String accept); @ApiOperation(value = "Get user by user name", notes = "", response = User.class, tags={ "user", }) @@ -72,46 +68,42 @@ public interface UserApi { @ApiResponse(code = 200, message = "successful operation", response = User.class), @ApiResponse(code = 400, message = "Invalid username supplied", response = User.class), @ApiResponse(code = 404, message = "User not found", response = User.class) }) - @RequestMapping(value = "/user/{username}", produces = "application/json", consumes = "application/json", method = RequestMethod.GET) - ResponseEntity getUserByName(@ApiParam(value = "The name that needs to be fetched. Use user1 for testing. ",required=true ) @PathVariable("username") String username) throws IOException; + ResponseEntity getUserByName(@ApiParam(value = "The name that needs to be fetched. Use user1 for testing. ",required=true ) @PathVariable("username") String username, @RequestHeader("Accept") String accept) throws IOException; @ApiOperation(value = "Logs user into the system", notes = "", response = String.class, tags={ "user", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = String.class), @ApiResponse(code = 400, message = "Invalid username/password supplied", response = String.class) }) - @RequestMapping(value = "/user/login", produces = "application/json", consumes = "application/json", method = RequestMethod.GET) - ResponseEntity loginUser( @NotNull @ApiParam(value = "The user name for login", required = true) @RequestParam(value = "username", required = true) String username, @NotNull @ApiParam(value = "The password for login in clear text", required = true) @RequestParam(value = "password", required = true) String password) throws IOException; + ResponseEntity loginUser( @NotNull@ApiParam(value = "The user name for login", required = true) @RequestParam(value = "username", required = true) String username, @NotNull@ApiParam(value = "The password for login in clear text", required = true) @RequestParam(value = "password", required = true) String password, @RequestHeader("Accept") String accept) throws IOException; @ApiOperation(value = "Logs out current logged in user session", notes = "", response = Void.class, tags={ "user", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Void.class) }) - @RequestMapping(value = "/user/logout", produces = "application/json", consumes = "application/json", method = RequestMethod.GET) - ResponseEntity logoutUser(); + ResponseEntity logoutUser( @RequestHeader("Accept") String accept); @ApiOperation(value = "Updated user", notes = "This can only be done by the logged in user.", response = Void.class, tags={ "user", }) @ApiResponses(value = { @ApiResponse(code = 400, message = "Invalid user supplied", response = Void.class), @ApiResponse(code = 404, message = "User not found", response = Void.class) }) - @RequestMapping(value = "/user/{username}", produces = "application/json", consumes = "application/json", method = RequestMethod.PUT) - ResponseEntity updateUser(@ApiParam(value = "name that need to be deleted",required=true ) @PathVariable("username") String username,@ApiParam(value = "Updated user object" ,required=true ) @Valid @RequestBody User body); + ResponseEntity updateUser(@ApiParam(value = "name that need to be deleted",required=true ) @PathVariable("username") String username,@ApiParam(value = "Updated user object" ,required=true ) @Valid @RequestBody User body, @RequestHeader("Accept") String accept); } diff --git a/samples/client/petstore/spring-stubs/src/main/java/io/swagger/model/Category.java b/samples/client/petstore/spring-stubs/src/main/java/io/swagger/model/Category.java index 9611305a6870..7289c191a9cf 100644 --- a/samples/client/petstore/spring-stubs/src/main/java/io/swagger/model/Category.java +++ b/samples/client/petstore/spring-stubs/src/main/java/io/swagger/model/Category.java @@ -5,7 +5,9 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * A category for a pet */ @@ -28,6 +30,8 @@ public class Category { * @return id **/ @ApiModelProperty(value = "") + + @Valid public Long getId() { return id; } @@ -46,6 +50,8 @@ public class Category { * @return name **/ @ApiModelProperty(value = "") + + @Valid public String getName() { return name; } diff --git a/samples/client/petstore/spring-stubs/src/main/java/io/swagger/model/ModelApiResponse.java b/samples/client/petstore/spring-stubs/src/main/java/io/swagger/model/ModelApiResponse.java index 63561b909396..d9a1123d082f 100644 --- a/samples/client/petstore/spring-stubs/src/main/java/io/swagger/model/ModelApiResponse.java +++ b/samples/client/petstore/spring-stubs/src/main/java/io/swagger/model/ModelApiResponse.java @@ -5,7 +5,9 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * Describes the result of uploading an image resource */ @@ -31,6 +33,8 @@ public class ModelApiResponse { * @return code **/ @ApiModelProperty(value = "") + + @Valid public Integer getCode() { return code; } @@ -49,6 +53,8 @@ public class ModelApiResponse { * @return type **/ @ApiModelProperty(value = "") + + @Valid public String getType() { return type; } @@ -67,6 +73,8 @@ public class ModelApiResponse { * @return message **/ @ApiModelProperty(value = "") + + @Valid public String getMessage() { return message; } diff --git a/samples/client/petstore/spring-stubs/src/main/java/io/swagger/model/Order.java b/samples/client/petstore/spring-stubs/src/main/java/io/swagger/model/Order.java index 4c8c3eaddf63..728be2812930 100644 --- a/samples/client/petstore/spring-stubs/src/main/java/io/swagger/model/Order.java +++ b/samples/client/petstore/spring-stubs/src/main/java/io/swagger/model/Order.java @@ -7,7 +7,9 @@ import com.fasterxml.jackson.annotation.JsonValue; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import org.joda.time.DateTime; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * An order for a pets from the pet store */ @@ -75,6 +77,8 @@ public class Order { * @return id **/ @ApiModelProperty(value = "") + + @Valid public Long getId() { return id; } @@ -93,6 +97,8 @@ public class Order { * @return petId **/ @ApiModelProperty(value = "") + + @Valid public Long getPetId() { return petId; } @@ -111,6 +117,8 @@ public class Order { * @return quantity **/ @ApiModelProperty(value = "") + + @Valid public Integer getQuantity() { return quantity; } @@ -129,6 +137,8 @@ public class Order { * @return shipDate **/ @ApiModelProperty(value = "") + + @Valid public DateTime getShipDate() { return shipDate; } @@ -147,6 +157,8 @@ public class Order { * @return status **/ @ApiModelProperty(value = "Order Status") + + @Valid public StatusEnum getStatus() { return status; } @@ -165,6 +177,8 @@ public class Order { * @return complete **/ @ApiModelProperty(value = "") + + @Valid public Boolean getComplete() { return complete; } diff --git a/samples/client/petstore/spring-stubs/src/main/java/io/swagger/model/Pet.java b/samples/client/petstore/spring-stubs/src/main/java/io/swagger/model/Pet.java index 159b993ed37f..f79e9ae56d4d 100644 --- a/samples/client/petstore/spring-stubs/src/main/java/io/swagger/model/Pet.java +++ b/samples/client/petstore/spring-stubs/src/main/java/io/swagger/model/Pet.java @@ -10,7 +10,9 @@ import io.swagger.model.Category; import io.swagger.model.Tag; import java.util.ArrayList; import java.util.List; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * A pet for sale in the pet store */ @@ -78,6 +80,8 @@ public class Pet { * @return id **/ @ApiModelProperty(value = "") + + @Valid public Long getId() { return id; } @@ -96,6 +100,8 @@ public class Pet { * @return category **/ @ApiModelProperty(value = "") + + @Valid public Category getCategory() { return category; } @@ -115,6 +121,8 @@ public class Pet { **/ @ApiModelProperty(example = "doggie", required = true, value = "") @NotNull + + @Valid public String getName() { return name; } @@ -139,6 +147,8 @@ public class Pet { **/ @ApiModelProperty(required = true, value = "") @NotNull + + @Valid public List getPhotoUrls() { return photoUrls; } @@ -165,6 +175,8 @@ public class Pet { * @return tags **/ @ApiModelProperty(value = "") + + @Valid public List getTags() { return tags; } @@ -183,6 +195,8 @@ public class Pet { * @return status **/ @ApiModelProperty(value = "pet status in the store") + + @Valid public StatusEnum getStatus() { return status; } diff --git a/samples/client/petstore/spring-stubs/src/main/java/io/swagger/model/Tag.java b/samples/client/petstore/spring-stubs/src/main/java/io/swagger/model/Tag.java index f363f8d9f867..e9ad7e516546 100644 --- a/samples/client/petstore/spring-stubs/src/main/java/io/swagger/model/Tag.java +++ b/samples/client/petstore/spring-stubs/src/main/java/io/swagger/model/Tag.java @@ -5,7 +5,9 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * A tag for a pet */ @@ -28,6 +30,8 @@ public class Tag { * @return id **/ @ApiModelProperty(value = "") + + @Valid public Long getId() { return id; } @@ -46,6 +50,8 @@ public class Tag { * @return name **/ @ApiModelProperty(value = "") + + @Valid public String getName() { return name; } diff --git a/samples/client/petstore/spring-stubs/src/main/java/io/swagger/model/User.java b/samples/client/petstore/spring-stubs/src/main/java/io/swagger/model/User.java index 1766e5dde173..b3b24907d978 100644 --- a/samples/client/petstore/spring-stubs/src/main/java/io/swagger/model/User.java +++ b/samples/client/petstore/spring-stubs/src/main/java/io/swagger/model/User.java @@ -5,7 +5,9 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * A User who is purchasing from the pet store */ @@ -46,6 +48,8 @@ public class User { * @return id **/ @ApiModelProperty(value = "") + + @Valid public Long getId() { return id; } @@ -64,6 +68,8 @@ public class User { * @return username **/ @ApiModelProperty(value = "") + + @Valid public String getUsername() { return username; } @@ -82,6 +88,8 @@ public class User { * @return firstName **/ @ApiModelProperty(value = "") + + @Valid public String getFirstName() { return firstName; } @@ -100,6 +108,8 @@ public class User { * @return lastName **/ @ApiModelProperty(value = "") + + @Valid public String getLastName() { return lastName; } @@ -118,6 +128,8 @@ public class User { * @return email **/ @ApiModelProperty(value = "") + + @Valid public String getEmail() { return email; } @@ -136,6 +148,8 @@ public class User { * @return password **/ @ApiModelProperty(value = "") + + @Valid public String getPassword() { return password; } @@ -154,6 +168,8 @@ public class User { * @return phone **/ @ApiModelProperty(value = "") + + @Valid public String getPhone() { return phone; } @@ -172,6 +188,8 @@ public class User { * @return userStatus **/ @ApiModelProperty(value = "User Status") + + @Valid public Integer getUserStatus() { return userStatus; } diff --git a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/api/FakeApi.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/api/FakeApi.java index d8b307a1f234..8eefd6ed5072 100644 --- a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/api/FakeApi.java +++ b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/api/FakeApi.java @@ -55,6 +55,6 @@ public interface FakeApi { produces = { "*/*" }, consumes = { "*/*" }, method = RequestMethod.GET) - ResponseEntity testEnumParameters(@ApiParam(value = "Form parameter enum test (string array)", allowableValues=">, $") @RequestPart(value="enum_form_string_array", required=false) List enumFormStringArray,@ApiParam(value = "Form parameter enum test (string)", allowableValues="_abc, -efg, (xyz)", defaultValue="-efg") @RequestPart(value="enum_form_string", required=false) String enumFormString,@ApiParam(value = "Header parameter enum test (string array)" , allowableValues=">, $") @RequestHeader(value="enum_header_string_array", required=false) List enumHeaderStringArray,@ApiParam(value = "Header parameter enum test (string)" , allowableValues="_abc, -efg, (xyz)", defaultValue="-efg") @RequestHeader(value="enum_header_string", required=false) String enumHeaderString, @ApiParam(value = "Query parameter enum test (string array)", allowableValues = ">, $") @RequestParam(value = "enum_query_string_array", required = false) List enumQueryStringArray, @ApiParam(value = "Query parameter enum test (string)", allowableValues = "_abc, -efg, (xyz)", defaultValue = "-efg") @RequestParam(value = "enum_query_string", required = false, defaultValue="-efg") String enumQueryString, @ApiParam(value = "Query parameter enum test (double)", allowableValues = "1, -2") @RequestParam(value = "enum_query_integer", required = false) Integer enumQueryInteger,@ApiParam(value = "Query parameter enum test (double)", allowableValues="1.1, -1.2") @RequestPart(value="enum_query_double", required=false) Double enumQueryDouble, @RequestHeader("Accept") String accept); + ResponseEntity testEnumParameters(@ApiParam(value = "Form parameter enum test (string array)", allowableValues=">, $") @RequestPart(value="enum_form_string_array", required=false) List enumFormStringArray,@ApiParam(value = "Form parameter enum test (string)", allowableValues="_abc, -efg, (xyz)", defaultValue="-efg") @RequestPart(value="enum_form_string", required=false) String enumFormString,@ApiParam(value = "Header parameter enum test (string array)" , allowableValues=">, $") @RequestHeader(value="enum_header_string_array", required=false) List enumHeaderStringArray,@ApiParam(value = "Header parameter enum test (string)" , allowableValues="_abc, -efg, (xyz)", defaultValue="-efg") @RequestHeader(value="enum_header_string", required=false) String enumHeaderString,@ApiParam(value = "Query parameter enum test (string array)", allowableValues = ">, $") @RequestParam(value = "enum_query_string_array", required = false) List enumQueryStringArray,@ApiParam(value = "Query parameter enum test (string)", allowableValues = "_abc, -efg, (xyz)", defaultValue = "-efg") @RequestParam(value = "enum_query_string", required = false, defaultValue="-efg") String enumQueryString,@ApiParam(value = "Query parameter enum test (double)", allowableValues = "1, -2") @RequestParam(value = "enum_query_integer", required = false) Integer enumQueryInteger,@ApiParam(value = "Query parameter enum test (double)", allowableValues="1.1, -1.2") @RequestPart(value="enum_query_double", required=false) Double enumQueryDouble, @RequestHeader("Accept") String accept); } diff --git a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/api/FakeApiController.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/api/FakeApiController.java index 5bac24daffa1..bc079bf62997 100644 --- a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/api/FakeApiController.java +++ b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/api/FakeApiController.java @@ -16,21 +16,24 @@ import org.springframework.web.bind.annotation.RequestHeader; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestPart; import org.springframework.web.multipart.MultipartFile; -import com.fasterxml.jackson.databind.ObjectMapper; -import java.io.IOException; import java.util.List; - +import com.fasterxml.jackson.databind.ObjectMapper; +import java.io.IOException; import javax.validation.constraints.*; import javax.validation.Valid; @Controller public class FakeApiController implements FakeApi { + private final ObjectMapper objectMapper; + + public FakeApiController(ObjectMapper objectMapper) { + this.objectMapper = objectMapper; + } + public ResponseEntity testClientModel(@ApiParam(value = "client model" ,required=true ) @Valid @RequestBody Client body, @RequestHeader("Accept") String accept) throws IOException { // do some magic! - - ObjectMapper objectMapper = new ObjectMapper(); if (accept != null && accept.contains("application/json")) { return new ResponseEntity(objectMapper.readValue("{ \"client\" : \"aeiou\"}", Client.class), HttpStatus.OK); @@ -62,9 +65,9 @@ public class FakeApiController implements FakeApi { @ApiParam(value = "Form parameter enum test (string)", allowableValues="_abc, -efg, (xyz)", defaultValue="-efg") @RequestPart(value="enum_form_string", required=false) String enumFormString, @ApiParam(value = "Header parameter enum test (string array)" , allowableValues=">, $") @RequestHeader(value="enum_header_string_array", required=false) List enumHeaderStringArray, @ApiParam(value = "Header parameter enum test (string)" , allowableValues="_abc, -efg, (xyz)", defaultValue="-efg") @RequestHeader(value="enum_header_string", required=false) String enumHeaderString, - @ApiParam(value = "Query parameter enum test (string array)", allowableValues = ">, $") @RequestParam(value = "enum_query_string_array", required = false) List enumQueryStringArray, - @ApiParam(value = "Query parameter enum test (string)", allowableValues = "_abc, -efg, (xyz)", defaultValue = "-efg") @RequestParam(value = "enum_query_string", required = false, defaultValue="-efg") String enumQueryString, - @ApiParam(value = "Query parameter enum test (double)", allowableValues = "1, -2") @RequestParam(value = "enum_query_integer", required = false) Integer enumQueryInteger, + @ApiParam(value = "Query parameter enum test (string array)", allowableValues = ">, $") @RequestParam(value = "enum_query_string_array", required = false) List enumQueryStringArray, + @ApiParam(value = "Query parameter enum test (string)", allowableValues = "_abc, -efg, (xyz)", defaultValue = "-efg") @RequestParam(value = "enum_query_string", required = false, defaultValue="-efg") String enumQueryString, + @ApiParam(value = "Query parameter enum test (double)", allowableValues = "1, -2") @RequestParam(value = "enum_query_integer", required = false) Integer enumQueryInteger, @ApiParam(value = "Query parameter enum test (double)", allowableValues="1.1, -1.2") @RequestPart(value="enum_query_double", required=false) Double enumQueryDouble, @RequestHeader("Accept") String accept) { // do some magic! diff --git a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/api/PetApi.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/api/PetApi.java index 5816fb5b92e6..1227aedbbd7d 100644 --- a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/api/PetApi.java +++ b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/api/PetApi.java @@ -64,7 +64,7 @@ public interface PetApi { @RequestMapping(value = "/pet/findByStatus", produces = { "application/xml", "application/json" }, method = RequestMethod.GET) - ResponseEntity> findPetsByStatus( @NotNull @ApiParam(value = "Status values that need to be considered for filter", required = true, allowableValues = "available, pending, sold") @RequestParam(value = "status", required = true) List status, @RequestHeader("Accept") String accept) throws IOException; + ResponseEntity> findPetsByStatus( @NotNull@ApiParam(value = "Status values that need to be considered for filter", required = true, allowableValues = "available, pending, sold") @RequestParam(value = "status", required = true) List status, @RequestHeader("Accept") String accept) throws IOException; @ApiOperation(value = "Finds Pets by tags", notes = "Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.", response = Pet.class, responseContainer = "List", authorizations = { @@ -79,7 +79,7 @@ public interface PetApi { @RequestMapping(value = "/pet/findByTags", produces = { "application/xml", "application/json" }, method = RequestMethod.GET) - ResponseEntity> findPetsByTags( @NotNull @ApiParam(value = "Tags to filter by", required = true) @RequestParam(value = "tags", required = true) List tags, @RequestHeader("Accept") String accept) throws IOException; + ResponseEntity> findPetsByTags( @NotNull@ApiParam(value = "Tags to filter by", required = true) @RequestParam(value = "tags", required = true) List tags, @RequestHeader("Accept") String accept) throws IOException; @ApiOperation(value = "Find pet by ID", notes = "Returns a single pet", response = Pet.class, authorizations = { diff --git a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/api/PetApiController.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/api/PetApiController.java index 220aa32691d5..66e1dbda18de 100644 --- a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/api/PetApiController.java +++ b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/api/PetApiController.java @@ -15,16 +15,21 @@ import org.springframework.web.bind.annotation.RequestHeader; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestPart; import org.springframework.web.multipart.MultipartFile; -import com.fasterxml.jackson.databind.ObjectMapper; -import java.io.IOException; import java.util.List; - +import com.fasterxml.jackson.databind.ObjectMapper; +import java.io.IOException; import javax.validation.constraints.*; import javax.validation.Valid; @Controller public class PetApiController implements PetApi { + private final ObjectMapper objectMapper; + + public PetApiController(ObjectMapper objectMapper) { + this.objectMapper = objectMapper; + } + public ResponseEntity addPet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody Pet body, @RequestHeader("Accept") String accept) { // do some magic! @@ -38,16 +43,15 @@ public class PetApiController implements PetApi { return new ResponseEntity(HttpStatus.OK); } - public ResponseEntity> findPetsByStatus( @NotNull @ApiParam(value = "Status values that need to be considered for filter", required = true, allowableValues = "available, pending, sold") @RequestParam(value = "status", required = true) List status, + public ResponseEntity> findPetsByStatus( @NotNull@ApiParam(value = "Status values that need to be considered for filter", required = true, allowableValues = "available, pending, sold") @RequestParam(value = "status", required = true) List status, @RequestHeader("Accept") String accept) throws IOException { // do some magic! - - ObjectMapper objectMapper = new ObjectMapper(); if (accept != null && accept.contains("application/xml")) { return new ResponseEntity>(objectMapper.readValue(" 123456789 doggie aeiou aeiou", List.class), HttpStatus.OK); } + if (accept != null && accept.contains("application/json")) { return new ResponseEntity>(objectMapper.readValue("[ { \"photoUrls\" : [ \"aeiou\" ], \"name\" : \"doggie\", \"id\" : 0, \"category\" : { \"name\" : \"aeiou\", \"id\" : 6 }, \"tags\" : [ { \"name\" : \"aeiou\", \"id\" : 1 } ], \"status\" : \"available\"} ]", List.class), HttpStatus.OK); } @@ -55,16 +59,15 @@ public class PetApiController implements PetApi { return new ResponseEntity>(HttpStatus.OK); } - public ResponseEntity> findPetsByTags( @NotNull @ApiParam(value = "Tags to filter by", required = true) @RequestParam(value = "tags", required = true) List tags, + public ResponseEntity> findPetsByTags( @NotNull@ApiParam(value = "Tags to filter by", required = true) @RequestParam(value = "tags", required = true) List tags, @RequestHeader("Accept") String accept) throws IOException { // do some magic! - - ObjectMapper objectMapper = new ObjectMapper(); if (accept != null && accept.contains("application/xml")) { return new ResponseEntity>(objectMapper.readValue(" 123456789 doggie aeiou aeiou", List.class), HttpStatus.OK); } + if (accept != null && accept.contains("application/json")) { return new ResponseEntity>(objectMapper.readValue("[ { \"photoUrls\" : [ \"aeiou\" ], \"name\" : \"doggie\", \"id\" : 0, \"category\" : { \"name\" : \"aeiou\", \"id\" : 6 }, \"tags\" : [ { \"name\" : \"aeiou\", \"id\" : 1 } ], \"status\" : \"available\"} ]", List.class), HttpStatus.OK); } @@ -75,13 +78,12 @@ public class PetApiController implements PetApi { public ResponseEntity getPetById(@ApiParam(value = "ID of pet to return",required=true ) @PathVariable("petId") Long petId, @RequestHeader("Accept") String accept) throws IOException { // do some magic! - - ObjectMapper objectMapper = new ObjectMapper(); if (accept != null && accept.contains("application/xml")) { return new ResponseEntity(objectMapper.readValue(" 123456789 doggie aeiou aeiou", Pet.class), HttpStatus.OK); } + if (accept != null && accept.contains("application/json")) { return new ResponseEntity(objectMapper.readValue("{ \"photoUrls\" : [ \"aeiou\" ], \"name\" : \"doggie\", \"id\" : 0, \"category\" : { \"name\" : \"aeiou\", \"id\" : 6 }, \"tags\" : [ { \"name\" : \"aeiou\", \"id\" : 1 } ], \"status\" : \"available\"}", Pet.class), HttpStatus.OK); } @@ -108,8 +110,6 @@ public class PetApiController implements PetApi { @ApiParam(value = "file detail") @RequestPart("file") MultipartFile file, @RequestHeader("Accept") String accept) throws IOException { // do some magic! - - ObjectMapper objectMapper = new ObjectMapper(); if (accept != null && accept.contains("application/json")) { return new ResponseEntity(objectMapper.readValue("{ \"code\" : 0, \"type\" : \"aeiou\", \"message\" : \"aeiou\"}", ModelApiResponse.class), HttpStatus.OK); diff --git a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/api/StoreApiController.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/api/StoreApiController.java index 3eb23194cb10..6154d9c26392 100644 --- a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/api/StoreApiController.java +++ b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/api/StoreApiController.java @@ -14,16 +14,21 @@ import org.springframework.web.bind.annotation.RequestHeader; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestPart; import org.springframework.web.multipart.MultipartFile; -import com.fasterxml.jackson.databind.ObjectMapper; -import java.io.IOException; import java.util.List; - +import com.fasterxml.jackson.databind.ObjectMapper; +import java.io.IOException; import javax.validation.constraints.*; import javax.validation.Valid; @Controller public class StoreApiController implements StoreApi { + private final ObjectMapper objectMapper; + + public StoreApiController(ObjectMapper objectMapper) { + this.objectMapper = objectMapper; + } + public ResponseEntity deleteOrder(@ApiParam(value = "ID of the order that needs to be deleted",required=true ) @PathVariable("order_id") String orderId, @RequestHeader("Accept") String accept) { // do some magic! @@ -32,8 +37,6 @@ public class StoreApiController implements StoreApi { public ResponseEntity> getInventory(@RequestHeader("Accept") String accept) throws IOException { // do some magic! - - ObjectMapper objectMapper = new ObjectMapper(); if (accept != null && accept.contains("application/json")) { return new ResponseEntity>(objectMapper.readValue("{ \"key\" : 0}", Map.class), HttpStatus.OK); @@ -45,13 +48,12 @@ public class StoreApiController implements StoreApi { public ResponseEntity getOrderById( @Min(1) @Max(5)@ApiParam(value = "ID of pet that needs to be fetched",required=true ) @PathVariable("order_id") Long orderId, @RequestHeader("Accept") String accept) throws IOException { // do some magic! - - ObjectMapper objectMapper = new ObjectMapper(); if (accept != null && accept.contains("application/xml")) { return new ResponseEntity(objectMapper.readValue(" 123456789 123456789 123 2000-01-23T04:56:07.000Z aeiou true", Order.class), HttpStatus.OK); } + if (accept != null && accept.contains("application/json")) { return new ResponseEntity(objectMapper.readValue("{ \"petId\" : 6, \"quantity\" : 1, \"id\" : 0, \"shipDate\" : \"2000-01-23T04:56:07.000+00:00\", \"complete\" : false, \"status\" : \"placed\"}", Order.class), HttpStatus.OK); } @@ -62,13 +64,12 @@ public class StoreApiController implements StoreApi { public ResponseEntity placeOrder(@ApiParam(value = "order placed for purchasing the pet" ,required=true ) @Valid @RequestBody Order body, @RequestHeader("Accept") String accept) throws IOException { // do some magic! - - ObjectMapper objectMapper = new ObjectMapper(); if (accept != null && accept.contains("application/xml")) { return new ResponseEntity(objectMapper.readValue(" 123456789 123456789 123 2000-01-23T04:56:07.000Z aeiou true", Order.class), HttpStatus.OK); } + if (accept != null && accept.contains("application/json")) { return new ResponseEntity(objectMapper.readValue("{ \"petId\" : 6, \"quantity\" : 1, \"id\" : 0, \"shipDate\" : \"2000-01-23T04:56:07.000+00:00\", \"complete\" : false, \"status\" : \"placed\"}", Order.class), HttpStatus.OK); } diff --git a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/api/UserApi.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/api/UserApi.java index 53899d1eddd0..adc0d21d30b1 100644 --- a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/api/UserApi.java +++ b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/api/UserApi.java @@ -77,7 +77,7 @@ public interface UserApi { @RequestMapping(value = "/user/login", produces = { "application/xml", "application/json" }, method = RequestMethod.GET) - ResponseEntity loginUser( @NotNull @ApiParam(value = "The user name for login", required = true) @RequestParam(value = "username", required = true) String username, @NotNull @ApiParam(value = "The password for login in clear text", required = true) @RequestParam(value = "password", required = true) String password, @RequestHeader("Accept") String accept) throws IOException; + ResponseEntity loginUser( @NotNull@ApiParam(value = "The user name for login", required = true) @RequestParam(value = "username", required = true) String username, @NotNull@ApiParam(value = "The password for login in clear text", required = true) @RequestParam(value = "password", required = true) String password, @RequestHeader("Accept") String accept) throws IOException; @ApiOperation(value = "Logs out current logged in user session", notes = "", response = Void.class, tags={ "user", }) diff --git a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/api/UserApiController.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/api/UserApiController.java index d8cac8d5eb8a..24b7e18b9959 100644 --- a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/api/UserApiController.java +++ b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/api/UserApiController.java @@ -14,16 +14,21 @@ import org.springframework.web.bind.annotation.RequestHeader; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestPart; import org.springframework.web.multipart.MultipartFile; -import com.fasterxml.jackson.databind.ObjectMapper; -import java.io.IOException; import java.util.List; - +import com.fasterxml.jackson.databind.ObjectMapper; +import java.io.IOException; import javax.validation.constraints.*; import javax.validation.Valid; @Controller public class UserApiController implements UserApi { + private final ObjectMapper objectMapper; + + public UserApiController(ObjectMapper objectMapper) { + this.objectMapper = objectMapper; + } + public ResponseEntity createUser(@ApiParam(value = "Created user object" ,required=true ) @Valid @RequestBody User body, @RequestHeader("Accept") String accept) { // do some magic! @@ -51,13 +56,12 @@ public class UserApiController implements UserApi { public ResponseEntity getUserByName(@ApiParam(value = "The name that needs to be fetched. Use user1 for testing. ",required=true ) @PathVariable("username") String username, @RequestHeader("Accept") String accept) throws IOException { // do some magic! - - ObjectMapper objectMapper = new ObjectMapper(); if (accept != null && accept.contains("application/xml")) { return new ResponseEntity(objectMapper.readValue(" 123456789 aeiou aeiou aeiou aeiou aeiou aeiou 123", User.class), HttpStatus.OK); } + if (accept != null && accept.contains("application/json")) { return new ResponseEntity(objectMapper.readValue("{ \"firstName\" : \"aeiou\", \"lastName\" : \"aeiou\", \"password\" : \"aeiou\", \"userStatus\" : 6, \"phone\" : \"aeiou\", \"id\" : 0, \"email\" : \"aeiou\", \"username\" : \"aeiou\"}", User.class), HttpStatus.OK); } @@ -65,17 +69,16 @@ public class UserApiController implements UserApi { return new ResponseEntity(HttpStatus.OK); } - public ResponseEntity loginUser( @NotNull @ApiParam(value = "The user name for login", required = true) @RequestParam(value = "username", required = true) String username, - @NotNull @ApiParam(value = "The password for login in clear text", required = true) @RequestParam(value = "password", required = true) String password, + public ResponseEntity loginUser( @NotNull@ApiParam(value = "The user name for login", required = true) @RequestParam(value = "username", required = true) String username, + @NotNull@ApiParam(value = "The password for login in clear text", required = true) @RequestParam(value = "password", required = true) String password, @RequestHeader("Accept") String accept) throws IOException { // do some magic! - - ObjectMapper objectMapper = new ObjectMapper(); if (accept != null && accept.contains("application/xml")) { return new ResponseEntity(objectMapper.readValue("aeiou", String.class), HttpStatus.OK); } + if (accept != null && accept.contains("application/json")) { return new ResponseEntity(objectMapper.readValue("\"aeiou\"", String.class), HttpStatus.OK); } diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/api/FakeApi.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/api/FakeApi.java index 0464f5d15a53..332c9b1101f3 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/api/FakeApi.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/api/FakeApi.java @@ -28,12 +28,11 @@ public interface FakeApi { @ApiOperation(value = "To test \"client\" model", notes = "To test \"client\" model", response = Client.class, tags={ "fake", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Client.class) }) - @RequestMapping(value = "/fake", produces = { "application/json" }, consumes = { "application/json" }, method = RequestMethod.PATCH) - default ResponseEntity testClientModel(@ApiParam(value = "client model" ,required=true ) @Valid @RequestBody Client body) throws IOException { + default ResponseEntity testClientModel(@ApiParam(value = "client model" ,required=true ) @Valid @RequestBody Client body, @RequestHeader("Accept") String accept) throws IOException { // do some magic! return new ResponseEntity(HttpStatus.OK); } @@ -45,12 +44,11 @@ public interface FakeApi { @ApiResponses(value = { @ApiResponse(code = 400, message = "Invalid username supplied", response = Void.class), @ApiResponse(code = 404, message = "User not found", response = Void.class) }) - @RequestMapping(value = "/fake", produces = { "application/xml; charset=utf-8", "application/json; charset=utf-8" }, consumes = { "application/xml; charset=utf-8", "application/json; charset=utf-8" }, method = RequestMethod.POST) - default ResponseEntity testEndpointParameters(@ApiParam(value = "None", required=true) @RequestPart(value="number", required=true) BigDecimal number,@ApiParam(value = "None", required=true) @RequestPart(value="double", required=true) Double _double,@ApiParam(value = "None", required=true) @RequestPart(value="pattern_without_delimiter", required=true) String patternWithoutDelimiter,@ApiParam(value = "None", required=true) @RequestPart(value="byte", required=true) byte[] _byte,@ApiParam(value = "None") @RequestPart(value="integer", required=false) Integer integer,@ApiParam(value = "None") @RequestPart(value="int32", required=false) Integer int32,@ApiParam(value = "None") @RequestPart(value="int64", required=false) Long int64,@ApiParam(value = "None") @RequestPart(value="float", required=false) Float _float,@ApiParam(value = "None") @RequestPart(value="string", required=false) String string,@ApiParam(value = "None") @RequestPart(value="binary", required=false) byte[] binary,@ApiParam(value = "None") @RequestPart(value="date", required=false) LocalDate date,@ApiParam(value = "None") @RequestPart(value="dateTime", required=false) OffsetDateTime dateTime,@ApiParam(value = "None") @RequestPart(value="password", required=false) String password,@ApiParam(value = "None") @RequestPart(value="callback", required=false) String paramCallback) { + default ResponseEntity testEndpointParameters(@ApiParam(value = "None", required=true) @RequestPart(value="number", required=true) BigDecimal number,@ApiParam(value = "None", required=true) @RequestPart(value="double", required=true) Double _double,@ApiParam(value = "None", required=true) @RequestPart(value="pattern_without_delimiter", required=true) String patternWithoutDelimiter,@ApiParam(value = "None", required=true) @RequestPart(value="byte", required=true) byte[] _byte,@ApiParam(value = "None") @RequestPart(value="integer", required=false) Integer integer,@ApiParam(value = "None") @RequestPart(value="int32", required=false) Integer int32,@ApiParam(value = "None") @RequestPart(value="int64", required=false) Long int64,@ApiParam(value = "None") @RequestPart(value="float", required=false) Float _float,@ApiParam(value = "None") @RequestPart(value="string", required=false) String string,@ApiParam(value = "None") @RequestPart(value="binary", required=false) byte[] binary,@ApiParam(value = "None") @RequestPart(value="date", required=false) LocalDate date,@ApiParam(value = "None") @RequestPart(value="dateTime", required=false) OffsetDateTime dateTime,@ApiParam(value = "None") @RequestPart(value="password", required=false) String password,@ApiParam(value = "None") @RequestPart(value="callback", required=false) String paramCallback, @RequestHeader("Accept") String accept) { // do some magic! return new ResponseEntity(HttpStatus.OK); } @@ -60,12 +58,11 @@ public interface FakeApi { @ApiResponses(value = { @ApiResponse(code = 400, message = "Invalid request", response = Void.class), @ApiResponse(code = 404, message = "Not found", response = Void.class) }) - @RequestMapping(value = "/fake", produces = { "*/*" }, consumes = { "*/*" }, method = RequestMethod.GET) - default ResponseEntity testEnumParameters(@ApiParam(value = "Form parameter enum test (string array)", allowableValues=">, $") @RequestPart(value="enum_form_string_array", required=false) List enumFormStringArray,@ApiParam(value = "Form parameter enum test (string)", allowableValues="_abc, -efg, (xyz)", defaultValue="-efg") @RequestPart(value="enum_form_string", required=false) String enumFormString,@ApiParam(value = "Header parameter enum test (string array)" , allowableValues=">, $") @RequestHeader(value="enum_header_string_array", required=false) List enumHeaderStringArray,@ApiParam(value = "Header parameter enum test (string)" , allowableValues="_abc, -efg, (xyz)", defaultValue="-efg") @RequestHeader(value="enum_header_string", required=false) String enumHeaderString, @ApiParam(value = "Query parameter enum test (string array)", allowableValues = ">, $") @RequestParam(value = "enum_query_string_array", required = false) List enumQueryStringArray, @ApiParam(value = "Query parameter enum test (string)", allowableValues = "_abc, -efg, (xyz)", defaultValue = "-efg") @RequestParam(value = "enum_query_string", required = false, defaultValue="-efg") String enumQueryString, @ApiParam(value = "Query parameter enum test (double)", allowableValues = "1, -2") @RequestParam(value = "enum_query_integer", required = false) Integer enumQueryInteger,@ApiParam(value = "Query parameter enum test (double)", allowableValues="1.1, -1.2") @RequestPart(value="enum_query_double", required=false) Double enumQueryDouble) { + default ResponseEntity testEnumParameters(@ApiParam(value = "Form parameter enum test (string array)", allowableValues=">, $") @RequestPart(value="enum_form_string_array", required=false) List enumFormStringArray,@ApiParam(value = "Form parameter enum test (string)", allowableValues="_abc, -efg, (xyz)", defaultValue="-efg") @RequestPart(value="enum_form_string", required=false) String enumFormString,@ApiParam(value = "Header parameter enum test (string array)" , allowableValues=">, $") @RequestHeader(value="enum_header_string_array", required=false) List enumHeaderStringArray,@ApiParam(value = "Header parameter enum test (string)" , allowableValues="_abc, -efg, (xyz)", defaultValue="-efg") @RequestHeader(value="enum_header_string", required=false) String enumHeaderString,@ApiParam(value = "Query parameter enum test (string array)", allowableValues = ">, $") @RequestParam(value = "enum_query_string_array", required = false) List enumQueryStringArray,@ApiParam(value = "Query parameter enum test (string)", allowableValues = "_abc, -efg, (xyz)", defaultValue = "-efg") @RequestParam(value = "enum_query_string", required = false, defaultValue="-efg") String enumQueryString,@ApiParam(value = "Query parameter enum test (double)", allowableValues = "1, -2") @RequestParam(value = "enum_query_integer", required = false) Integer enumQueryInteger,@ApiParam(value = "Query parameter enum test (double)", allowableValues="1.1, -1.2") @RequestPart(value="enum_query_double", required=false) Double enumQueryDouble, @RequestHeader("Accept") String accept) { // do some magic! return new ResponseEntity(HttpStatus.OK); } diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/api/FakeApiController.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/api/FakeApiController.java index a3043c39b14a..487414784aec 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/api/FakeApiController.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/api/FakeApiController.java @@ -16,16 +16,21 @@ import org.springframework.web.bind.annotation.RequestHeader; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestPart; import org.springframework.web.multipart.MultipartFile; -import com.fasterxml.jackson.databind.ObjectMapper; -import java.io.IOException; import java.util.List; - +import com.fasterxml.jackson.databind.ObjectMapper; +import java.io.IOException; import javax.validation.constraints.*; import javax.validation.Valid; @Controller public class FakeApiController implements FakeApi { + private final ObjectMapper objectMapper; + + public FakeApiController(ObjectMapper objectMapper) { + this.objectMapper = objectMapper; + } + private final FakeApiDelegate delegate; @org.springframework.beans.factory.annotation.Autowired @@ -33,13 +38,12 @@ public class FakeApiController implements FakeApi { this.delegate = delegate; } - @RequestHeader("Accept") - public ResponseEntity testClientModel(@ApiParam(value = "client model" ,required=true ) @Valid @RequestBody Client bodyString accept) throws IOException { + public ResponseEntity testClientModel(@ApiParam(value = "client model" ,required=true ) @Valid @RequestBody Client body, + @RequestHeader("Accept") String accept) throws IOException { // do some magic! return delegate.testClientModel(body); } - @RequestHeader("Accept") public ResponseEntity testEndpointParameters(@ApiParam(value = "None", required=true) @RequestPart(value="number", required=true) BigDecimal number, @ApiParam(value = "None", required=true) @RequestPart(value="double", required=true) Double _double, @ApiParam(value = "None", required=true) @RequestPart(value="pattern_without_delimiter", required=true) String patternWithoutDelimiter, @@ -53,20 +57,21 @@ public class FakeApiController implements FakeApi { @ApiParam(value = "None") @RequestPart(value="date", required=false) LocalDate date, @ApiParam(value = "None") @RequestPart(value="dateTime", required=false) OffsetDateTime dateTime, @ApiParam(value = "None") @RequestPart(value="password", required=false) String password, - @ApiParam(value = "None") @RequestPart(value="callback", required=false) String paramCallbackString accept) { + @ApiParam(value = "None") @RequestPart(value="callback", required=false) String paramCallback, + @RequestHeader("Accept") String accept) { // do some magic! return delegate.testEndpointParameters(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, string, binary, date, dateTime, password, paramCallback); } - @RequestHeader("Accept") public ResponseEntity testEnumParameters(@ApiParam(value = "Form parameter enum test (string array)", allowableValues=">, $") @RequestPart(value="enum_form_string_array", required=false) List enumFormStringArray, @ApiParam(value = "Form parameter enum test (string)", allowableValues="_abc, -efg, (xyz)", defaultValue="-efg") @RequestPart(value="enum_form_string", required=false) String enumFormString, @ApiParam(value = "Header parameter enum test (string array)" , allowableValues=">, $") @RequestHeader(value="enum_header_string_array", required=false) List enumHeaderStringArray, @ApiParam(value = "Header parameter enum test (string)" , allowableValues="_abc, -efg, (xyz)", defaultValue="-efg") @RequestHeader(value="enum_header_string", required=false) String enumHeaderString, - @ApiParam(value = "Query parameter enum test (string array)", allowableValues = ">, $") @RequestParam(value = "enum_query_string_array", required = false) List enumQueryStringArray, - @ApiParam(value = "Query parameter enum test (string)", allowableValues = "_abc, -efg, (xyz)", defaultValue = "-efg") @RequestParam(value = "enum_query_string", required = false, defaultValue="-efg") String enumQueryString, - @ApiParam(value = "Query parameter enum test (double)", allowableValues = "1, -2") @RequestParam(value = "enum_query_integer", required = false) Integer enumQueryInteger, - @ApiParam(value = "Query parameter enum test (double)", allowableValues="1.1, -1.2") @RequestPart(value="enum_query_double", required=false) Double enumQueryDoubleString accept) { + @ApiParam(value = "Query parameter enum test (string array)", allowableValues = ">, $") @RequestParam(value = "enum_query_string_array", required = false) List enumQueryStringArray, + @ApiParam(value = "Query parameter enum test (string)", allowableValues = "_abc, -efg, (xyz)", defaultValue = "-efg") @RequestParam(value = "enum_query_string", required = false, defaultValue="-efg") String enumQueryString, + @ApiParam(value = "Query parameter enum test (double)", allowableValues = "1, -2") @RequestParam(value = "enum_query_integer", required = false) Integer enumQueryInteger, + @ApiParam(value = "Query parameter enum test (double)", allowableValues="1.1, -1.2") @RequestPart(value="enum_query_double", required=false) Double enumQueryDouble, + @RequestHeader("Accept") String accept) { // do some magic! return delegate.testEnumParameters(enumFormStringArray, enumFormString, enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble); } diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/api/PetApi.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/api/PetApi.java index 4f3a278304cb..d9dc4d87b268 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/api/PetApi.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/api/PetApi.java @@ -32,12 +32,11 @@ public interface PetApi { }, tags={ "pet", }) @ApiResponses(value = { @ApiResponse(code = 405, message = "Invalid input", response = Void.class) }) - @RequestMapping(value = "/pet", produces = { "application/xml", "application/json" }, consumes = { "application/json", "application/xml" }, method = RequestMethod.POST) - default ResponseEntity addPet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody Pet body) { + default ResponseEntity addPet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody Pet body, @RequestHeader("Accept") String accept) { // do some magic! return new ResponseEntity(HttpStatus.OK); } @@ -51,11 +50,10 @@ public interface PetApi { }, tags={ "pet", }) @ApiResponses(value = { @ApiResponse(code = 400, message = "Invalid pet value", response = Void.class) }) - @RequestMapping(value = "/pet/{petId}", produces = { "application/xml", "application/json" }, method = RequestMethod.DELETE) - default ResponseEntity deletePet(@ApiParam(value = "Pet id to delete",required=true ) @PathVariable("petId") Long petId,@ApiParam(value = "" ) @RequestHeader(value="api_key", required=false) String apiKey) { + default ResponseEntity deletePet(@ApiParam(value = "Pet id to delete",required=true ) @PathVariable("petId") Long petId,@ApiParam(value = "" ) @RequestHeader(value="api_key", required=false) String apiKey, @RequestHeader("Accept") String accept) { // do some magic! return new ResponseEntity(HttpStatus.OK); } @@ -70,11 +68,10 @@ public interface PetApi { @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Pet.class), @ApiResponse(code = 400, message = "Invalid status value", response = Pet.class) }) - @RequestMapping(value = "/pet/findByStatus", produces = { "application/xml", "application/json" }, method = RequestMethod.GET) - default ResponseEntity> findPetsByStatus( @NotNull @ApiParam(value = "Status values that need to be considered for filter", required = true, allowableValues = "available, pending, sold") @RequestParam(value = "status", required = true) List status) throws IOException { + default ResponseEntity> findPetsByStatus( @NotNull@ApiParam(value = "Status values that need to be considered for filter", required = true, allowableValues = "available, pending, sold") @RequestParam(value = "status", required = true) List status, @RequestHeader("Accept") String accept) throws IOException { // do some magic! return new ResponseEntity>(HttpStatus.OK); } @@ -89,11 +86,10 @@ public interface PetApi { @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Pet.class), @ApiResponse(code = 400, message = "Invalid tag value", response = Pet.class) }) - @RequestMapping(value = "/pet/findByTags", produces = { "application/xml", "application/json" }, method = RequestMethod.GET) - default ResponseEntity> findPetsByTags( @NotNull @ApiParam(value = "Tags to filter by", required = true) @RequestParam(value = "tags", required = true) List tags) throws IOException { + default ResponseEntity> findPetsByTags( @NotNull@ApiParam(value = "Tags to filter by", required = true) @RequestParam(value = "tags", required = true) List tags, @RequestHeader("Accept") String accept) throws IOException { // do some magic! return new ResponseEntity>(HttpStatus.OK); } @@ -106,11 +102,10 @@ public interface PetApi { @ApiResponse(code = 200, message = "successful operation", response = Pet.class), @ApiResponse(code = 400, message = "Invalid ID supplied", response = Pet.class), @ApiResponse(code = 404, message = "Pet not found", response = Pet.class) }) - @RequestMapping(value = "/pet/{petId}", produces = { "application/xml", "application/json" }, method = RequestMethod.GET) - default ResponseEntity getPetById(@ApiParam(value = "ID of pet to return",required=true ) @PathVariable("petId") Long petId) throws IOException { + default ResponseEntity getPetById(@ApiParam(value = "ID of pet to return",required=true ) @PathVariable("petId") Long petId, @RequestHeader("Accept") String accept) throws IOException { // do some magic! return new ResponseEntity(HttpStatus.OK); } @@ -126,12 +121,11 @@ public interface PetApi { @ApiResponse(code = 400, message = "Invalid ID supplied", response = Void.class), @ApiResponse(code = 404, message = "Pet not found", response = Void.class), @ApiResponse(code = 405, message = "Validation exception", response = Void.class) }) - @RequestMapping(value = "/pet", produces = { "application/xml", "application/json" }, consumes = { "application/json", "application/xml" }, method = RequestMethod.PUT) - default ResponseEntity updatePet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody Pet body) { + default ResponseEntity updatePet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody Pet body, @RequestHeader("Accept") String accept) { // do some magic! return new ResponseEntity(HttpStatus.OK); } @@ -145,12 +139,11 @@ public interface PetApi { }, tags={ "pet", }) @ApiResponses(value = { @ApiResponse(code = 405, message = "Invalid input", response = Void.class) }) - @RequestMapping(value = "/pet/{petId}", produces = { "application/xml", "application/json" }, consumes = { "application/x-www-form-urlencoded" }, method = RequestMethod.POST) - default ResponseEntity updatePetWithForm(@ApiParam(value = "ID of pet that needs to be updated",required=true ) @PathVariable("petId") Long petId,@ApiParam(value = "Updated name of the pet") @RequestPart(value="name", required=false) String name,@ApiParam(value = "Updated status of the pet") @RequestPart(value="status", required=false) String status) { + default ResponseEntity updatePetWithForm(@ApiParam(value = "ID of pet that needs to be updated",required=true ) @PathVariable("petId") Long petId,@ApiParam(value = "Updated name of the pet") @RequestPart(value="name", required=false) String name,@ApiParam(value = "Updated status of the pet") @RequestPart(value="status", required=false) String status, @RequestHeader("Accept") String accept) { // do some magic! return new ResponseEntity(HttpStatus.OK); } @@ -164,12 +157,11 @@ public interface PetApi { }, tags={ "pet", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = ModelApiResponse.class) }) - @RequestMapping(value = "/pet/{petId}/uploadImage", produces = { "application/json" }, consumes = { "multipart/form-data" }, method = RequestMethod.POST) - default ResponseEntity uploadFile(@ApiParam(value = "ID of pet to update",required=true ) @PathVariable("petId") Long petId,@ApiParam(value = "Additional data to pass to server") @RequestPart(value="additionalMetadata", required=false) String additionalMetadata,@ApiParam(value = "file detail") @RequestPart("file") MultipartFile file) throws IOException { + default ResponseEntity uploadFile(@ApiParam(value = "ID of pet to update",required=true ) @PathVariable("petId") Long petId,@ApiParam(value = "Additional data to pass to server") @RequestPart(value="additionalMetadata", required=false) String additionalMetadata,@ApiParam(value = "file detail") @RequestPart("file") MultipartFile file, @RequestHeader("Accept") String accept) throws IOException { // do some magic! return new ResponseEntity(HttpStatus.OK); } diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/api/PetApiController.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/api/PetApiController.java index 4a9ec7142b14..7adec37e9ba7 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/api/PetApiController.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/api/PetApiController.java @@ -15,16 +15,21 @@ import org.springframework.web.bind.annotation.RequestHeader; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestPart; import org.springframework.web.multipart.MultipartFile; -import com.fasterxml.jackson.databind.ObjectMapper; -import java.io.IOException; import java.util.List; - +import com.fasterxml.jackson.databind.ObjectMapper; +import java.io.IOException; import javax.validation.constraints.*; import javax.validation.Valid; @Controller public class PetApiController implements PetApi { + private final ObjectMapper objectMapper; + + public PetApiController(ObjectMapper objectMapper) { + this.objectMapper = objectMapper; + } + private final PetApiDelegate delegate; @org.springframework.beans.factory.annotation.Autowired @@ -32,55 +37,55 @@ public class PetApiController implements PetApi { this.delegate = delegate; } - @RequestHeader("Accept") - public ResponseEntity addPet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody Pet bodyString accept) { + public ResponseEntity addPet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody Pet body, + @RequestHeader("Accept") String accept) { // do some magic! return delegate.addPet(body); } - @RequestHeader("Accept") public ResponseEntity deletePet(@ApiParam(value = "Pet id to delete",required=true ) @PathVariable("petId") Long petId, - @ApiParam(value = "" ) @RequestHeader(value="api_key", required=false) String apiKeyString accept) { + @ApiParam(value = "" ) @RequestHeader(value="api_key", required=false) String apiKey, + @RequestHeader("Accept") String accept) { // do some magic! return delegate.deletePet(petId, apiKey); } - @RequestHeader("Accept") - public ResponseEntity> findPetsByStatus( @NotNull @ApiParam(value = "Status values that need to be considered for filter", required = true, allowableValues = "available, pending, sold") @RequestParam(value = "status", required = true) List statusString accept) throws IOException { + public ResponseEntity> findPetsByStatus( @NotNull@ApiParam(value = "Status values that need to be considered for filter", required = true, allowableValues = "available, pending, sold") @RequestParam(value = "status", required = true) List status, + @RequestHeader("Accept") String accept) throws IOException { // do some magic! return delegate.findPetsByStatus(status); } - @RequestHeader("Accept") - public ResponseEntity> findPetsByTags( @NotNull @ApiParam(value = "Tags to filter by", required = true) @RequestParam(value = "tags", required = true) List tagsString accept) throws IOException { + public ResponseEntity> findPetsByTags( @NotNull@ApiParam(value = "Tags to filter by", required = true) @RequestParam(value = "tags", required = true) List tags, + @RequestHeader("Accept") String accept) throws IOException { // do some magic! return delegate.findPetsByTags(tags); } - @RequestHeader("Accept") - public ResponseEntity getPetById(@ApiParam(value = "ID of pet to return",required=true ) @PathVariable("petId") Long petIdString accept) throws IOException { + public ResponseEntity getPetById(@ApiParam(value = "ID of pet to return",required=true ) @PathVariable("petId") Long petId, + @RequestHeader("Accept") String accept) throws IOException { // do some magic! return delegate.getPetById(petId); } - @RequestHeader("Accept") - public ResponseEntity updatePet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody Pet bodyString accept) { + public ResponseEntity updatePet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody Pet body, + @RequestHeader("Accept") String accept) { // do some magic! return delegate.updatePet(body); } - @RequestHeader("Accept") public ResponseEntity updatePetWithForm(@ApiParam(value = "ID of pet that needs to be updated",required=true ) @PathVariable("petId") Long petId, @ApiParam(value = "Updated name of the pet") @RequestPart(value="name", required=false) String name, - @ApiParam(value = "Updated status of the pet") @RequestPart(value="status", required=false) String statusString accept) { + @ApiParam(value = "Updated status of the pet") @RequestPart(value="status", required=false) String status, + @RequestHeader("Accept") String accept) { // do some magic! return delegate.updatePetWithForm(petId, name, status); } - @RequestHeader("Accept") public ResponseEntity uploadFile(@ApiParam(value = "ID of pet to update",required=true ) @PathVariable("petId") Long petId, @ApiParam(value = "Additional data to pass to server") @RequestPart(value="additionalMetadata", required=false) String additionalMetadata, - @ApiParam(value = "file detail") @RequestPart("file") MultipartFile fileString accept) throws IOException { + @ApiParam(value = "file detail") @RequestPart("file") MultipartFile file, + @RequestHeader("Accept") String accept) throws IOException { // do some magic! return delegate.uploadFile(petId, additionalMetadata, file); } diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/api/StoreApi.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/api/StoreApi.java index 7273626269fd..c10166a33fc3 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/api/StoreApi.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/api/StoreApi.java @@ -27,11 +27,10 @@ public interface StoreApi { @ApiResponses(value = { @ApiResponse(code = 400, message = "Invalid ID supplied", response = Void.class), @ApiResponse(code = 404, message = "Order not found", response = Void.class) }) - @RequestMapping(value = "/store/order/{order_id}", produces = { "application/xml", "application/json" }, method = RequestMethod.DELETE) - default ResponseEntity deleteOrder(@ApiParam(value = "ID of the order that needs to be deleted",required=true ) @PathVariable("order_id") String orderId) { + default ResponseEntity deleteOrder(@ApiParam(value = "ID of the order that needs to be deleted",required=true ) @PathVariable("order_id") String orderId, @RequestHeader("Accept") String accept) { // do some magic! return new ResponseEntity(HttpStatus.OK); } @@ -42,11 +41,10 @@ public interface StoreApi { }, tags={ "store", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Integer.class) }) - @RequestMapping(value = "/store/inventory", produces = { "application/json" }, method = RequestMethod.GET) - default ResponseEntity> getInventory() throws IOException { + default ResponseEntity> getInventory( @RequestHeader("Accept") String accept) throws IOException { // do some magic! return new ResponseEntity>(HttpStatus.OK); } @@ -57,11 +55,10 @@ public interface StoreApi { @ApiResponse(code = 200, message = "successful operation", response = Order.class), @ApiResponse(code = 400, message = "Invalid ID supplied", response = Order.class), @ApiResponse(code = 404, message = "Order not found", response = Order.class) }) - @RequestMapping(value = "/store/order/{order_id}", produces = { "application/xml", "application/json" }, method = RequestMethod.GET) - default ResponseEntity getOrderById( @Min(1) @Max(5)@ApiParam(value = "ID of pet that needs to be fetched",required=true ) @PathVariable("order_id") Long orderId) throws IOException { + default ResponseEntity getOrderById( @Min(1) @Max(5)@ApiParam(value = "ID of pet that needs to be fetched",required=true ) @PathVariable("order_id") Long orderId, @RequestHeader("Accept") String accept) throws IOException { // do some magic! return new ResponseEntity(HttpStatus.OK); } @@ -71,11 +68,10 @@ public interface StoreApi { @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Order.class), @ApiResponse(code = 400, message = "Invalid Order", response = Order.class) }) - @RequestMapping(value = "/store/order", produces = { "application/xml", "application/json" }, method = RequestMethod.POST) - default ResponseEntity placeOrder(@ApiParam(value = "order placed for purchasing the pet" ,required=true ) @Valid @RequestBody Order body) throws IOException { + default ResponseEntity placeOrder(@ApiParam(value = "order placed for purchasing the pet" ,required=true ) @Valid @RequestBody Order body, @RequestHeader("Accept") String accept) throws IOException { // do some magic! return new ResponseEntity(HttpStatus.OK); } diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/api/StoreApiController.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/api/StoreApiController.java index 2985da155286..4d0ff13f995e 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/api/StoreApiController.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/api/StoreApiController.java @@ -14,16 +14,21 @@ import org.springframework.web.bind.annotation.RequestHeader; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestPart; import org.springframework.web.multipart.MultipartFile; -import com.fasterxml.jackson.databind.ObjectMapper; -import java.io.IOException; import java.util.List; - +import com.fasterxml.jackson.databind.ObjectMapper; +import java.io.IOException; import javax.validation.constraints.*; import javax.validation.Valid; @Controller public class StoreApiController implements StoreApi { + private final ObjectMapper objectMapper; + + public StoreApiController(ObjectMapper objectMapper) { + this.objectMapper = objectMapper; + } + private final StoreApiDelegate delegate; @org.springframework.beans.factory.annotation.Autowired @@ -31,26 +36,25 @@ public class StoreApiController implements StoreApi { this.delegate = delegate; } - @RequestHeader("Accept") - public ResponseEntity deleteOrder(@ApiParam(value = "ID of the order that needs to be deleted",required=true ) @PathVariable("order_id") String orderIdString accept) { + public ResponseEntity deleteOrder(@ApiParam(value = "ID of the order that needs to be deleted",required=true ) @PathVariable("order_id") String orderId, + @RequestHeader("Accept") String accept) { // do some magic! return delegate.deleteOrder(orderId); } - @RequestHeader("Accept") - public ResponseEntity> getInventory(String accept) throws IOException { + public ResponseEntity> getInventory(@RequestHeader("Accept") String accept) throws IOException { // do some magic! return delegate.getInventory(); } - @RequestHeader("Accept") - public ResponseEntity getOrderById( @Min(1) @Max(5)@ApiParam(value = "ID of pet that needs to be fetched",required=true ) @PathVariable("order_id") Long orderIdString accept) throws IOException { + public ResponseEntity getOrderById( @Min(1) @Max(5)@ApiParam(value = "ID of pet that needs to be fetched",required=true ) @PathVariable("order_id") Long orderId, + @RequestHeader("Accept") String accept) throws IOException { // do some magic! return delegate.getOrderById(orderId); } - @RequestHeader("Accept") - public ResponseEntity placeOrder(@ApiParam(value = "order placed for purchasing the pet" ,required=true ) @Valid @RequestBody Order bodyString accept) throws IOException { + public ResponseEntity placeOrder(@ApiParam(value = "order placed for purchasing the pet" ,required=true ) @Valid @RequestBody Order body, + @RequestHeader("Accept") String accept) throws IOException { // do some magic! return delegate.placeOrder(body); } diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/api/UserApi.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/api/UserApi.java index e4cfd9df8324..6642dec5ecfc 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/api/UserApi.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/api/UserApi.java @@ -26,11 +26,10 @@ public interface UserApi { @ApiOperation(value = "Create user", notes = "This can only be done by the logged in user.", response = Void.class, tags={ "user", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Void.class) }) - @RequestMapping(value = "/user", produces = { "application/xml", "application/json" }, method = RequestMethod.POST) - default ResponseEntity createUser(@ApiParam(value = "Created user object" ,required=true ) @Valid @RequestBody User body) { + default ResponseEntity createUser(@ApiParam(value = "Created user object" ,required=true ) @Valid @RequestBody User body, @RequestHeader("Accept") String accept) { // do some magic! return new ResponseEntity(HttpStatus.OK); } @@ -39,11 +38,10 @@ public interface UserApi { @ApiOperation(value = "Creates list of users with given input array", notes = "", response = Void.class, tags={ "user", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Void.class) }) - @RequestMapping(value = "/user/createWithArray", produces = { "application/xml", "application/json" }, method = RequestMethod.POST) - default ResponseEntity createUsersWithArrayInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody List body) { + default ResponseEntity createUsersWithArrayInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody List body, @RequestHeader("Accept") String accept) { // do some magic! return new ResponseEntity(HttpStatus.OK); } @@ -52,11 +50,10 @@ public interface UserApi { @ApiOperation(value = "Creates list of users with given input array", notes = "", response = Void.class, tags={ "user", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Void.class) }) - @RequestMapping(value = "/user/createWithList", produces = { "application/xml", "application/json" }, method = RequestMethod.POST) - default ResponseEntity createUsersWithListInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody List body) { + default ResponseEntity createUsersWithListInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody List body, @RequestHeader("Accept") String accept) { // do some magic! return new ResponseEntity(HttpStatus.OK); } @@ -66,11 +63,10 @@ public interface UserApi { @ApiResponses(value = { @ApiResponse(code = 400, message = "Invalid username supplied", response = Void.class), @ApiResponse(code = 404, message = "User not found", response = Void.class) }) - @RequestMapping(value = "/user/{username}", produces = { "application/xml", "application/json" }, method = RequestMethod.DELETE) - default ResponseEntity deleteUser(@ApiParam(value = "The name that needs to be deleted",required=true ) @PathVariable("username") String username) { + default ResponseEntity deleteUser(@ApiParam(value = "The name that needs to be deleted",required=true ) @PathVariable("username") String username, @RequestHeader("Accept") String accept) { // do some magic! return new ResponseEntity(HttpStatus.OK); } @@ -81,11 +77,10 @@ public interface UserApi { @ApiResponse(code = 200, message = "successful operation", response = User.class), @ApiResponse(code = 400, message = "Invalid username supplied", response = User.class), @ApiResponse(code = 404, message = "User not found", response = User.class) }) - @RequestMapping(value = "/user/{username}", produces = { "application/xml", "application/json" }, method = RequestMethod.GET) - default ResponseEntity getUserByName(@ApiParam(value = "The name that needs to be fetched. Use user1 for testing. ",required=true ) @PathVariable("username") String username) throws IOException { + default ResponseEntity getUserByName(@ApiParam(value = "The name that needs to be fetched. Use user1 for testing. ",required=true ) @PathVariable("username") String username, @RequestHeader("Accept") String accept) throws IOException { // do some magic! return new ResponseEntity(HttpStatus.OK); } @@ -95,11 +90,10 @@ public interface UserApi { @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = String.class), @ApiResponse(code = 400, message = "Invalid username/password supplied", response = String.class) }) - @RequestMapping(value = "/user/login", produces = { "application/xml", "application/json" }, method = RequestMethod.GET) - default ResponseEntity loginUser( @NotNull @ApiParam(value = "The user name for login", required = true) @RequestParam(value = "username", required = true) String username, @NotNull @ApiParam(value = "The password for login in clear text", required = true) @RequestParam(value = "password", required = true) String password) throws IOException { + default ResponseEntity loginUser( @NotNull@ApiParam(value = "The user name for login", required = true) @RequestParam(value = "username", required = true) String username, @NotNull@ApiParam(value = "The password for login in clear text", required = true) @RequestParam(value = "password", required = true) String password, @RequestHeader("Accept") String accept) throws IOException { // do some magic! return new ResponseEntity(HttpStatus.OK); } @@ -108,11 +102,10 @@ public interface UserApi { @ApiOperation(value = "Logs out current logged in user session", notes = "", response = Void.class, tags={ "user", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Void.class) }) - @RequestMapping(value = "/user/logout", produces = { "application/xml", "application/json" }, method = RequestMethod.GET) - default ResponseEntity logoutUser() { + default ResponseEntity logoutUser( @RequestHeader("Accept") String accept) { // do some magic! return new ResponseEntity(HttpStatus.OK); } @@ -122,11 +115,10 @@ public interface UserApi { @ApiResponses(value = { @ApiResponse(code = 400, message = "Invalid user supplied", response = Void.class), @ApiResponse(code = 404, message = "User not found", response = Void.class) }) - @RequestMapping(value = "/user/{username}", produces = { "application/xml", "application/json" }, method = RequestMethod.PUT) - default ResponseEntity updateUser(@ApiParam(value = "name that need to be deleted",required=true ) @PathVariable("username") String username,@ApiParam(value = "Updated user object" ,required=true ) @Valid @RequestBody User body) { + default ResponseEntity updateUser(@ApiParam(value = "name that need to be deleted",required=true ) @PathVariable("username") String username,@ApiParam(value = "Updated user object" ,required=true ) @Valid @RequestBody User body, @RequestHeader("Accept") String accept) { // do some magic! return new ResponseEntity(HttpStatus.OK); } diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/api/UserApiController.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/api/UserApiController.java index cc95ebc5af80..0264f9026a4d 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/api/UserApiController.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/api/UserApiController.java @@ -14,16 +14,21 @@ import org.springframework.web.bind.annotation.RequestHeader; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestPart; import org.springframework.web.multipart.MultipartFile; -import com.fasterxml.jackson.databind.ObjectMapper; -import java.io.IOException; import java.util.List; - +import com.fasterxml.jackson.databind.ObjectMapper; +import java.io.IOException; import javax.validation.constraints.*; import javax.validation.Valid; @Controller public class UserApiController implements UserApi { + private final ObjectMapper objectMapper; + + public UserApiController(ObjectMapper objectMapper) { + this.objectMapper = objectMapper; + } + private final UserApiDelegate delegate; @org.springframework.beans.factory.annotation.Autowired @@ -31,52 +36,51 @@ public class UserApiController implements UserApi { this.delegate = delegate; } - @RequestHeader("Accept") - public ResponseEntity createUser(@ApiParam(value = "Created user object" ,required=true ) @Valid @RequestBody User bodyString accept) { + public ResponseEntity createUser(@ApiParam(value = "Created user object" ,required=true ) @Valid @RequestBody User body, + @RequestHeader("Accept") String accept) { // do some magic! return delegate.createUser(body); } - @RequestHeader("Accept") - public ResponseEntity createUsersWithArrayInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody List bodyString accept) { + public ResponseEntity createUsersWithArrayInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody List body, + @RequestHeader("Accept") String accept) { // do some magic! return delegate.createUsersWithArrayInput(body); } - @RequestHeader("Accept") - public ResponseEntity createUsersWithListInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody List bodyString accept) { + public ResponseEntity createUsersWithListInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody List body, + @RequestHeader("Accept") String accept) { // do some magic! return delegate.createUsersWithListInput(body); } - @RequestHeader("Accept") - public ResponseEntity deleteUser(@ApiParam(value = "The name that needs to be deleted",required=true ) @PathVariable("username") String usernameString accept) { + public ResponseEntity deleteUser(@ApiParam(value = "The name that needs to be deleted",required=true ) @PathVariable("username") String username, + @RequestHeader("Accept") String accept) { // do some magic! return delegate.deleteUser(username); } - @RequestHeader("Accept") - public ResponseEntity getUserByName(@ApiParam(value = "The name that needs to be fetched. Use user1 for testing. ",required=true ) @PathVariable("username") String usernameString accept) throws IOException { + public ResponseEntity getUserByName(@ApiParam(value = "The name that needs to be fetched. Use user1 for testing. ",required=true ) @PathVariable("username") String username, + @RequestHeader("Accept") String accept) throws IOException { // do some magic! return delegate.getUserByName(username); } - @RequestHeader("Accept") - public ResponseEntity loginUser( @NotNull @ApiParam(value = "The user name for login", required = true) @RequestParam(value = "username", required = true) String username, - @NotNull @ApiParam(value = "The password for login in clear text", required = true) @RequestParam(value = "password", required = true) String passwordString accept) throws IOException { + public ResponseEntity loginUser( @NotNull@ApiParam(value = "The user name for login", required = true) @RequestParam(value = "username", required = true) String username, + @NotNull@ApiParam(value = "The password for login in clear text", required = true) @RequestParam(value = "password", required = true) String password, + @RequestHeader("Accept") String accept) throws IOException { // do some magic! return delegate.loginUser(username, password); } - @RequestHeader("Accept") - public ResponseEntity logoutUser(String accept) { + public ResponseEntity logoutUser(@RequestHeader("Accept") String accept) { // do some magic! return delegate.logoutUser(); } - @RequestHeader("Accept") public ResponseEntity updateUser(@ApiParam(value = "name that need to be deleted",required=true ) @PathVariable("username") String username, - @ApiParam(value = "Updated user object" ,required=true ) @Valid @RequestBody User bodyString accept) { + @ApiParam(value = "Updated user object" ,required=true ) @Valid @RequestBody User body, + @RequestHeader("Accept") String accept) { // do some magic! return delegate.updateUser(username, body); } diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/AdditionalPropertiesClass.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/AdditionalPropertiesClass.java index f4cfcadae519..80be4236b0d6 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/AdditionalPropertiesClass.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/AdditionalPropertiesClass.java @@ -8,7 +8,9 @@ import io.swagger.annotations.ApiModelProperty; import java.util.HashMap; import java.util.List; import java.util.Map; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * AdditionalPropertiesClass */ @@ -38,6 +40,8 @@ public class AdditionalPropertiesClass { * @return mapProperty **/ @ApiModelProperty(value = "") + + @Valid public Map getMapProperty() { return mapProperty; } @@ -64,6 +68,8 @@ public class AdditionalPropertiesClass { * @return mapOfMapProperty **/ @ApiModelProperty(value = "") + + @Valid public Map> getMapOfMapProperty() { return mapOfMapProperty; } diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/Animal.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/Animal.java index a218f0b5542f..bc957d1c8038 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/Animal.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/Animal.java @@ -7,7 +7,9 @@ import com.fasterxml.jackson.annotation.JsonSubTypes; import com.fasterxml.jackson.annotation.JsonTypeInfo; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * Animal */ @@ -35,6 +37,8 @@ public class Animal { **/ @ApiModelProperty(required = true, value = "") @NotNull + + @Valid public String getClassName() { return className; } @@ -53,6 +57,8 @@ public class Animal { * @return color **/ @ApiModelProperty(value = "") + + @Valid public String getColor() { return color; } diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/AnimalFarm.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/AnimalFarm.java index 33dc04699af5..9fa4159f2032 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/AnimalFarm.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/AnimalFarm.java @@ -4,7 +4,9 @@ import java.util.Objects; import io.swagger.model.Animal; import java.util.ArrayList; import java.util.List; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * AnimalFarm */ diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/ArrayOfArrayOfNumberOnly.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/ArrayOfArrayOfNumberOnly.java index 8f975d8feda3..f9dca7d60b5f 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/ArrayOfArrayOfNumberOnly.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/ArrayOfArrayOfNumberOnly.java @@ -8,7 +8,9 @@ import io.swagger.annotations.ApiModelProperty; import java.math.BigDecimal; import java.util.ArrayList; import java.util.List; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * ArrayOfArrayOfNumberOnly */ @@ -35,6 +37,8 @@ public class ArrayOfArrayOfNumberOnly { * @return arrayArrayNumber **/ @ApiModelProperty(value = "") + + @Valid public List> getArrayArrayNumber() { return arrayArrayNumber; } diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/ArrayOfNumberOnly.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/ArrayOfNumberOnly.java index 2c5560085542..e9c8a313be0c 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/ArrayOfNumberOnly.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/ArrayOfNumberOnly.java @@ -8,7 +8,9 @@ import io.swagger.annotations.ApiModelProperty; import java.math.BigDecimal; import java.util.ArrayList; import java.util.List; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * ArrayOfNumberOnly */ @@ -35,6 +37,8 @@ public class ArrayOfNumberOnly { * @return arrayNumber **/ @ApiModelProperty(value = "") + + @Valid public List getArrayNumber() { return arrayNumber; } diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/ArrayTest.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/ArrayTest.java index 664e319cd357..78c35d3c63a0 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/ArrayTest.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/ArrayTest.java @@ -8,7 +8,9 @@ import io.swagger.annotations.ApiModelProperty; import io.swagger.model.ReadOnlyFirst; import java.util.ArrayList; import java.util.List; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * ArrayTest */ @@ -41,6 +43,8 @@ public class ArrayTest { * @return arrayOfString **/ @ApiModelProperty(value = "") + + @Valid public List getArrayOfString() { return arrayOfString; } @@ -67,6 +71,8 @@ public class ArrayTest { * @return arrayArrayOfInteger **/ @ApiModelProperty(value = "") + + @Valid public List> getArrayArrayOfInteger() { return arrayArrayOfInteger; } @@ -93,6 +99,8 @@ public class ArrayTest { * @return arrayArrayOfModel **/ @ApiModelProperty(value = "") + + @Valid public List> getArrayArrayOfModel() { return arrayArrayOfModel; } diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/Capitalization.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/Capitalization.java index d7ad5642ccff..93533c288221 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/Capitalization.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/Capitalization.java @@ -5,7 +5,9 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * Capitalization */ @@ -39,6 +41,8 @@ public class Capitalization { * @return smallCamel **/ @ApiModelProperty(value = "") + + @Valid public String getSmallCamel() { return smallCamel; } @@ -57,6 +61,8 @@ public class Capitalization { * @return capitalCamel **/ @ApiModelProperty(value = "") + + @Valid public String getCapitalCamel() { return capitalCamel; } @@ -75,6 +81,8 @@ public class Capitalization { * @return smallSnake **/ @ApiModelProperty(value = "") + + @Valid public String getSmallSnake() { return smallSnake; } @@ -93,6 +101,8 @@ public class Capitalization { * @return capitalSnake **/ @ApiModelProperty(value = "") + + @Valid public String getCapitalSnake() { return capitalSnake; } @@ -111,6 +121,8 @@ public class Capitalization { * @return scAETHFlowPoints **/ @ApiModelProperty(value = "") + + @Valid public String getScAETHFlowPoints() { return scAETHFlowPoints; } @@ -129,6 +141,8 @@ public class Capitalization { * @return ATT_NAME **/ @ApiModelProperty(value = "Name of the pet ") + + @Valid public String getATTNAME() { return ATT_NAME; } diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/Cat.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/Cat.java index 747e5dc0c7e1..edcbc354be61 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/Cat.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/Cat.java @@ -6,7 +6,9 @@ import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import io.swagger.model.Animal; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * Cat */ @@ -25,6 +27,8 @@ public class Cat extends Animal { * @return declawed **/ @ApiModelProperty(value = "") + + @Valid public Boolean getDeclawed() { return declawed; } diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/Category.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/Category.java index 9629da6500ed..6dd9cb7a2ad1 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/Category.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/Category.java @@ -5,7 +5,9 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * Category */ @@ -27,6 +29,8 @@ public class Category { * @return id **/ @ApiModelProperty(value = "") + + @Valid public Long getId() { return id; } @@ -45,6 +49,8 @@ public class Category { * @return name **/ @ApiModelProperty(value = "") + + @Valid public String getName() { return name; } diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/ClassModel.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/ClassModel.java index d69acffefa89..6a6379f5b607 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/ClassModel.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/ClassModel.java @@ -5,7 +5,9 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * Model for testing model with \"_class\" property */ @@ -25,6 +27,8 @@ public class ClassModel { * @return propertyClass **/ @ApiModelProperty(value = "") + + @Valid public String getPropertyClass() { return propertyClass; } diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/Client.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/Client.java index f9cec5a225e7..3b8d16cabf2c 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/Client.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/Client.java @@ -5,7 +5,9 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * Client */ @@ -24,6 +26,8 @@ public class Client { * @return client **/ @ApiModelProperty(value = "") + + @Valid public String getClient() { return client; } diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/Dog.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/Dog.java index 9057e840fc30..513131a9fa79 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/Dog.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/Dog.java @@ -6,7 +6,9 @@ import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import io.swagger.model.Animal; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * Dog */ @@ -25,6 +27,8 @@ public class Dog extends Animal { * @return breed **/ @ApiModelProperty(value = "") + + @Valid public String getBreed() { return breed; } diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/EnumArrays.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/EnumArrays.java index f904035e482c..bbf4a3036e94 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/EnumArrays.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/EnumArrays.java @@ -8,7 +8,9 @@ import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import java.util.ArrayList; import java.util.List; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * EnumArrays */ @@ -92,6 +94,8 @@ public class EnumArrays { * @return justSymbol **/ @ApiModelProperty(value = "") + + @Valid public JustSymbolEnum getJustSymbol() { return justSymbol; } @@ -118,6 +122,8 @@ public class EnumArrays { * @return arrayEnum **/ @ApiModelProperty(value = "") + + @Valid public List getArrayEnum() { return arrayEnum; } diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/EnumClass.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/EnumClass.java index cdfc0933c3e1..4cfbe4b9fcf5 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/EnumClass.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/EnumClass.java @@ -2,7 +2,9 @@ package io.swagger.model; import java.util.Objects; import com.fasterxml.jackson.annotation.JsonValue; +import javax.validation.Valid; import javax.validation.constraints.*; + import com.fasterxml.jackson.annotation.JsonCreator; /** diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/EnumTest.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/EnumTest.java index 9f2a0275a6aa..c7e4793cdf73 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/EnumTest.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/EnumTest.java @@ -7,7 +7,9 @@ import com.fasterxml.jackson.annotation.JsonValue; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import io.swagger.model.OuterEnum; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * EnumTest */ @@ -130,6 +132,8 @@ public class EnumTest { * @return enumString **/ @ApiModelProperty(value = "") + + @Valid public EnumStringEnum getEnumString() { return enumString; } @@ -148,6 +152,8 @@ public class EnumTest { * @return enumInteger **/ @ApiModelProperty(value = "") + + @Valid public EnumIntegerEnum getEnumInteger() { return enumInteger; } @@ -166,6 +172,8 @@ public class EnumTest { * @return enumNumber **/ @ApiModelProperty(value = "") + + @Valid public EnumNumberEnum getEnumNumber() { return enumNumber; } @@ -184,6 +192,8 @@ public class EnumTest { * @return outerEnum **/ @ApiModelProperty(value = "") + + @Valid public OuterEnum getOuterEnum() { return outerEnum; } diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/FormatTest.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/FormatTest.java index c6d568be7ed2..f63a8de2c15f 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/FormatTest.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/FormatTest.java @@ -9,7 +9,9 @@ import java.math.BigDecimal; import java.time.LocalDate; import java.time.OffsetDateTime; import java.util.UUID; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * FormatTest */ @@ -66,7 +68,9 @@ public class FormatTest { * @return integer **/ @ApiModelProperty(value = "") - @Min(10) @Max(100) public Integer getInteger() { + @Min(10) @Max(100) + @Valid + public Integer getInteger() { return integer; } @@ -86,7 +90,9 @@ public class FormatTest { * @return int32 **/ @ApiModelProperty(value = "") - @Min(20) @Max(200) public Integer getInt32() { + @Min(20) @Max(200) + @Valid + public Integer getInt32() { return int32; } @@ -104,6 +110,8 @@ public class FormatTest { * @return int64 **/ @ApiModelProperty(value = "") + + @Valid public Long getInt64() { return int64; } @@ -125,7 +133,9 @@ public class FormatTest { **/ @ApiModelProperty(required = true, value = "") @NotNull - @DecimalMin("32.1") @DecimalMax("543.2") public BigDecimal getNumber() { + @DecimalMin("32.1") @DecimalMax("543.2") + @Valid + public BigDecimal getNumber() { return number; } @@ -145,7 +155,9 @@ public class FormatTest { * @return _float **/ @ApiModelProperty(value = "") - @DecimalMin("54.3") @DecimalMax("987.6") public Float getFloat() { + @DecimalMin("54.3") @DecimalMax("987.6") + @Valid + public Float getFloat() { return _float; } @@ -165,7 +177,9 @@ public class FormatTest { * @return _double **/ @ApiModelProperty(value = "") - @DecimalMin("67.8") @DecimalMax("123.4") public Double getDouble() { + @DecimalMin("67.8") @DecimalMax("123.4") + @Valid + public Double getDouble() { return _double; } @@ -183,7 +197,9 @@ public class FormatTest { * @return string **/ @ApiModelProperty(value = "") - @Pattern(regexp="/[a-z]/i") public String getString() { + @Pattern(regexp="/[a-z]/i") + @Valid + public String getString() { return string; } @@ -202,6 +218,8 @@ public class FormatTest { **/ @ApiModelProperty(required = true, value = "") @NotNull + + @Valid public byte[] getByte() { return _byte; } @@ -220,6 +238,8 @@ public class FormatTest { * @return binary **/ @ApiModelProperty(value = "") + + @Valid public byte[] getBinary() { return binary; } @@ -239,6 +259,8 @@ public class FormatTest { **/ @ApiModelProperty(required = true, value = "") @NotNull + + @Valid public LocalDate getDate() { return date; } @@ -257,6 +279,8 @@ public class FormatTest { * @return dateTime **/ @ApiModelProperty(value = "") + + @Valid public OffsetDateTime getDateTime() { return dateTime; } @@ -275,6 +299,8 @@ public class FormatTest { * @return uuid **/ @ApiModelProperty(value = "") + + @Valid public UUID getUuid() { return uuid; } @@ -294,7 +320,9 @@ public class FormatTest { **/ @ApiModelProperty(required = true, value = "") @NotNull - @Size(min=10,max=64) public String getPassword() { + @Size(min=10,max=64) + @Valid + public String getPassword() { return password; } diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/HasOnlyReadOnly.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/HasOnlyReadOnly.java index a26492e49126..0f8b608e2612 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/HasOnlyReadOnly.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/HasOnlyReadOnly.java @@ -5,7 +5,9 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * HasOnlyReadOnly */ @@ -27,6 +29,8 @@ public class HasOnlyReadOnly { * @return bar **/ @ApiModelProperty(readOnly = true, value = "") + + @Valid public String getBar() { return bar; } @@ -45,6 +49,8 @@ public class HasOnlyReadOnly { * @return foo **/ @ApiModelProperty(readOnly = true, value = "") + + @Valid public String getFoo() { return foo; } diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/MapTest.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/MapTest.java index 434c3a8f1b5c..1530a53f53f4 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/MapTest.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/MapTest.java @@ -9,7 +9,9 @@ import io.swagger.annotations.ApiModelProperty; import java.util.HashMap; import java.util.List; import java.util.Map; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * MapTest */ @@ -70,6 +72,8 @@ public class MapTest { * @return mapMapOfString **/ @ApiModelProperty(value = "") + + @Valid public Map> getMapMapOfString() { return mapMapOfString; } @@ -96,6 +100,8 @@ public class MapTest { * @return mapOfEnumString **/ @ApiModelProperty(value = "") + + @Valid public Map getMapOfEnumString() { return mapOfEnumString; } diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/MixedPropertiesAndAdditionalPropertiesClass.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/MixedPropertiesAndAdditionalPropertiesClass.java index 727205e40f96..eafbcb4ecb80 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/MixedPropertiesAndAdditionalPropertiesClass.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/MixedPropertiesAndAdditionalPropertiesClass.java @@ -11,7 +11,9 @@ import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.UUID; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * MixedPropertiesAndAdditionalPropertiesClass */ @@ -36,6 +38,8 @@ public class MixedPropertiesAndAdditionalPropertiesClass { * @return uuid **/ @ApiModelProperty(value = "") + + @Valid public UUID getUuid() { return uuid; } @@ -54,6 +58,8 @@ public class MixedPropertiesAndAdditionalPropertiesClass { * @return dateTime **/ @ApiModelProperty(value = "") + + @Valid public OffsetDateTime getDateTime() { return dateTime; } @@ -80,6 +86,8 @@ public class MixedPropertiesAndAdditionalPropertiesClass { * @return map **/ @ApiModelProperty(value = "") + + @Valid public Map getMap() { return map; } diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/Model200Response.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/Model200Response.java index 4d47f6c03c96..97349fef05c1 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/Model200Response.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/Model200Response.java @@ -5,7 +5,9 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * Model for testing model name starting with number */ @@ -28,6 +30,8 @@ public class Model200Response { * @return name **/ @ApiModelProperty(value = "") + + @Valid public Integer getName() { return name; } @@ -46,6 +50,8 @@ public class Model200Response { * @return propertyClass **/ @ApiModelProperty(value = "") + + @Valid public String getPropertyClass() { return propertyClass; } diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/ModelApiResponse.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/ModelApiResponse.java index 36da9b20d9d4..c8882b3b1e25 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/ModelApiResponse.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/ModelApiResponse.java @@ -5,7 +5,9 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * ModelApiResponse */ @@ -30,6 +32,8 @@ public class ModelApiResponse { * @return code **/ @ApiModelProperty(value = "") + + @Valid public Integer getCode() { return code; } @@ -48,6 +52,8 @@ public class ModelApiResponse { * @return type **/ @ApiModelProperty(value = "") + + @Valid public String getType() { return type; } @@ -66,6 +72,8 @@ public class ModelApiResponse { * @return message **/ @ApiModelProperty(value = "") + + @Valid public String getMessage() { return message; } diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/ModelReturn.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/ModelReturn.java index 7ffc24a0144f..7018d7de09cd 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/ModelReturn.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/ModelReturn.java @@ -5,7 +5,9 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * Model for testing reserved words */ @@ -25,6 +27,8 @@ public class ModelReturn { * @return _return **/ @ApiModelProperty(value = "") + + @Valid public Integer getReturn() { return _return; } diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/Name.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/Name.java index 953199166ff2..46069fdd14b2 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/Name.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/Name.java @@ -5,7 +5,9 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * Model for testing model name same as property name */ @@ -35,6 +37,8 @@ public class Name { **/ @ApiModelProperty(required = true, value = "") @NotNull + + @Valid public Integer getName() { return name; } @@ -53,6 +57,8 @@ public class Name { * @return snakeCase **/ @ApiModelProperty(readOnly = true, value = "") + + @Valid public Integer getSnakeCase() { return snakeCase; } @@ -71,6 +77,8 @@ public class Name { * @return property **/ @ApiModelProperty(value = "") + + @Valid public String getProperty() { return property; } @@ -89,6 +97,8 @@ public class Name { * @return _123Number **/ @ApiModelProperty(readOnly = true, value = "") + + @Valid public Integer get123Number() { return _123Number; } diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/NumberOnly.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/NumberOnly.java index e6dbf3139e2a..e243ecb429ba 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/NumberOnly.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/NumberOnly.java @@ -6,7 +6,9 @@ import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import java.math.BigDecimal; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * NumberOnly */ @@ -25,6 +27,8 @@ public class NumberOnly { * @return justNumber **/ @ApiModelProperty(value = "") + + @Valid public BigDecimal getJustNumber() { return justNumber; } diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/Order.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/Order.java index d65ed713151c..e1a5d94cc8f0 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/Order.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/Order.java @@ -7,7 +7,9 @@ import com.fasterxml.jackson.annotation.JsonValue; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import java.time.OffsetDateTime; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * Order */ @@ -74,6 +76,8 @@ public class Order { * @return id **/ @ApiModelProperty(value = "") + + @Valid public Long getId() { return id; } @@ -92,6 +96,8 @@ public class Order { * @return petId **/ @ApiModelProperty(value = "") + + @Valid public Long getPetId() { return petId; } @@ -110,6 +116,8 @@ public class Order { * @return quantity **/ @ApiModelProperty(value = "") + + @Valid public Integer getQuantity() { return quantity; } @@ -128,6 +136,8 @@ public class Order { * @return shipDate **/ @ApiModelProperty(value = "") + + @Valid public OffsetDateTime getShipDate() { return shipDate; } @@ -146,6 +156,8 @@ public class Order { * @return status **/ @ApiModelProperty(value = "Order Status") + + @Valid public StatusEnum getStatus() { return status; } @@ -164,6 +176,8 @@ public class Order { * @return complete **/ @ApiModelProperty(value = "") + + @Valid public Boolean getComplete() { return complete; } diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/OuterEnum.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/OuterEnum.java index 5f0075e4457a..f3c6d31fb865 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/OuterEnum.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/OuterEnum.java @@ -2,7 +2,9 @@ package io.swagger.model; import java.util.Objects; import com.fasterxml.jackson.annotation.JsonValue; +import javax.validation.Valid; import javax.validation.constraints.*; + import com.fasterxml.jackson.annotation.JsonCreator; /** diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/Pet.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/Pet.java index b013846b4d6e..c84687b699f3 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/Pet.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/Pet.java @@ -10,7 +10,9 @@ import io.swagger.model.Category; import io.swagger.model.Tag; import java.util.ArrayList; import java.util.List; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * Pet */ @@ -77,6 +79,8 @@ public class Pet { * @return id **/ @ApiModelProperty(value = "") + + @Valid public Long getId() { return id; } @@ -95,6 +99,8 @@ public class Pet { * @return category **/ @ApiModelProperty(value = "") + + @Valid public Category getCategory() { return category; } @@ -114,6 +120,8 @@ public class Pet { **/ @ApiModelProperty(example = "doggie", required = true, value = "") @NotNull + + @Valid public String getName() { return name; } @@ -138,6 +146,8 @@ public class Pet { **/ @ApiModelProperty(required = true, value = "") @NotNull + + @Valid public List getPhotoUrls() { return photoUrls; } @@ -164,6 +174,8 @@ public class Pet { * @return tags **/ @ApiModelProperty(value = "") + + @Valid public List getTags() { return tags; } @@ -182,6 +194,8 @@ public class Pet { * @return status **/ @ApiModelProperty(value = "pet status in the store") + + @Valid public StatusEnum getStatus() { return status; } diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/ReadOnlyFirst.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/ReadOnlyFirst.java index 47700659fd2d..8e79be0008d7 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/ReadOnlyFirst.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/ReadOnlyFirst.java @@ -5,7 +5,9 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * ReadOnlyFirst */ @@ -27,6 +29,8 @@ public class ReadOnlyFirst { * @return bar **/ @ApiModelProperty(readOnly = true, value = "") + + @Valid public String getBar() { return bar; } @@ -45,6 +49,8 @@ public class ReadOnlyFirst { * @return baz **/ @ApiModelProperty(value = "") + + @Valid public String getBaz() { return baz; } diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/SpecialModelName.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/SpecialModelName.java index 880d70599b0d..3cb7b04353c2 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/SpecialModelName.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/SpecialModelName.java @@ -5,7 +5,9 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * SpecialModelName */ @@ -24,6 +26,8 @@ public class SpecialModelName { * @return specialPropertyName **/ @ApiModelProperty(value = "") + + @Valid public Long getSpecialPropertyName() { return specialPropertyName; } diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/Tag.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/Tag.java index 298085317a4a..9f8f3a25234a 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/Tag.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/Tag.java @@ -5,7 +5,9 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * Tag */ @@ -27,6 +29,8 @@ public class Tag { * @return id **/ @ApiModelProperty(value = "") + + @Valid public Long getId() { return id; } @@ -45,6 +49,8 @@ public class Tag { * @return name **/ @ApiModelProperty(value = "") + + @Valid public String getName() { return name; } diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/User.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/User.java index 8e40f7e05942..501c556de270 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/User.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/User.java @@ -5,7 +5,9 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * User */ @@ -45,6 +47,8 @@ public class User { * @return id **/ @ApiModelProperty(value = "") + + @Valid public Long getId() { return id; } @@ -63,6 +67,8 @@ public class User { * @return username **/ @ApiModelProperty(value = "") + + @Valid public String getUsername() { return username; } @@ -81,6 +87,8 @@ public class User { * @return firstName **/ @ApiModelProperty(value = "") + + @Valid public String getFirstName() { return firstName; } @@ -99,6 +107,8 @@ public class User { * @return lastName **/ @ApiModelProperty(value = "") + + @Valid public String getLastName() { return lastName; } @@ -117,6 +127,8 @@ public class User { * @return email **/ @ApiModelProperty(value = "") + + @Valid public String getEmail() { return email; } @@ -135,6 +147,8 @@ public class User { * @return password **/ @ApiModelProperty(value = "") + + @Valid public String getPassword() { return password; } @@ -153,6 +167,8 @@ public class User { * @return phone **/ @ApiModelProperty(value = "") + + @Valid public String getPhone() { return phone; } @@ -171,6 +187,8 @@ public class User { * @return userStatus **/ @ApiModelProperty(value = "User Status") + + @Valid public Integer getUserStatus() { return userStatus; } diff --git a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/api/FakeApi.java b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/api/FakeApi.java index 05783d1f44be..8eefd6ed5072 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/api/FakeApi.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/api/FakeApi.java @@ -27,12 +27,11 @@ public interface FakeApi { @ApiOperation(value = "To test \"client\" model", notes = "To test \"client\" model", response = Client.class, tags={ "fake", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Client.class) }) - @RequestMapping(value = "/fake", produces = { "application/json" }, consumes = { "application/json" }, method = RequestMethod.PATCH) - ResponseEntity testClientModel(@ApiParam(value = "client model" ,required=true ) @Valid @RequestBody Client body) throws IOException; + ResponseEntity testClientModel(@ApiParam(value = "client model" ,required=true ) @Valid @RequestBody Client body, @RequestHeader("Accept") String accept) throws IOException; @ApiOperation(value = "Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 ", notes = "Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 ", response = Void.class, authorizations = { @@ -41,23 +40,21 @@ public interface FakeApi { @ApiResponses(value = { @ApiResponse(code = 400, message = "Invalid username supplied", response = Void.class), @ApiResponse(code = 404, message = "User not found", response = Void.class) }) - @RequestMapping(value = "/fake", produces = { "application/xml; charset=utf-8", "application/json; charset=utf-8" }, consumes = { "application/xml; charset=utf-8", "application/json; charset=utf-8" }, method = RequestMethod.POST) - ResponseEntity testEndpointParameters(@ApiParam(value = "None", required=true) @RequestPart(value="number", required=true) BigDecimal number,@ApiParam(value = "None", required=true) @RequestPart(value="double", required=true) Double _double,@ApiParam(value = "None", required=true) @RequestPart(value="pattern_without_delimiter", required=true) String patternWithoutDelimiter,@ApiParam(value = "None", required=true) @RequestPart(value="byte", required=true) byte[] _byte,@ApiParam(value = "None") @RequestPart(value="integer", required=false) Integer integer,@ApiParam(value = "None") @RequestPart(value="int32", required=false) Integer int32,@ApiParam(value = "None") @RequestPart(value="int64", required=false) Long int64,@ApiParam(value = "None") @RequestPart(value="float", required=false) Float _float,@ApiParam(value = "None") @RequestPart(value="string", required=false) String string,@ApiParam(value = "None") @RequestPart(value="binary", required=false) byte[] binary,@ApiParam(value = "None") @RequestPart(value="date", required=false) LocalDate date,@ApiParam(value = "None") @RequestPart(value="dateTime", required=false) DateTime dateTime,@ApiParam(value = "None") @RequestPart(value="password", required=false) String password,@ApiParam(value = "None") @RequestPart(value="callback", required=false) String paramCallback); + ResponseEntity testEndpointParameters(@ApiParam(value = "None", required=true) @RequestPart(value="number", required=true) BigDecimal number,@ApiParam(value = "None", required=true) @RequestPart(value="double", required=true) Double _double,@ApiParam(value = "None", required=true) @RequestPart(value="pattern_without_delimiter", required=true) String patternWithoutDelimiter,@ApiParam(value = "None", required=true) @RequestPart(value="byte", required=true) byte[] _byte,@ApiParam(value = "None") @RequestPart(value="integer", required=false) Integer integer,@ApiParam(value = "None") @RequestPart(value="int32", required=false) Integer int32,@ApiParam(value = "None") @RequestPart(value="int64", required=false) Long int64,@ApiParam(value = "None") @RequestPart(value="float", required=false) Float _float,@ApiParam(value = "None") @RequestPart(value="string", required=false) String string,@ApiParam(value = "None") @RequestPart(value="binary", required=false) byte[] binary,@ApiParam(value = "None") @RequestPart(value="date", required=false) LocalDate date,@ApiParam(value = "None") @RequestPart(value="dateTime", required=false) DateTime dateTime,@ApiParam(value = "None") @RequestPart(value="password", required=false) String password,@ApiParam(value = "None") @RequestPart(value="callback", required=false) String paramCallback, @RequestHeader("Accept") String accept); @ApiOperation(value = "To test enum parameters", notes = "To test enum parameters", response = Void.class, tags={ "fake", }) @ApiResponses(value = { @ApiResponse(code = 400, message = "Invalid request", response = Void.class), @ApiResponse(code = 404, message = "Not found", response = Void.class) }) - @RequestMapping(value = "/fake", produces = { "*/*" }, consumes = { "*/*" }, method = RequestMethod.GET) - ResponseEntity testEnumParameters(@ApiParam(value = "Form parameter enum test (string array)", allowableValues=">, $") @RequestPart(value="enum_form_string_array", required=false) List enumFormStringArray,@ApiParam(value = "Form parameter enum test (string)", allowableValues="_abc, -efg, (xyz)", defaultValue="-efg") @RequestPart(value="enum_form_string", required=false) String enumFormString,@ApiParam(value = "Header parameter enum test (string array)" , allowableValues=">, $") @RequestHeader(value="enum_header_string_array", required=false) List enumHeaderStringArray,@ApiParam(value = "Header parameter enum test (string)" , allowableValues="_abc, -efg, (xyz)", defaultValue="-efg") @RequestHeader(value="enum_header_string", required=false) String enumHeaderString, @ApiParam(value = "Query parameter enum test (string array)", allowableValues = ">, $") @RequestParam(value = "enum_query_string_array", required = false) List enumQueryStringArray, @ApiParam(value = "Query parameter enum test (string)", allowableValues = "_abc, -efg, (xyz)", defaultValue = "-efg") @RequestParam(value = "enum_query_string", required = false, defaultValue="-efg") String enumQueryString, @ApiParam(value = "Query parameter enum test (double)", allowableValues = "1, -2") @RequestParam(value = "enum_query_integer", required = false) Integer enumQueryInteger,@ApiParam(value = "Query parameter enum test (double)", allowableValues="1.1, -1.2") @RequestPart(value="enum_query_double", required=false) Double enumQueryDouble); + ResponseEntity testEnumParameters(@ApiParam(value = "Form parameter enum test (string array)", allowableValues=">, $") @RequestPart(value="enum_form_string_array", required=false) List enumFormStringArray,@ApiParam(value = "Form parameter enum test (string)", allowableValues="_abc, -efg, (xyz)", defaultValue="-efg") @RequestPart(value="enum_form_string", required=false) String enumFormString,@ApiParam(value = "Header parameter enum test (string array)" , allowableValues=">, $") @RequestHeader(value="enum_header_string_array", required=false) List enumHeaderStringArray,@ApiParam(value = "Header parameter enum test (string)" , allowableValues="_abc, -efg, (xyz)", defaultValue="-efg") @RequestHeader(value="enum_header_string", required=false) String enumHeaderString,@ApiParam(value = "Query parameter enum test (string array)", allowableValues = ">, $") @RequestParam(value = "enum_query_string_array", required = false) List enumQueryStringArray,@ApiParam(value = "Query parameter enum test (string)", allowableValues = "_abc, -efg, (xyz)", defaultValue = "-efg") @RequestParam(value = "enum_query_string", required = false, defaultValue="-efg") String enumQueryString,@ApiParam(value = "Query parameter enum test (double)", allowableValues = "1, -2") @RequestParam(value = "enum_query_integer", required = false) Integer enumQueryInteger,@ApiParam(value = "Query parameter enum test (double)", allowableValues="1.1, -1.2") @RequestPart(value="enum_query_double", required=false) Double enumQueryDouble, @RequestHeader("Accept") String accept); } diff --git a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/api/FakeApiController.java b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/api/FakeApiController.java index 8ed565d18ce5..855d0b198c0c 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/api/FakeApiController.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/api/FakeApiController.java @@ -16,16 +16,21 @@ import org.springframework.web.bind.annotation.RequestHeader; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestPart; import org.springframework.web.multipart.MultipartFile; -import com.fasterxml.jackson.databind.ObjectMapper; -import java.io.IOException; import java.util.List; - +import com.fasterxml.jackson.databind.ObjectMapper; +import java.io.IOException; import javax.validation.constraints.*; import javax.validation.Valid; @Controller public class FakeApiController implements FakeApi { + private final ObjectMapper objectMapper; + + public FakeApiController(ObjectMapper objectMapper) { + this.objectMapper = objectMapper; + } + private final FakeApiDelegate delegate; @org.springframework.beans.factory.annotation.Autowired @@ -33,13 +38,12 @@ public class FakeApiController implements FakeApi { this.delegate = delegate; } - @RequestHeader("Accept") - public ResponseEntity testClientModel(@ApiParam(value = "client model" ,required=true ) @Valid @RequestBody Client bodyString accept) throws IOException { + public ResponseEntity testClientModel(@ApiParam(value = "client model" ,required=true ) @Valid @RequestBody Client body, + @RequestHeader("Accept") String accept) throws IOException { // do some magic! return delegate.testClientModel(body); } - @RequestHeader("Accept") public ResponseEntity testEndpointParameters(@ApiParam(value = "None", required=true) @RequestPart(value="number", required=true) BigDecimal number, @ApiParam(value = "None", required=true) @RequestPart(value="double", required=true) Double _double, @ApiParam(value = "None", required=true) @RequestPart(value="pattern_without_delimiter", required=true) String patternWithoutDelimiter, @@ -53,20 +57,21 @@ public class FakeApiController implements FakeApi { @ApiParam(value = "None") @RequestPart(value="date", required=false) LocalDate date, @ApiParam(value = "None") @RequestPart(value="dateTime", required=false) DateTime dateTime, @ApiParam(value = "None") @RequestPart(value="password", required=false) String password, - @ApiParam(value = "None") @RequestPart(value="callback", required=false) String paramCallbackString accept) { + @ApiParam(value = "None") @RequestPart(value="callback", required=false) String paramCallback, + @RequestHeader("Accept") String accept) { // do some magic! return delegate.testEndpointParameters(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, string, binary, date, dateTime, password, paramCallback); } - @RequestHeader("Accept") public ResponseEntity testEnumParameters(@ApiParam(value = "Form parameter enum test (string array)", allowableValues=">, $") @RequestPart(value="enum_form_string_array", required=false) List enumFormStringArray, @ApiParam(value = "Form parameter enum test (string)", allowableValues="_abc, -efg, (xyz)", defaultValue="-efg") @RequestPart(value="enum_form_string", required=false) String enumFormString, @ApiParam(value = "Header parameter enum test (string array)" , allowableValues=">, $") @RequestHeader(value="enum_header_string_array", required=false) List enumHeaderStringArray, @ApiParam(value = "Header parameter enum test (string)" , allowableValues="_abc, -efg, (xyz)", defaultValue="-efg") @RequestHeader(value="enum_header_string", required=false) String enumHeaderString, - @ApiParam(value = "Query parameter enum test (string array)", allowableValues = ">, $") @RequestParam(value = "enum_query_string_array", required = false) List enumQueryStringArray, - @ApiParam(value = "Query parameter enum test (string)", allowableValues = "_abc, -efg, (xyz)", defaultValue = "-efg") @RequestParam(value = "enum_query_string", required = false, defaultValue="-efg") String enumQueryString, - @ApiParam(value = "Query parameter enum test (double)", allowableValues = "1, -2") @RequestParam(value = "enum_query_integer", required = false) Integer enumQueryInteger, - @ApiParam(value = "Query parameter enum test (double)", allowableValues="1.1, -1.2") @RequestPart(value="enum_query_double", required=false) Double enumQueryDoubleString accept) { + @ApiParam(value = "Query parameter enum test (string array)", allowableValues = ">, $") @RequestParam(value = "enum_query_string_array", required = false) List enumQueryStringArray, + @ApiParam(value = "Query parameter enum test (string)", allowableValues = "_abc, -efg, (xyz)", defaultValue = "-efg") @RequestParam(value = "enum_query_string", required = false, defaultValue="-efg") String enumQueryString, + @ApiParam(value = "Query parameter enum test (double)", allowableValues = "1, -2") @RequestParam(value = "enum_query_integer", required = false) Integer enumQueryInteger, + @ApiParam(value = "Query parameter enum test (double)", allowableValues="1.1, -1.2") @RequestPart(value="enum_query_double", required=false) Double enumQueryDouble, + @RequestHeader("Accept") String accept) { // do some magic! return delegate.testEnumParameters(enumFormStringArray, enumFormString, enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble); } diff --git a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/api/PetApi.java b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/api/PetApi.java index 59846383b866..1227aedbbd7d 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/api/PetApi.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/api/PetApi.java @@ -31,12 +31,11 @@ public interface PetApi { }, tags={ "pet", }) @ApiResponses(value = { @ApiResponse(code = 405, message = "Invalid input", response = Void.class) }) - @RequestMapping(value = "/pet", produces = { "application/xml", "application/json" }, consumes = { "application/json", "application/xml" }, method = RequestMethod.POST) - ResponseEntity addPet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody Pet body); + ResponseEntity addPet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody Pet body, @RequestHeader("Accept") String accept); @ApiOperation(value = "Deletes a pet", notes = "", response = Void.class, authorizations = { @@ -47,11 +46,10 @@ public interface PetApi { }, tags={ "pet", }) @ApiResponses(value = { @ApiResponse(code = 400, message = "Invalid pet value", response = Void.class) }) - @RequestMapping(value = "/pet/{petId}", produces = { "application/xml", "application/json" }, method = RequestMethod.DELETE) - ResponseEntity deletePet(@ApiParam(value = "Pet id to delete",required=true ) @PathVariable("petId") Long petId,@ApiParam(value = "" ) @RequestHeader(value="api_key", required=false) String apiKey); + ResponseEntity deletePet(@ApiParam(value = "Pet id to delete",required=true ) @PathVariable("petId") Long petId,@ApiParam(value = "" ) @RequestHeader(value="api_key", required=false) String apiKey, @RequestHeader("Accept") String accept); @ApiOperation(value = "Finds Pets by status", notes = "Multiple status values can be provided with comma separated strings", response = Pet.class, responseContainer = "List", authorizations = { @@ -63,11 +61,10 @@ public interface PetApi { @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Pet.class), @ApiResponse(code = 400, message = "Invalid status value", response = Pet.class) }) - @RequestMapping(value = "/pet/findByStatus", produces = { "application/xml", "application/json" }, method = RequestMethod.GET) - ResponseEntity> findPetsByStatus( @NotNull @ApiParam(value = "Status values that need to be considered for filter", required = true, allowableValues = "available, pending, sold") @RequestParam(value = "status", required = true) List status) throws IOException; + ResponseEntity> findPetsByStatus( @NotNull@ApiParam(value = "Status values that need to be considered for filter", required = true, allowableValues = "available, pending, sold") @RequestParam(value = "status", required = true) List status, @RequestHeader("Accept") String accept) throws IOException; @ApiOperation(value = "Finds Pets by tags", notes = "Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.", response = Pet.class, responseContainer = "List", authorizations = { @@ -79,11 +76,10 @@ public interface PetApi { @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Pet.class), @ApiResponse(code = 400, message = "Invalid tag value", response = Pet.class) }) - @RequestMapping(value = "/pet/findByTags", produces = { "application/xml", "application/json" }, method = RequestMethod.GET) - ResponseEntity> findPetsByTags( @NotNull @ApiParam(value = "Tags to filter by", required = true) @RequestParam(value = "tags", required = true) List tags) throws IOException; + ResponseEntity> findPetsByTags( @NotNull@ApiParam(value = "Tags to filter by", required = true) @RequestParam(value = "tags", required = true) List tags, @RequestHeader("Accept") String accept) throws IOException; @ApiOperation(value = "Find pet by ID", notes = "Returns a single pet", response = Pet.class, authorizations = { @@ -93,11 +89,10 @@ public interface PetApi { @ApiResponse(code = 200, message = "successful operation", response = Pet.class), @ApiResponse(code = 400, message = "Invalid ID supplied", response = Pet.class), @ApiResponse(code = 404, message = "Pet not found", response = Pet.class) }) - @RequestMapping(value = "/pet/{petId}", produces = { "application/xml", "application/json" }, method = RequestMethod.GET) - ResponseEntity getPetById(@ApiParam(value = "ID of pet to return",required=true ) @PathVariable("petId") Long petId) throws IOException; + ResponseEntity getPetById(@ApiParam(value = "ID of pet to return",required=true ) @PathVariable("petId") Long petId, @RequestHeader("Accept") String accept) throws IOException; @ApiOperation(value = "Update an existing pet", notes = "", response = Void.class, authorizations = { @@ -110,12 +105,11 @@ public interface PetApi { @ApiResponse(code = 400, message = "Invalid ID supplied", response = Void.class), @ApiResponse(code = 404, message = "Pet not found", response = Void.class), @ApiResponse(code = 405, message = "Validation exception", response = Void.class) }) - @RequestMapping(value = "/pet", produces = { "application/xml", "application/json" }, consumes = { "application/json", "application/xml" }, method = RequestMethod.PUT) - ResponseEntity updatePet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody Pet body); + ResponseEntity updatePet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody Pet body, @RequestHeader("Accept") String accept); @ApiOperation(value = "Updates a pet in the store with form data", notes = "", response = Void.class, authorizations = { @@ -126,12 +120,11 @@ public interface PetApi { }, tags={ "pet", }) @ApiResponses(value = { @ApiResponse(code = 405, message = "Invalid input", response = Void.class) }) - @RequestMapping(value = "/pet/{petId}", produces = { "application/xml", "application/json" }, consumes = { "application/x-www-form-urlencoded" }, method = RequestMethod.POST) - ResponseEntity updatePetWithForm(@ApiParam(value = "ID of pet that needs to be updated",required=true ) @PathVariable("petId") Long petId,@ApiParam(value = "Updated name of the pet") @RequestPart(value="name", required=false) String name,@ApiParam(value = "Updated status of the pet") @RequestPart(value="status", required=false) String status); + ResponseEntity updatePetWithForm(@ApiParam(value = "ID of pet that needs to be updated",required=true ) @PathVariable("petId") Long petId,@ApiParam(value = "Updated name of the pet") @RequestPart(value="name", required=false) String name,@ApiParam(value = "Updated status of the pet") @RequestPart(value="status", required=false) String status, @RequestHeader("Accept") String accept); @ApiOperation(value = "uploads an image", notes = "", response = ModelApiResponse.class, authorizations = { @@ -142,11 +135,10 @@ public interface PetApi { }, tags={ "pet", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = ModelApiResponse.class) }) - @RequestMapping(value = "/pet/{petId}/uploadImage", produces = { "application/json" }, consumes = { "multipart/form-data" }, method = RequestMethod.POST) - ResponseEntity uploadFile(@ApiParam(value = "ID of pet to update",required=true ) @PathVariable("petId") Long petId,@ApiParam(value = "Additional data to pass to server") @RequestPart(value="additionalMetadata", required=false) String additionalMetadata,@ApiParam(value = "file detail") @RequestPart("file") MultipartFile file) throws IOException; + ResponseEntity uploadFile(@ApiParam(value = "ID of pet to update",required=true ) @PathVariable("petId") Long petId,@ApiParam(value = "Additional data to pass to server") @RequestPart(value="additionalMetadata", required=false) String additionalMetadata,@ApiParam(value = "file detail") @RequestPart("file") MultipartFile file, @RequestHeader("Accept") String accept) throws IOException; } diff --git a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/api/PetApiController.java b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/api/PetApiController.java index 4a9ec7142b14..7adec37e9ba7 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/api/PetApiController.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/api/PetApiController.java @@ -15,16 +15,21 @@ import org.springframework.web.bind.annotation.RequestHeader; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestPart; import org.springframework.web.multipart.MultipartFile; -import com.fasterxml.jackson.databind.ObjectMapper; -import java.io.IOException; import java.util.List; - +import com.fasterxml.jackson.databind.ObjectMapper; +import java.io.IOException; import javax.validation.constraints.*; import javax.validation.Valid; @Controller public class PetApiController implements PetApi { + private final ObjectMapper objectMapper; + + public PetApiController(ObjectMapper objectMapper) { + this.objectMapper = objectMapper; + } + private final PetApiDelegate delegate; @org.springframework.beans.factory.annotation.Autowired @@ -32,55 +37,55 @@ public class PetApiController implements PetApi { this.delegate = delegate; } - @RequestHeader("Accept") - public ResponseEntity addPet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody Pet bodyString accept) { + public ResponseEntity addPet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody Pet body, + @RequestHeader("Accept") String accept) { // do some magic! return delegate.addPet(body); } - @RequestHeader("Accept") public ResponseEntity deletePet(@ApiParam(value = "Pet id to delete",required=true ) @PathVariable("petId") Long petId, - @ApiParam(value = "" ) @RequestHeader(value="api_key", required=false) String apiKeyString accept) { + @ApiParam(value = "" ) @RequestHeader(value="api_key", required=false) String apiKey, + @RequestHeader("Accept") String accept) { // do some magic! return delegate.deletePet(petId, apiKey); } - @RequestHeader("Accept") - public ResponseEntity> findPetsByStatus( @NotNull @ApiParam(value = "Status values that need to be considered for filter", required = true, allowableValues = "available, pending, sold") @RequestParam(value = "status", required = true) List statusString accept) throws IOException { + public ResponseEntity> findPetsByStatus( @NotNull@ApiParam(value = "Status values that need to be considered for filter", required = true, allowableValues = "available, pending, sold") @RequestParam(value = "status", required = true) List status, + @RequestHeader("Accept") String accept) throws IOException { // do some magic! return delegate.findPetsByStatus(status); } - @RequestHeader("Accept") - public ResponseEntity> findPetsByTags( @NotNull @ApiParam(value = "Tags to filter by", required = true) @RequestParam(value = "tags", required = true) List tagsString accept) throws IOException { + public ResponseEntity> findPetsByTags( @NotNull@ApiParam(value = "Tags to filter by", required = true) @RequestParam(value = "tags", required = true) List tags, + @RequestHeader("Accept") String accept) throws IOException { // do some magic! return delegate.findPetsByTags(tags); } - @RequestHeader("Accept") - public ResponseEntity getPetById(@ApiParam(value = "ID of pet to return",required=true ) @PathVariable("petId") Long petIdString accept) throws IOException { + public ResponseEntity getPetById(@ApiParam(value = "ID of pet to return",required=true ) @PathVariable("petId") Long petId, + @RequestHeader("Accept") String accept) throws IOException { // do some magic! return delegate.getPetById(petId); } - @RequestHeader("Accept") - public ResponseEntity updatePet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody Pet bodyString accept) { + public ResponseEntity updatePet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody Pet body, + @RequestHeader("Accept") String accept) { // do some magic! return delegate.updatePet(body); } - @RequestHeader("Accept") public ResponseEntity updatePetWithForm(@ApiParam(value = "ID of pet that needs to be updated",required=true ) @PathVariable("petId") Long petId, @ApiParam(value = "Updated name of the pet") @RequestPart(value="name", required=false) String name, - @ApiParam(value = "Updated status of the pet") @RequestPart(value="status", required=false) String statusString accept) { + @ApiParam(value = "Updated status of the pet") @RequestPart(value="status", required=false) String status, + @RequestHeader("Accept") String accept) { // do some magic! return delegate.updatePetWithForm(petId, name, status); } - @RequestHeader("Accept") public ResponseEntity uploadFile(@ApiParam(value = "ID of pet to update",required=true ) @PathVariable("petId") Long petId, @ApiParam(value = "Additional data to pass to server") @RequestPart(value="additionalMetadata", required=false) String additionalMetadata, - @ApiParam(value = "file detail") @RequestPart("file") MultipartFile fileString accept) throws IOException { + @ApiParam(value = "file detail") @RequestPart("file") MultipartFile file, + @RequestHeader("Accept") String accept) throws IOException { // do some magic! return delegate.uploadFile(petId, additionalMetadata, file); } diff --git a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/api/StoreApi.java b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/api/StoreApi.java index 7301912a9c85..fb8f3d706f55 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/api/StoreApi.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/api/StoreApi.java @@ -26,11 +26,10 @@ public interface StoreApi { @ApiResponses(value = { @ApiResponse(code = 400, message = "Invalid ID supplied", response = Void.class), @ApiResponse(code = 404, message = "Order not found", response = Void.class) }) - @RequestMapping(value = "/store/order/{order_id}", produces = { "application/xml", "application/json" }, method = RequestMethod.DELETE) - ResponseEntity deleteOrder(@ApiParam(value = "ID of the order that needs to be deleted",required=true ) @PathVariable("order_id") String orderId); + ResponseEntity deleteOrder(@ApiParam(value = "ID of the order that needs to be deleted",required=true ) @PathVariable("order_id") String orderId, @RequestHeader("Accept") String accept); @ApiOperation(value = "Returns pet inventories by status", notes = "Returns a map of status codes to quantities", response = Integer.class, responseContainer = "Map", authorizations = { @@ -38,11 +37,10 @@ public interface StoreApi { }, tags={ "store", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Integer.class) }) - @RequestMapping(value = "/store/inventory", produces = { "application/json" }, method = RequestMethod.GET) - ResponseEntity> getInventory() throws IOException; + ResponseEntity> getInventory( @RequestHeader("Accept") String accept) throws IOException; @ApiOperation(value = "Find purchase order by ID", notes = "For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions", response = Order.class, tags={ "store", }) @@ -50,21 +48,19 @@ public interface StoreApi { @ApiResponse(code = 200, message = "successful operation", response = Order.class), @ApiResponse(code = 400, message = "Invalid ID supplied", response = Order.class), @ApiResponse(code = 404, message = "Order not found", response = Order.class) }) - @RequestMapping(value = "/store/order/{order_id}", produces = { "application/xml", "application/json" }, method = RequestMethod.GET) - ResponseEntity getOrderById( @Min(1) @Max(5)@ApiParam(value = "ID of pet that needs to be fetched",required=true ) @PathVariable("order_id") Long orderId) throws IOException; + ResponseEntity getOrderById( @Min(1) @Max(5)@ApiParam(value = "ID of pet that needs to be fetched",required=true ) @PathVariable("order_id") Long orderId, @RequestHeader("Accept") String accept) throws IOException; @ApiOperation(value = "Place an order for a pet", notes = "", response = Order.class, tags={ "store", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Order.class), @ApiResponse(code = 400, message = "Invalid Order", response = Order.class) }) - @RequestMapping(value = "/store/order", produces = { "application/xml", "application/json" }, method = RequestMethod.POST) - ResponseEntity placeOrder(@ApiParam(value = "order placed for purchasing the pet" ,required=true ) @Valid @RequestBody Order body) throws IOException; + ResponseEntity placeOrder(@ApiParam(value = "order placed for purchasing the pet" ,required=true ) @Valid @RequestBody Order body, @RequestHeader("Accept") String accept) throws IOException; } diff --git a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/api/StoreApiController.java b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/api/StoreApiController.java index 2985da155286..4d0ff13f995e 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/api/StoreApiController.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/api/StoreApiController.java @@ -14,16 +14,21 @@ import org.springframework.web.bind.annotation.RequestHeader; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestPart; import org.springframework.web.multipart.MultipartFile; -import com.fasterxml.jackson.databind.ObjectMapper; -import java.io.IOException; import java.util.List; - +import com.fasterxml.jackson.databind.ObjectMapper; +import java.io.IOException; import javax.validation.constraints.*; import javax.validation.Valid; @Controller public class StoreApiController implements StoreApi { + private final ObjectMapper objectMapper; + + public StoreApiController(ObjectMapper objectMapper) { + this.objectMapper = objectMapper; + } + private final StoreApiDelegate delegate; @org.springframework.beans.factory.annotation.Autowired @@ -31,26 +36,25 @@ public class StoreApiController implements StoreApi { this.delegate = delegate; } - @RequestHeader("Accept") - public ResponseEntity deleteOrder(@ApiParam(value = "ID of the order that needs to be deleted",required=true ) @PathVariable("order_id") String orderIdString accept) { + public ResponseEntity deleteOrder(@ApiParam(value = "ID of the order that needs to be deleted",required=true ) @PathVariable("order_id") String orderId, + @RequestHeader("Accept") String accept) { // do some magic! return delegate.deleteOrder(orderId); } - @RequestHeader("Accept") - public ResponseEntity> getInventory(String accept) throws IOException { + public ResponseEntity> getInventory(@RequestHeader("Accept") String accept) throws IOException { // do some magic! return delegate.getInventory(); } - @RequestHeader("Accept") - public ResponseEntity getOrderById( @Min(1) @Max(5)@ApiParam(value = "ID of pet that needs to be fetched",required=true ) @PathVariable("order_id") Long orderIdString accept) throws IOException { + public ResponseEntity getOrderById( @Min(1) @Max(5)@ApiParam(value = "ID of pet that needs to be fetched",required=true ) @PathVariable("order_id") Long orderId, + @RequestHeader("Accept") String accept) throws IOException { // do some magic! return delegate.getOrderById(orderId); } - @RequestHeader("Accept") - public ResponseEntity placeOrder(@ApiParam(value = "order placed for purchasing the pet" ,required=true ) @Valid @RequestBody Order bodyString accept) throws IOException { + public ResponseEntity placeOrder(@ApiParam(value = "order placed for purchasing the pet" ,required=true ) @Valid @RequestBody Order body, + @RequestHeader("Accept") String accept) throws IOException { // do some magic! return delegate.placeOrder(body); } diff --git a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/api/UserApi.java b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/api/UserApi.java index 7d6729c23b97..adc0d21d30b1 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/api/UserApi.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/api/UserApi.java @@ -25,42 +25,38 @@ public interface UserApi { @ApiOperation(value = "Create user", notes = "This can only be done by the logged in user.", response = Void.class, tags={ "user", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Void.class) }) - @RequestMapping(value = "/user", produces = { "application/xml", "application/json" }, method = RequestMethod.POST) - ResponseEntity createUser(@ApiParam(value = "Created user object" ,required=true ) @Valid @RequestBody User body); + ResponseEntity createUser(@ApiParam(value = "Created user object" ,required=true ) @Valid @RequestBody User body, @RequestHeader("Accept") String accept); @ApiOperation(value = "Creates list of users with given input array", notes = "", response = Void.class, tags={ "user", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Void.class) }) - @RequestMapping(value = "/user/createWithArray", produces = { "application/xml", "application/json" }, method = RequestMethod.POST) - ResponseEntity createUsersWithArrayInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody List body); + ResponseEntity createUsersWithArrayInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody List body, @RequestHeader("Accept") String accept); @ApiOperation(value = "Creates list of users with given input array", notes = "", response = Void.class, tags={ "user", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Void.class) }) - @RequestMapping(value = "/user/createWithList", produces = { "application/xml", "application/json" }, method = RequestMethod.POST) - ResponseEntity createUsersWithListInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody List body); + ResponseEntity createUsersWithListInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody List body, @RequestHeader("Accept") String accept); @ApiOperation(value = "Delete user", notes = "This can only be done by the logged in user.", response = Void.class, tags={ "user", }) @ApiResponses(value = { @ApiResponse(code = 400, message = "Invalid username supplied", response = Void.class), @ApiResponse(code = 404, message = "User not found", response = Void.class) }) - @RequestMapping(value = "/user/{username}", produces = { "application/xml", "application/json" }, method = RequestMethod.DELETE) - ResponseEntity deleteUser(@ApiParam(value = "The name that needs to be deleted",required=true ) @PathVariable("username") String username); + ResponseEntity deleteUser(@ApiParam(value = "The name that needs to be deleted",required=true ) @PathVariable("username") String username, @RequestHeader("Accept") String accept); @ApiOperation(value = "Get user by user name", notes = "", response = User.class, tags={ "user", }) @@ -68,42 +64,38 @@ public interface UserApi { @ApiResponse(code = 200, message = "successful operation", response = User.class), @ApiResponse(code = 400, message = "Invalid username supplied", response = User.class), @ApiResponse(code = 404, message = "User not found", response = User.class) }) - @RequestMapping(value = "/user/{username}", produces = { "application/xml", "application/json" }, method = RequestMethod.GET) - ResponseEntity getUserByName(@ApiParam(value = "The name that needs to be fetched. Use user1 for testing. ",required=true ) @PathVariable("username") String username) throws IOException; + ResponseEntity getUserByName(@ApiParam(value = "The name that needs to be fetched. Use user1 for testing. ",required=true ) @PathVariable("username") String username, @RequestHeader("Accept") String accept) throws IOException; @ApiOperation(value = "Logs user into the system", notes = "", response = String.class, tags={ "user", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = String.class), @ApiResponse(code = 400, message = "Invalid username/password supplied", response = String.class) }) - @RequestMapping(value = "/user/login", produces = { "application/xml", "application/json" }, method = RequestMethod.GET) - ResponseEntity loginUser( @NotNull @ApiParam(value = "The user name for login", required = true) @RequestParam(value = "username", required = true) String username, @NotNull @ApiParam(value = "The password for login in clear text", required = true) @RequestParam(value = "password", required = true) String password) throws IOException; + ResponseEntity loginUser( @NotNull@ApiParam(value = "The user name for login", required = true) @RequestParam(value = "username", required = true) String username, @NotNull@ApiParam(value = "The password for login in clear text", required = true) @RequestParam(value = "password", required = true) String password, @RequestHeader("Accept") String accept) throws IOException; @ApiOperation(value = "Logs out current logged in user session", notes = "", response = Void.class, tags={ "user", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Void.class) }) - @RequestMapping(value = "/user/logout", produces = { "application/xml", "application/json" }, method = RequestMethod.GET) - ResponseEntity logoutUser(); + ResponseEntity logoutUser( @RequestHeader("Accept") String accept); @ApiOperation(value = "Updated user", notes = "This can only be done by the logged in user.", response = Void.class, tags={ "user", }) @ApiResponses(value = { @ApiResponse(code = 400, message = "Invalid user supplied", response = Void.class), @ApiResponse(code = 404, message = "User not found", response = Void.class) }) - @RequestMapping(value = "/user/{username}", produces = { "application/xml", "application/json" }, method = RequestMethod.PUT) - ResponseEntity updateUser(@ApiParam(value = "name that need to be deleted",required=true ) @PathVariable("username") String username,@ApiParam(value = "Updated user object" ,required=true ) @Valid @RequestBody User body); + ResponseEntity updateUser(@ApiParam(value = "name that need to be deleted",required=true ) @PathVariable("username") String username,@ApiParam(value = "Updated user object" ,required=true ) @Valid @RequestBody User body, @RequestHeader("Accept") String accept); } diff --git a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/api/UserApiController.java b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/api/UserApiController.java index cc95ebc5af80..0264f9026a4d 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/api/UserApiController.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/api/UserApiController.java @@ -14,16 +14,21 @@ import org.springframework.web.bind.annotation.RequestHeader; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestPart; import org.springframework.web.multipart.MultipartFile; -import com.fasterxml.jackson.databind.ObjectMapper; -import java.io.IOException; import java.util.List; - +import com.fasterxml.jackson.databind.ObjectMapper; +import java.io.IOException; import javax.validation.constraints.*; import javax.validation.Valid; @Controller public class UserApiController implements UserApi { + private final ObjectMapper objectMapper; + + public UserApiController(ObjectMapper objectMapper) { + this.objectMapper = objectMapper; + } + private final UserApiDelegate delegate; @org.springframework.beans.factory.annotation.Autowired @@ -31,52 +36,51 @@ public class UserApiController implements UserApi { this.delegate = delegate; } - @RequestHeader("Accept") - public ResponseEntity createUser(@ApiParam(value = "Created user object" ,required=true ) @Valid @RequestBody User bodyString accept) { + public ResponseEntity createUser(@ApiParam(value = "Created user object" ,required=true ) @Valid @RequestBody User body, + @RequestHeader("Accept") String accept) { // do some magic! return delegate.createUser(body); } - @RequestHeader("Accept") - public ResponseEntity createUsersWithArrayInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody List bodyString accept) { + public ResponseEntity createUsersWithArrayInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody List body, + @RequestHeader("Accept") String accept) { // do some magic! return delegate.createUsersWithArrayInput(body); } - @RequestHeader("Accept") - public ResponseEntity createUsersWithListInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody List bodyString accept) { + public ResponseEntity createUsersWithListInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody List body, + @RequestHeader("Accept") String accept) { // do some magic! return delegate.createUsersWithListInput(body); } - @RequestHeader("Accept") - public ResponseEntity deleteUser(@ApiParam(value = "The name that needs to be deleted",required=true ) @PathVariable("username") String usernameString accept) { + public ResponseEntity deleteUser(@ApiParam(value = "The name that needs to be deleted",required=true ) @PathVariable("username") String username, + @RequestHeader("Accept") String accept) { // do some magic! return delegate.deleteUser(username); } - @RequestHeader("Accept") - public ResponseEntity getUserByName(@ApiParam(value = "The name that needs to be fetched. Use user1 for testing. ",required=true ) @PathVariable("username") String usernameString accept) throws IOException { + public ResponseEntity getUserByName(@ApiParam(value = "The name that needs to be fetched. Use user1 for testing. ",required=true ) @PathVariable("username") String username, + @RequestHeader("Accept") String accept) throws IOException { // do some magic! return delegate.getUserByName(username); } - @RequestHeader("Accept") - public ResponseEntity loginUser( @NotNull @ApiParam(value = "The user name for login", required = true) @RequestParam(value = "username", required = true) String username, - @NotNull @ApiParam(value = "The password for login in clear text", required = true) @RequestParam(value = "password", required = true) String passwordString accept) throws IOException { + public ResponseEntity loginUser( @NotNull@ApiParam(value = "The user name for login", required = true) @RequestParam(value = "username", required = true) String username, + @NotNull@ApiParam(value = "The password for login in clear text", required = true) @RequestParam(value = "password", required = true) String password, + @RequestHeader("Accept") String accept) throws IOException { // do some magic! return delegate.loginUser(username, password); } - @RequestHeader("Accept") - public ResponseEntity logoutUser(String accept) { + public ResponseEntity logoutUser(@RequestHeader("Accept") String accept) { // do some magic! return delegate.logoutUser(); } - @RequestHeader("Accept") public ResponseEntity updateUser(@ApiParam(value = "name that need to be deleted",required=true ) @PathVariable("username") String username, - @ApiParam(value = "Updated user object" ,required=true ) @Valid @RequestBody User bodyString accept) { + @ApiParam(value = "Updated user object" ,required=true ) @Valid @RequestBody User body, + @RequestHeader("Accept") String accept) { // do some magic! return delegate.updateUser(username, body); } diff --git a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/AdditionalPropertiesClass.java b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/AdditionalPropertiesClass.java index f4cfcadae519..80be4236b0d6 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/AdditionalPropertiesClass.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/AdditionalPropertiesClass.java @@ -8,7 +8,9 @@ import io.swagger.annotations.ApiModelProperty; import java.util.HashMap; import java.util.List; import java.util.Map; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * AdditionalPropertiesClass */ @@ -38,6 +40,8 @@ public class AdditionalPropertiesClass { * @return mapProperty **/ @ApiModelProperty(value = "") + + @Valid public Map getMapProperty() { return mapProperty; } @@ -64,6 +68,8 @@ public class AdditionalPropertiesClass { * @return mapOfMapProperty **/ @ApiModelProperty(value = "") + + @Valid public Map> getMapOfMapProperty() { return mapOfMapProperty; } diff --git a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/Animal.java b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/Animal.java index a218f0b5542f..bc957d1c8038 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/Animal.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/Animal.java @@ -7,7 +7,9 @@ import com.fasterxml.jackson.annotation.JsonSubTypes; import com.fasterxml.jackson.annotation.JsonTypeInfo; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * Animal */ @@ -35,6 +37,8 @@ public class Animal { **/ @ApiModelProperty(required = true, value = "") @NotNull + + @Valid public String getClassName() { return className; } @@ -53,6 +57,8 @@ public class Animal { * @return color **/ @ApiModelProperty(value = "") + + @Valid public String getColor() { return color; } diff --git a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/AnimalFarm.java b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/AnimalFarm.java index 33dc04699af5..9fa4159f2032 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/AnimalFarm.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/AnimalFarm.java @@ -4,7 +4,9 @@ import java.util.Objects; import io.swagger.model.Animal; import java.util.ArrayList; import java.util.List; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * AnimalFarm */ diff --git a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/ArrayOfArrayOfNumberOnly.java b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/ArrayOfArrayOfNumberOnly.java index 8f975d8feda3..f9dca7d60b5f 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/ArrayOfArrayOfNumberOnly.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/ArrayOfArrayOfNumberOnly.java @@ -8,7 +8,9 @@ import io.swagger.annotations.ApiModelProperty; import java.math.BigDecimal; import java.util.ArrayList; import java.util.List; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * ArrayOfArrayOfNumberOnly */ @@ -35,6 +37,8 @@ public class ArrayOfArrayOfNumberOnly { * @return arrayArrayNumber **/ @ApiModelProperty(value = "") + + @Valid public List> getArrayArrayNumber() { return arrayArrayNumber; } diff --git a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/ArrayOfNumberOnly.java b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/ArrayOfNumberOnly.java index 2c5560085542..e9c8a313be0c 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/ArrayOfNumberOnly.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/ArrayOfNumberOnly.java @@ -8,7 +8,9 @@ import io.swagger.annotations.ApiModelProperty; import java.math.BigDecimal; import java.util.ArrayList; import java.util.List; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * ArrayOfNumberOnly */ @@ -35,6 +37,8 @@ public class ArrayOfNumberOnly { * @return arrayNumber **/ @ApiModelProperty(value = "") + + @Valid public List getArrayNumber() { return arrayNumber; } diff --git a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/ArrayTest.java b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/ArrayTest.java index 664e319cd357..78c35d3c63a0 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/ArrayTest.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/ArrayTest.java @@ -8,7 +8,9 @@ import io.swagger.annotations.ApiModelProperty; import io.swagger.model.ReadOnlyFirst; import java.util.ArrayList; import java.util.List; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * ArrayTest */ @@ -41,6 +43,8 @@ public class ArrayTest { * @return arrayOfString **/ @ApiModelProperty(value = "") + + @Valid public List getArrayOfString() { return arrayOfString; } @@ -67,6 +71,8 @@ public class ArrayTest { * @return arrayArrayOfInteger **/ @ApiModelProperty(value = "") + + @Valid public List> getArrayArrayOfInteger() { return arrayArrayOfInteger; } @@ -93,6 +99,8 @@ public class ArrayTest { * @return arrayArrayOfModel **/ @ApiModelProperty(value = "") + + @Valid public List> getArrayArrayOfModel() { return arrayArrayOfModel; } diff --git a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/Capitalization.java b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/Capitalization.java index d7ad5642ccff..93533c288221 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/Capitalization.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/Capitalization.java @@ -5,7 +5,9 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * Capitalization */ @@ -39,6 +41,8 @@ public class Capitalization { * @return smallCamel **/ @ApiModelProperty(value = "") + + @Valid public String getSmallCamel() { return smallCamel; } @@ -57,6 +61,8 @@ public class Capitalization { * @return capitalCamel **/ @ApiModelProperty(value = "") + + @Valid public String getCapitalCamel() { return capitalCamel; } @@ -75,6 +81,8 @@ public class Capitalization { * @return smallSnake **/ @ApiModelProperty(value = "") + + @Valid public String getSmallSnake() { return smallSnake; } @@ -93,6 +101,8 @@ public class Capitalization { * @return capitalSnake **/ @ApiModelProperty(value = "") + + @Valid public String getCapitalSnake() { return capitalSnake; } @@ -111,6 +121,8 @@ public class Capitalization { * @return scAETHFlowPoints **/ @ApiModelProperty(value = "") + + @Valid public String getScAETHFlowPoints() { return scAETHFlowPoints; } @@ -129,6 +141,8 @@ public class Capitalization { * @return ATT_NAME **/ @ApiModelProperty(value = "Name of the pet ") + + @Valid public String getATTNAME() { return ATT_NAME; } diff --git a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/Cat.java b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/Cat.java index 747e5dc0c7e1..edcbc354be61 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/Cat.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/Cat.java @@ -6,7 +6,9 @@ import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import io.swagger.model.Animal; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * Cat */ @@ -25,6 +27,8 @@ public class Cat extends Animal { * @return declawed **/ @ApiModelProperty(value = "") + + @Valid public Boolean getDeclawed() { return declawed; } diff --git a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/Category.java b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/Category.java index 9629da6500ed..6dd9cb7a2ad1 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/Category.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/Category.java @@ -5,7 +5,9 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * Category */ @@ -27,6 +29,8 @@ public class Category { * @return id **/ @ApiModelProperty(value = "") + + @Valid public Long getId() { return id; } @@ -45,6 +49,8 @@ public class Category { * @return name **/ @ApiModelProperty(value = "") + + @Valid public String getName() { return name; } diff --git a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/ClassModel.java b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/ClassModel.java index d69acffefa89..6a6379f5b607 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/ClassModel.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/ClassModel.java @@ -5,7 +5,9 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * Model for testing model with \"_class\" property */ @@ -25,6 +27,8 @@ public class ClassModel { * @return propertyClass **/ @ApiModelProperty(value = "") + + @Valid public String getPropertyClass() { return propertyClass; } diff --git a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/Client.java b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/Client.java index f9cec5a225e7..3b8d16cabf2c 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/Client.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/Client.java @@ -5,7 +5,9 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * Client */ @@ -24,6 +26,8 @@ public class Client { * @return client **/ @ApiModelProperty(value = "") + + @Valid public String getClient() { return client; } diff --git a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/Dog.java b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/Dog.java index 9057e840fc30..513131a9fa79 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/Dog.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/Dog.java @@ -6,7 +6,9 @@ import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import io.swagger.model.Animal; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * Dog */ @@ -25,6 +27,8 @@ public class Dog extends Animal { * @return breed **/ @ApiModelProperty(value = "") + + @Valid public String getBreed() { return breed; } diff --git a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/EnumArrays.java b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/EnumArrays.java index f904035e482c..bbf4a3036e94 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/EnumArrays.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/EnumArrays.java @@ -8,7 +8,9 @@ import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import java.util.ArrayList; import java.util.List; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * EnumArrays */ @@ -92,6 +94,8 @@ public class EnumArrays { * @return justSymbol **/ @ApiModelProperty(value = "") + + @Valid public JustSymbolEnum getJustSymbol() { return justSymbol; } @@ -118,6 +122,8 @@ public class EnumArrays { * @return arrayEnum **/ @ApiModelProperty(value = "") + + @Valid public List getArrayEnum() { return arrayEnum; } diff --git a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/EnumClass.java b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/EnumClass.java index cdfc0933c3e1..4cfbe4b9fcf5 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/EnumClass.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/EnumClass.java @@ -2,7 +2,9 @@ package io.swagger.model; import java.util.Objects; import com.fasterxml.jackson.annotation.JsonValue; +import javax.validation.Valid; import javax.validation.constraints.*; + import com.fasterxml.jackson.annotation.JsonCreator; /** diff --git a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/EnumTest.java b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/EnumTest.java index 9f2a0275a6aa..c7e4793cdf73 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/EnumTest.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/EnumTest.java @@ -7,7 +7,9 @@ import com.fasterxml.jackson.annotation.JsonValue; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import io.swagger.model.OuterEnum; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * EnumTest */ @@ -130,6 +132,8 @@ public class EnumTest { * @return enumString **/ @ApiModelProperty(value = "") + + @Valid public EnumStringEnum getEnumString() { return enumString; } @@ -148,6 +152,8 @@ public class EnumTest { * @return enumInteger **/ @ApiModelProperty(value = "") + + @Valid public EnumIntegerEnum getEnumInteger() { return enumInteger; } @@ -166,6 +172,8 @@ public class EnumTest { * @return enumNumber **/ @ApiModelProperty(value = "") + + @Valid public EnumNumberEnum getEnumNumber() { return enumNumber; } @@ -184,6 +192,8 @@ public class EnumTest { * @return outerEnum **/ @ApiModelProperty(value = "") + + @Valid public OuterEnum getOuterEnum() { return outerEnum; } diff --git a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/FormatTest.java b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/FormatTest.java index ad8680a3bebf..9d6cf5cd4be9 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/FormatTest.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/FormatTest.java @@ -9,7 +9,9 @@ import java.math.BigDecimal; import java.util.UUID; import org.joda.time.DateTime; import org.joda.time.LocalDate; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * FormatTest */ @@ -66,7 +68,9 @@ public class FormatTest { * @return integer **/ @ApiModelProperty(value = "") - @Min(10) @Max(100) public Integer getInteger() { + @Min(10) @Max(100) + @Valid + public Integer getInteger() { return integer; } @@ -86,7 +90,9 @@ public class FormatTest { * @return int32 **/ @ApiModelProperty(value = "") - @Min(20) @Max(200) public Integer getInt32() { + @Min(20) @Max(200) + @Valid + public Integer getInt32() { return int32; } @@ -104,6 +110,8 @@ public class FormatTest { * @return int64 **/ @ApiModelProperty(value = "") + + @Valid public Long getInt64() { return int64; } @@ -125,7 +133,9 @@ public class FormatTest { **/ @ApiModelProperty(required = true, value = "") @NotNull - @DecimalMin("32.1") @DecimalMax("543.2") public BigDecimal getNumber() { + @DecimalMin("32.1") @DecimalMax("543.2") + @Valid + public BigDecimal getNumber() { return number; } @@ -145,7 +155,9 @@ public class FormatTest { * @return _float **/ @ApiModelProperty(value = "") - @DecimalMin("54.3") @DecimalMax("987.6") public Float getFloat() { + @DecimalMin("54.3") @DecimalMax("987.6") + @Valid + public Float getFloat() { return _float; } @@ -165,7 +177,9 @@ public class FormatTest { * @return _double **/ @ApiModelProperty(value = "") - @DecimalMin("67.8") @DecimalMax("123.4") public Double getDouble() { + @DecimalMin("67.8") @DecimalMax("123.4") + @Valid + public Double getDouble() { return _double; } @@ -183,7 +197,9 @@ public class FormatTest { * @return string **/ @ApiModelProperty(value = "") - @Pattern(regexp="/[a-z]/i") public String getString() { + @Pattern(regexp="/[a-z]/i") + @Valid + public String getString() { return string; } @@ -202,6 +218,8 @@ public class FormatTest { **/ @ApiModelProperty(required = true, value = "") @NotNull + + @Valid public byte[] getByte() { return _byte; } @@ -220,6 +238,8 @@ public class FormatTest { * @return binary **/ @ApiModelProperty(value = "") + + @Valid public byte[] getBinary() { return binary; } @@ -239,6 +259,8 @@ public class FormatTest { **/ @ApiModelProperty(required = true, value = "") @NotNull + + @Valid public LocalDate getDate() { return date; } @@ -257,6 +279,8 @@ public class FormatTest { * @return dateTime **/ @ApiModelProperty(value = "") + + @Valid public DateTime getDateTime() { return dateTime; } @@ -275,6 +299,8 @@ public class FormatTest { * @return uuid **/ @ApiModelProperty(value = "") + + @Valid public UUID getUuid() { return uuid; } @@ -294,7 +320,9 @@ public class FormatTest { **/ @ApiModelProperty(required = true, value = "") @NotNull - @Size(min=10,max=64) public String getPassword() { + @Size(min=10,max=64) + @Valid + public String getPassword() { return password; } diff --git a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/HasOnlyReadOnly.java b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/HasOnlyReadOnly.java index a26492e49126..0f8b608e2612 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/HasOnlyReadOnly.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/HasOnlyReadOnly.java @@ -5,7 +5,9 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * HasOnlyReadOnly */ @@ -27,6 +29,8 @@ public class HasOnlyReadOnly { * @return bar **/ @ApiModelProperty(readOnly = true, value = "") + + @Valid public String getBar() { return bar; } @@ -45,6 +49,8 @@ public class HasOnlyReadOnly { * @return foo **/ @ApiModelProperty(readOnly = true, value = "") + + @Valid public String getFoo() { return foo; } diff --git a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/MapTest.java b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/MapTest.java index 434c3a8f1b5c..1530a53f53f4 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/MapTest.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/MapTest.java @@ -9,7 +9,9 @@ import io.swagger.annotations.ApiModelProperty; import java.util.HashMap; import java.util.List; import java.util.Map; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * MapTest */ @@ -70,6 +72,8 @@ public class MapTest { * @return mapMapOfString **/ @ApiModelProperty(value = "") + + @Valid public Map> getMapMapOfString() { return mapMapOfString; } @@ -96,6 +100,8 @@ public class MapTest { * @return mapOfEnumString **/ @ApiModelProperty(value = "") + + @Valid public Map getMapOfEnumString() { return mapOfEnumString; } diff --git a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/MixedPropertiesAndAdditionalPropertiesClass.java b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/MixedPropertiesAndAdditionalPropertiesClass.java index dba1241f6d6e..d4cd89cef344 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/MixedPropertiesAndAdditionalPropertiesClass.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/MixedPropertiesAndAdditionalPropertiesClass.java @@ -11,7 +11,9 @@ import java.util.List; import java.util.Map; import java.util.UUID; import org.joda.time.DateTime; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * MixedPropertiesAndAdditionalPropertiesClass */ @@ -36,6 +38,8 @@ public class MixedPropertiesAndAdditionalPropertiesClass { * @return uuid **/ @ApiModelProperty(value = "") + + @Valid public UUID getUuid() { return uuid; } @@ -54,6 +58,8 @@ public class MixedPropertiesAndAdditionalPropertiesClass { * @return dateTime **/ @ApiModelProperty(value = "") + + @Valid public DateTime getDateTime() { return dateTime; } @@ -80,6 +86,8 @@ public class MixedPropertiesAndAdditionalPropertiesClass { * @return map **/ @ApiModelProperty(value = "") + + @Valid public Map getMap() { return map; } diff --git a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/Model200Response.java b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/Model200Response.java index 4d47f6c03c96..97349fef05c1 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/Model200Response.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/Model200Response.java @@ -5,7 +5,9 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * Model for testing model name starting with number */ @@ -28,6 +30,8 @@ public class Model200Response { * @return name **/ @ApiModelProperty(value = "") + + @Valid public Integer getName() { return name; } @@ -46,6 +50,8 @@ public class Model200Response { * @return propertyClass **/ @ApiModelProperty(value = "") + + @Valid public String getPropertyClass() { return propertyClass; } diff --git a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/ModelApiResponse.java b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/ModelApiResponse.java index 36da9b20d9d4..c8882b3b1e25 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/ModelApiResponse.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/ModelApiResponse.java @@ -5,7 +5,9 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * ModelApiResponse */ @@ -30,6 +32,8 @@ public class ModelApiResponse { * @return code **/ @ApiModelProperty(value = "") + + @Valid public Integer getCode() { return code; } @@ -48,6 +52,8 @@ public class ModelApiResponse { * @return type **/ @ApiModelProperty(value = "") + + @Valid public String getType() { return type; } @@ -66,6 +72,8 @@ public class ModelApiResponse { * @return message **/ @ApiModelProperty(value = "") + + @Valid public String getMessage() { return message; } diff --git a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/ModelReturn.java b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/ModelReturn.java index 7ffc24a0144f..7018d7de09cd 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/ModelReturn.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/ModelReturn.java @@ -5,7 +5,9 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * Model for testing reserved words */ @@ -25,6 +27,8 @@ public class ModelReturn { * @return _return **/ @ApiModelProperty(value = "") + + @Valid public Integer getReturn() { return _return; } diff --git a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/Name.java b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/Name.java index 953199166ff2..46069fdd14b2 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/Name.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/Name.java @@ -5,7 +5,9 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * Model for testing model name same as property name */ @@ -35,6 +37,8 @@ public class Name { **/ @ApiModelProperty(required = true, value = "") @NotNull + + @Valid public Integer getName() { return name; } @@ -53,6 +57,8 @@ public class Name { * @return snakeCase **/ @ApiModelProperty(readOnly = true, value = "") + + @Valid public Integer getSnakeCase() { return snakeCase; } @@ -71,6 +77,8 @@ public class Name { * @return property **/ @ApiModelProperty(value = "") + + @Valid public String getProperty() { return property; } @@ -89,6 +97,8 @@ public class Name { * @return _123Number **/ @ApiModelProperty(readOnly = true, value = "") + + @Valid public Integer get123Number() { return _123Number; } diff --git a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/NumberOnly.java b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/NumberOnly.java index e6dbf3139e2a..e243ecb429ba 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/NumberOnly.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/NumberOnly.java @@ -6,7 +6,9 @@ import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import java.math.BigDecimal; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * NumberOnly */ @@ -25,6 +27,8 @@ public class NumberOnly { * @return justNumber **/ @ApiModelProperty(value = "") + + @Valid public BigDecimal getJustNumber() { return justNumber; } diff --git a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/Order.java b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/Order.java index 41dec0795874..4106ac361986 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/Order.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/Order.java @@ -7,7 +7,9 @@ import com.fasterxml.jackson.annotation.JsonValue; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import org.joda.time.DateTime; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * Order */ @@ -74,6 +76,8 @@ public class Order { * @return id **/ @ApiModelProperty(value = "") + + @Valid public Long getId() { return id; } @@ -92,6 +96,8 @@ public class Order { * @return petId **/ @ApiModelProperty(value = "") + + @Valid public Long getPetId() { return petId; } @@ -110,6 +116,8 @@ public class Order { * @return quantity **/ @ApiModelProperty(value = "") + + @Valid public Integer getQuantity() { return quantity; } @@ -128,6 +136,8 @@ public class Order { * @return shipDate **/ @ApiModelProperty(value = "") + + @Valid public DateTime getShipDate() { return shipDate; } @@ -146,6 +156,8 @@ public class Order { * @return status **/ @ApiModelProperty(value = "Order Status") + + @Valid public StatusEnum getStatus() { return status; } @@ -164,6 +176,8 @@ public class Order { * @return complete **/ @ApiModelProperty(value = "") + + @Valid public Boolean getComplete() { return complete; } diff --git a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/OuterEnum.java b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/OuterEnum.java index 5f0075e4457a..f3c6d31fb865 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/OuterEnum.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/OuterEnum.java @@ -2,7 +2,9 @@ package io.swagger.model; import java.util.Objects; import com.fasterxml.jackson.annotation.JsonValue; +import javax.validation.Valid; import javax.validation.constraints.*; + import com.fasterxml.jackson.annotation.JsonCreator; /** diff --git a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/Pet.java b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/Pet.java index b013846b4d6e..c84687b699f3 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/Pet.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/Pet.java @@ -10,7 +10,9 @@ import io.swagger.model.Category; import io.swagger.model.Tag; import java.util.ArrayList; import java.util.List; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * Pet */ @@ -77,6 +79,8 @@ public class Pet { * @return id **/ @ApiModelProperty(value = "") + + @Valid public Long getId() { return id; } @@ -95,6 +99,8 @@ public class Pet { * @return category **/ @ApiModelProperty(value = "") + + @Valid public Category getCategory() { return category; } @@ -114,6 +120,8 @@ public class Pet { **/ @ApiModelProperty(example = "doggie", required = true, value = "") @NotNull + + @Valid public String getName() { return name; } @@ -138,6 +146,8 @@ public class Pet { **/ @ApiModelProperty(required = true, value = "") @NotNull + + @Valid public List getPhotoUrls() { return photoUrls; } @@ -164,6 +174,8 @@ public class Pet { * @return tags **/ @ApiModelProperty(value = "") + + @Valid public List getTags() { return tags; } @@ -182,6 +194,8 @@ public class Pet { * @return status **/ @ApiModelProperty(value = "pet status in the store") + + @Valid public StatusEnum getStatus() { return status; } diff --git a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/ReadOnlyFirst.java b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/ReadOnlyFirst.java index 47700659fd2d..8e79be0008d7 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/ReadOnlyFirst.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/ReadOnlyFirst.java @@ -5,7 +5,9 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * ReadOnlyFirst */ @@ -27,6 +29,8 @@ public class ReadOnlyFirst { * @return bar **/ @ApiModelProperty(readOnly = true, value = "") + + @Valid public String getBar() { return bar; } @@ -45,6 +49,8 @@ public class ReadOnlyFirst { * @return baz **/ @ApiModelProperty(value = "") + + @Valid public String getBaz() { return baz; } diff --git a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/SpecialModelName.java b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/SpecialModelName.java index 880d70599b0d..3cb7b04353c2 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/SpecialModelName.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/SpecialModelName.java @@ -5,7 +5,9 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * SpecialModelName */ @@ -24,6 +26,8 @@ public class SpecialModelName { * @return specialPropertyName **/ @ApiModelProperty(value = "") + + @Valid public Long getSpecialPropertyName() { return specialPropertyName; } diff --git a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/Tag.java b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/Tag.java index 298085317a4a..9f8f3a25234a 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/Tag.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/Tag.java @@ -5,7 +5,9 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * Tag */ @@ -27,6 +29,8 @@ public class Tag { * @return id **/ @ApiModelProperty(value = "") + + @Valid public Long getId() { return id; } @@ -45,6 +49,8 @@ public class Tag { * @return name **/ @ApiModelProperty(value = "") + + @Valid public String getName() { return name; } diff --git a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/User.java b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/User.java index 8e40f7e05942..501c556de270 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/User.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/User.java @@ -5,7 +5,9 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * User */ @@ -45,6 +47,8 @@ public class User { * @return id **/ @ApiModelProperty(value = "") + + @Valid public Long getId() { return id; } @@ -63,6 +67,8 @@ public class User { * @return username **/ @ApiModelProperty(value = "") + + @Valid public String getUsername() { return username; } @@ -81,6 +87,8 @@ public class User { * @return firstName **/ @ApiModelProperty(value = "") + + @Valid public String getFirstName() { return firstName; } @@ -99,6 +107,8 @@ public class User { * @return lastName **/ @ApiModelProperty(value = "") + + @Valid public String getLastName() { return lastName; } @@ -117,6 +127,8 @@ public class User { * @return email **/ @ApiModelProperty(value = "") + + @Valid public String getEmail() { return email; } @@ -135,6 +147,8 @@ public class User { * @return password **/ @ApiModelProperty(value = "") + + @Valid public String getPassword() { return password; } @@ -153,6 +167,8 @@ public class User { * @return phone **/ @ApiModelProperty(value = "") + + @Valid public String getPhone() { return phone; } @@ -171,6 +187,8 @@ public class User { * @return userStatus **/ @ApiModelProperty(value = "User Status") + + @Valid public Integer getUserStatus() { return userStatus; } diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/api/FakeApi.java b/samples/server/petstore/springboot/src/main/java/io/swagger/api/FakeApi.java index 5ad1ca0d95ce..8eefd6ed5072 100644 --- a/samples/server/petstore/springboot/src/main/java/io/swagger/api/FakeApi.java +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/api/FakeApi.java @@ -27,7 +27,6 @@ public interface FakeApi { @ApiOperation(value = "To test \"client\" model", notes = "To test \"client\" model", response = Client.class, tags={ "fake", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Client.class) }) - @RequestMapping(value = "/fake", produces = { "application/json" }, consumes = { "application/json" }, @@ -41,7 +40,6 @@ public interface FakeApi { @ApiResponses(value = { @ApiResponse(code = 400, message = "Invalid username supplied", response = Void.class), @ApiResponse(code = 404, message = "User not found", response = Void.class) }) - @RequestMapping(value = "/fake", produces = { "application/xml; charset=utf-8", "application/json; charset=utf-8" }, consumes = { "application/xml; charset=utf-8", "application/json; charset=utf-8" }, @@ -53,11 +51,10 @@ public interface FakeApi { @ApiResponses(value = { @ApiResponse(code = 400, message = "Invalid request", response = Void.class), @ApiResponse(code = 404, message = "Not found", response = Void.class) }) - @RequestMapping(value = "/fake", produces = { "*/*" }, consumes = { "*/*" }, method = RequestMethod.GET) - ResponseEntity testEnumParameters(@ApiParam(value = "Form parameter enum test (string array)", allowableValues=">, $") @RequestPart(value="enum_form_string_array", required=false) List enumFormStringArray,@ApiParam(value = "Form parameter enum test (string)", allowableValues="_abc, -efg, (xyz)", defaultValue="-efg") @RequestPart(value="enum_form_string", required=false) String enumFormString,@ApiParam(value = "Header parameter enum test (string array)" , allowableValues=">, $") @RequestHeader(value="enum_header_string_array", required=false) List enumHeaderStringArray,@ApiParam(value = "Header parameter enum test (string)" , allowableValues="_abc, -efg, (xyz)", defaultValue="-efg") @RequestHeader(value="enum_header_string", required=false) String enumHeaderString, @ApiParam(value = "Query parameter enum test (string array)", allowableValues = ">, $") @RequestParam(value = "enum_query_string_array", required = false) List enumQueryStringArray, @ApiParam(value = "Query parameter enum test (string)", allowableValues = "_abc, -efg, (xyz)", defaultValue = "-efg") @RequestParam(value = "enum_query_string", required = false, defaultValue="-efg") String enumQueryString, @ApiParam(value = "Query parameter enum test (double)", allowableValues = "1, -2") @RequestParam(value = "enum_query_integer", required = false) Integer enumQueryInteger,@ApiParam(value = "Query parameter enum test (double)", allowableValues="1.1, -1.2") @RequestPart(value="enum_query_double", required=false) Double enumQueryDouble, @RequestHeader("Accept") String accept); + ResponseEntity testEnumParameters(@ApiParam(value = "Form parameter enum test (string array)", allowableValues=">, $") @RequestPart(value="enum_form_string_array", required=false) List enumFormStringArray,@ApiParam(value = "Form parameter enum test (string)", allowableValues="_abc, -efg, (xyz)", defaultValue="-efg") @RequestPart(value="enum_form_string", required=false) String enumFormString,@ApiParam(value = "Header parameter enum test (string array)" , allowableValues=">, $") @RequestHeader(value="enum_header_string_array", required=false) List enumHeaderStringArray,@ApiParam(value = "Header parameter enum test (string)" , allowableValues="_abc, -efg, (xyz)", defaultValue="-efg") @RequestHeader(value="enum_header_string", required=false) String enumHeaderString,@ApiParam(value = "Query parameter enum test (string array)", allowableValues = ">, $") @RequestParam(value = "enum_query_string_array", required = false) List enumQueryStringArray,@ApiParam(value = "Query parameter enum test (string)", allowableValues = "_abc, -efg, (xyz)", defaultValue = "-efg") @RequestParam(value = "enum_query_string", required = false, defaultValue="-efg") String enumQueryString,@ApiParam(value = "Query parameter enum test (double)", allowableValues = "1, -2") @RequestParam(value = "enum_query_integer", required = false) Integer enumQueryInteger,@ApiParam(value = "Query parameter enum test (double)", allowableValues="1.1, -1.2") @RequestPart(value="enum_query_double", required=false) Double enumQueryDouble, @RequestHeader("Accept") String accept); } diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/api/FakeApiController.java b/samples/server/petstore/springboot/src/main/java/io/swagger/api/FakeApiController.java index 853d2fa2e228..bc079bf62997 100644 --- a/samples/server/petstore/springboot/src/main/java/io/swagger/api/FakeApiController.java +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/api/FakeApiController.java @@ -16,24 +16,27 @@ import org.springframework.web.bind.annotation.RequestHeader; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestPart; import org.springframework.web.multipart.MultipartFile; -import com.fasterxml.jackson.databind.ObjectMapper; -import java.io.IOException; import java.util.List; - +import com.fasterxml.jackson.databind.ObjectMapper; +import java.io.IOException; import javax.validation.constraints.*; import javax.validation.Valid; @Controller public class FakeApiController implements FakeApi { + private final ObjectMapper objectMapper; + + public FakeApiController(ObjectMapper objectMapper) { + this.objectMapper = objectMapper; + } + public ResponseEntity testClientModel(@ApiParam(value = "client model" ,required=true ) @Valid @RequestBody Client body, @RequestHeader("Accept") String accept) throws IOException { // do some magic! - - ObjectMapper objectMapper = new ObjectMapper(); if (accept != null && accept.contains("application/json")) { - return new ResponseEntity(objectMapper.readValue("{ \"client\" : \"aeiou\"}",Client.class), HttpStatus.OK); + return new ResponseEntity(objectMapper.readValue("{ \"client\" : \"aeiou\"}", Client.class), HttpStatus.OK); } return new ResponseEntity(HttpStatus.OK); @@ -62,9 +65,9 @@ public class FakeApiController implements FakeApi { @ApiParam(value = "Form parameter enum test (string)", allowableValues="_abc, -efg, (xyz)", defaultValue="-efg") @RequestPart(value="enum_form_string", required=false) String enumFormString, @ApiParam(value = "Header parameter enum test (string array)" , allowableValues=">, $") @RequestHeader(value="enum_header_string_array", required=false) List enumHeaderStringArray, @ApiParam(value = "Header parameter enum test (string)" , allowableValues="_abc, -efg, (xyz)", defaultValue="-efg") @RequestHeader(value="enum_header_string", required=false) String enumHeaderString, - @ApiParam(value = "Query parameter enum test (string array)", allowableValues = ">, $") @RequestParam(value = "enum_query_string_array", required = false) List enumQueryStringArray, - @ApiParam(value = "Query parameter enum test (string)", allowableValues = "_abc, -efg, (xyz)", defaultValue = "-efg") @RequestParam(value = "enum_query_string", required = false, defaultValue="-efg") String enumQueryString, - @ApiParam(value = "Query parameter enum test (double)", allowableValues = "1, -2") @RequestParam(value = "enum_query_integer", required = false) Integer enumQueryInteger, + @ApiParam(value = "Query parameter enum test (string array)", allowableValues = ">, $") @RequestParam(value = "enum_query_string_array", required = false) List enumQueryStringArray, + @ApiParam(value = "Query parameter enum test (string)", allowableValues = "_abc, -efg, (xyz)", defaultValue = "-efg") @RequestParam(value = "enum_query_string", required = false, defaultValue="-efg") String enumQueryString, + @ApiParam(value = "Query parameter enum test (double)", allowableValues = "1, -2") @RequestParam(value = "enum_query_integer", required = false) Integer enumQueryInteger, @ApiParam(value = "Query parameter enum test (double)", allowableValues="1.1, -1.2") @RequestPart(value="enum_query_double", required=false) Double enumQueryDouble, @RequestHeader("Accept") String accept) { // do some magic! diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/api/PetApi.java b/samples/server/petstore/springboot/src/main/java/io/swagger/api/PetApi.java index ea6fbde10ac9..1227aedbbd7d 100644 --- a/samples/server/petstore/springboot/src/main/java/io/swagger/api/PetApi.java +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/api/PetApi.java @@ -31,7 +31,6 @@ public interface PetApi { }, tags={ "pet", }) @ApiResponses(value = { @ApiResponse(code = 405, message = "Invalid input", response = Void.class) }) - @RequestMapping(value = "/pet", produces = { "application/xml", "application/json" }, consumes = { "application/json", "application/xml" }, @@ -47,7 +46,6 @@ public interface PetApi { }, tags={ "pet", }) @ApiResponses(value = { @ApiResponse(code = 400, message = "Invalid pet value", response = Void.class) }) - @RequestMapping(value = "/pet/{petId}", produces = { "application/xml", "application/json" }, method = RequestMethod.DELETE) @@ -63,11 +61,10 @@ public interface PetApi { @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Pet.class), @ApiResponse(code = 400, message = "Invalid status value", response = Pet.class) }) - @RequestMapping(value = "/pet/findByStatus", produces = { "application/xml", "application/json" }, method = RequestMethod.GET) - ResponseEntity> findPetsByStatus( @NotNull @ApiParam(value = "Status values that need to be considered for filter", required = true, allowableValues = "available, pending, sold") @RequestParam(value = "status", required = true) List status, @RequestHeader("Accept") String accept) throws IOException; + ResponseEntity> findPetsByStatus( @NotNull@ApiParam(value = "Status values that need to be considered for filter", required = true, allowableValues = "available, pending, sold") @RequestParam(value = "status", required = true) List status, @RequestHeader("Accept") String accept) throws IOException; @ApiOperation(value = "Finds Pets by tags", notes = "Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.", response = Pet.class, responseContainer = "List", authorizations = { @@ -79,11 +76,10 @@ public interface PetApi { @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Pet.class), @ApiResponse(code = 400, message = "Invalid tag value", response = Pet.class) }) - @RequestMapping(value = "/pet/findByTags", produces = { "application/xml", "application/json" }, method = RequestMethod.GET) - ResponseEntity> findPetsByTags( @NotNull @ApiParam(value = "Tags to filter by", required = true) @RequestParam(value = "tags", required = true) List tags, @RequestHeader("Accept") String accept) throws IOException; + ResponseEntity> findPetsByTags( @NotNull@ApiParam(value = "Tags to filter by", required = true) @RequestParam(value = "tags", required = true) List tags, @RequestHeader("Accept") String accept) throws IOException; @ApiOperation(value = "Find pet by ID", notes = "Returns a single pet", response = Pet.class, authorizations = { @@ -93,7 +89,6 @@ public interface PetApi { @ApiResponse(code = 200, message = "successful operation", response = Pet.class), @ApiResponse(code = 400, message = "Invalid ID supplied", response = Pet.class), @ApiResponse(code = 404, message = "Pet not found", response = Pet.class) }) - @RequestMapping(value = "/pet/{petId}", produces = { "application/xml", "application/json" }, method = RequestMethod.GET) @@ -110,7 +105,6 @@ public interface PetApi { @ApiResponse(code = 400, message = "Invalid ID supplied", response = Void.class), @ApiResponse(code = 404, message = "Pet not found", response = Void.class), @ApiResponse(code = 405, message = "Validation exception", response = Void.class) }) - @RequestMapping(value = "/pet", produces = { "application/xml", "application/json" }, consumes = { "application/json", "application/xml" }, @@ -126,7 +120,6 @@ public interface PetApi { }, tags={ "pet", }) @ApiResponses(value = { @ApiResponse(code = 405, message = "Invalid input", response = Void.class) }) - @RequestMapping(value = "/pet/{petId}", produces = { "application/xml", "application/json" }, consumes = { "application/x-www-form-urlencoded" }, @@ -142,7 +135,6 @@ public interface PetApi { }, tags={ "pet", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = ModelApiResponse.class) }) - @RequestMapping(value = "/pet/{petId}/uploadImage", produces = { "application/json" }, consumes = { "multipart/form-data" }, diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/api/PetApiController.java b/samples/server/petstore/springboot/src/main/java/io/swagger/api/PetApiController.java index f02c2e76a8ba..66e1dbda18de 100644 --- a/samples/server/petstore/springboot/src/main/java/io/swagger/api/PetApiController.java +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/api/PetApiController.java @@ -15,16 +15,21 @@ import org.springframework.web.bind.annotation.RequestHeader; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestPart; import org.springframework.web.multipart.MultipartFile; -import com.fasterxml.jackson.databind.ObjectMapper; -import java.io.IOException; import java.util.List; - +import com.fasterxml.jackson.databind.ObjectMapper; +import java.io.IOException; import javax.validation.constraints.*; import javax.validation.Valid; @Controller public class PetApiController implements PetApi { + private final ObjectMapper objectMapper; + + public PetApiController(ObjectMapper objectMapper) { + this.objectMapper = objectMapper; + } + public ResponseEntity addPet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody Pet body, @RequestHeader("Accept") String accept) { // do some magic! @@ -38,35 +43,33 @@ public class PetApiController implements PetApi { return new ResponseEntity(HttpStatus.OK); } - public ResponseEntity> findPetsByStatus( @NotNull @ApiParam(value = "Status values that need to be considered for filter", required = true, allowableValues = "available, pending, sold") @RequestParam(value = "status", required = true) List status, + public ResponseEntity> findPetsByStatus( @NotNull@ApiParam(value = "Status values that need to be considered for filter", required = true, allowableValues = "available, pending, sold") @RequestParam(value = "status", required = true) List status, @RequestHeader("Accept") String accept) throws IOException { // do some magic! - - ObjectMapper objectMapper = new ObjectMapper(); if (accept != null && accept.contains("application/xml")) { - return new ResponseEntity>(objectMapper.readValue(" 123456789 doggie aeiou aeiou",List.class), HttpStatus.OK); + return new ResponseEntity>(objectMapper.readValue(" 123456789 doggie aeiou aeiou", List.class), HttpStatus.OK); } + if (accept != null && accept.contains("application/json")) { - return new ResponseEntity>(objectMapper.readValue("[ { \"photoUrls\" : [ \"aeiou\" ], \"name\" : \"doggie\", \"id\" : 0, \"category\" : { \"name\" : \"aeiou\", \"id\" : 6 }, \"tags\" : [ { \"name\" : \"aeiou\", \"id\" : 1 } ], \"status\" : \"available\"} ]",List.class), HttpStatus.OK); + return new ResponseEntity>(objectMapper.readValue("[ { \"photoUrls\" : [ \"aeiou\" ], \"name\" : \"doggie\", \"id\" : 0, \"category\" : { \"name\" : \"aeiou\", \"id\" : 6 }, \"tags\" : [ { \"name\" : \"aeiou\", \"id\" : 1 } ], \"status\" : \"available\"} ]", List.class), HttpStatus.OK); } return new ResponseEntity>(HttpStatus.OK); } - public ResponseEntity> findPetsByTags( @NotNull @ApiParam(value = "Tags to filter by", required = true) @RequestParam(value = "tags", required = true) List tags, + public ResponseEntity> findPetsByTags( @NotNull@ApiParam(value = "Tags to filter by", required = true) @RequestParam(value = "tags", required = true) List tags, @RequestHeader("Accept") String accept) throws IOException { // do some magic! - - ObjectMapper objectMapper = new ObjectMapper(); if (accept != null && accept.contains("application/xml")) { - return new ResponseEntity>(objectMapper.readValue(" 123456789 doggie aeiou aeiou",List.class), HttpStatus.OK); + return new ResponseEntity>(objectMapper.readValue(" 123456789 doggie aeiou aeiou", List.class), HttpStatus.OK); } + if (accept != null && accept.contains("application/json")) { - return new ResponseEntity>(objectMapper.readValue("[ { \"photoUrls\" : [ \"aeiou\" ], \"name\" : \"doggie\", \"id\" : 0, \"category\" : { \"name\" : \"aeiou\", \"id\" : 6 }, \"tags\" : [ { \"name\" : \"aeiou\", \"id\" : 1 } ], \"status\" : \"available\"} ]",List.class), HttpStatus.OK); + return new ResponseEntity>(objectMapper.readValue("[ { \"photoUrls\" : [ \"aeiou\" ], \"name\" : \"doggie\", \"id\" : 0, \"category\" : { \"name\" : \"aeiou\", \"id\" : 6 }, \"tags\" : [ { \"name\" : \"aeiou\", \"id\" : 1 } ], \"status\" : \"available\"} ]", List.class), HttpStatus.OK); } return new ResponseEntity>(HttpStatus.OK); @@ -75,15 +78,14 @@ public class PetApiController implements PetApi { public ResponseEntity getPetById(@ApiParam(value = "ID of pet to return",required=true ) @PathVariable("petId") Long petId, @RequestHeader("Accept") String accept) throws IOException { // do some magic! - - ObjectMapper objectMapper = new ObjectMapper(); if (accept != null && accept.contains("application/xml")) { - return new ResponseEntity(objectMapper.readValue(" 123456789 doggie aeiou aeiou",Pet.class), HttpStatus.OK); + return new ResponseEntity(objectMapper.readValue(" 123456789 doggie aeiou aeiou", Pet.class), HttpStatus.OK); } + if (accept != null && accept.contains("application/json")) { - return new ResponseEntity(objectMapper.readValue("{ \"photoUrls\" : [ \"aeiou\" ], \"name\" : \"doggie\", \"id\" : 0, \"category\" : { \"name\" : \"aeiou\", \"id\" : 6 }, \"tags\" : [ { \"name\" : \"aeiou\", \"id\" : 1 } ], \"status\" : \"available\"}",Pet.class), HttpStatus.OK); + return new ResponseEntity(objectMapper.readValue("{ \"photoUrls\" : [ \"aeiou\" ], \"name\" : \"doggie\", \"id\" : 0, \"category\" : { \"name\" : \"aeiou\", \"id\" : 6 }, \"tags\" : [ { \"name\" : \"aeiou\", \"id\" : 1 } ], \"status\" : \"available\"}", Pet.class), HttpStatus.OK); } return new ResponseEntity(HttpStatus.OK); @@ -108,11 +110,9 @@ public class PetApiController implements PetApi { @ApiParam(value = "file detail") @RequestPart("file") MultipartFile file, @RequestHeader("Accept") String accept) throws IOException { // do some magic! - - ObjectMapper objectMapper = new ObjectMapper(); if (accept != null && accept.contains("application/json")) { - return new ResponseEntity(objectMapper.readValue("{ \"code\" : 0, \"type\" : \"aeiou\", \"message\" : \"aeiou\"}",ModelApiResponse.class), HttpStatus.OK); + return new ResponseEntity(objectMapper.readValue("{ \"code\" : 0, \"type\" : \"aeiou\", \"message\" : \"aeiou\"}", ModelApiResponse.class), HttpStatus.OK); } return new ResponseEntity(HttpStatus.OK); diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/api/StoreApi.java b/samples/server/petstore/springboot/src/main/java/io/swagger/api/StoreApi.java index beaa348db1ca..fb8f3d706f55 100644 --- a/samples/server/petstore/springboot/src/main/java/io/swagger/api/StoreApi.java +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/api/StoreApi.java @@ -26,7 +26,6 @@ public interface StoreApi { @ApiResponses(value = { @ApiResponse(code = 400, message = "Invalid ID supplied", response = Void.class), @ApiResponse(code = 404, message = "Order not found", response = Void.class) }) - @RequestMapping(value = "/store/order/{order_id}", produces = { "application/xml", "application/json" }, method = RequestMethod.DELETE) @@ -38,7 +37,6 @@ public interface StoreApi { }, tags={ "store", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Integer.class) }) - @RequestMapping(value = "/store/inventory", produces = { "application/json" }, method = RequestMethod.GET) @@ -50,7 +48,6 @@ public interface StoreApi { @ApiResponse(code = 200, message = "successful operation", response = Order.class), @ApiResponse(code = 400, message = "Invalid ID supplied", response = Order.class), @ApiResponse(code = 404, message = "Order not found", response = Order.class) }) - @RequestMapping(value = "/store/order/{order_id}", produces = { "application/xml", "application/json" }, method = RequestMethod.GET) @@ -61,7 +58,6 @@ public interface StoreApi { @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Order.class), @ApiResponse(code = 400, message = "Invalid Order", response = Order.class) }) - @RequestMapping(value = "/store/order", produces = { "application/xml", "application/json" }, method = RequestMethod.POST) diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/api/StoreApiController.java b/samples/server/petstore/springboot/src/main/java/io/swagger/api/StoreApiController.java index 9587daf4673e..6154d9c26392 100644 --- a/samples/server/petstore/springboot/src/main/java/io/swagger/api/StoreApiController.java +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/api/StoreApiController.java @@ -14,16 +14,21 @@ import org.springframework.web.bind.annotation.RequestHeader; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestPart; import org.springframework.web.multipart.MultipartFile; -import com.fasterxml.jackson.databind.ObjectMapper; -import java.io.IOException; import java.util.List; - +import com.fasterxml.jackson.databind.ObjectMapper; +import java.io.IOException; import javax.validation.constraints.*; import javax.validation.Valid; @Controller public class StoreApiController implements StoreApi { + private final ObjectMapper objectMapper; + + public StoreApiController(ObjectMapper objectMapper) { + this.objectMapper = objectMapper; + } + public ResponseEntity deleteOrder(@ApiParam(value = "ID of the order that needs to be deleted",required=true ) @PathVariable("order_id") String orderId, @RequestHeader("Accept") String accept) { // do some magic! @@ -32,11 +37,9 @@ public class StoreApiController implements StoreApi { public ResponseEntity> getInventory(@RequestHeader("Accept") String accept) throws IOException { // do some magic! - - ObjectMapper objectMapper = new ObjectMapper(); if (accept != null && accept.contains("application/json")) { - return new ResponseEntity>(objectMapper.readValue("{ \"key\" : 0}",Map.class), HttpStatus.OK); + return new ResponseEntity>(objectMapper.readValue("{ \"key\" : 0}", Map.class), HttpStatus.OK); } return new ResponseEntity>(HttpStatus.OK); @@ -45,15 +48,14 @@ public class StoreApiController implements StoreApi { public ResponseEntity getOrderById( @Min(1) @Max(5)@ApiParam(value = "ID of pet that needs to be fetched",required=true ) @PathVariable("order_id") Long orderId, @RequestHeader("Accept") String accept) throws IOException { // do some magic! - - ObjectMapper objectMapper = new ObjectMapper(); if (accept != null && accept.contains("application/xml")) { - return new ResponseEntity(objectMapper.readValue(" 123456789 123456789 123 2000-01-23T04:56:07.000Z aeiou true",Order.class), HttpStatus.OK); + return new ResponseEntity(objectMapper.readValue(" 123456789 123456789 123 2000-01-23T04:56:07.000Z aeiou true", Order.class), HttpStatus.OK); } + if (accept != null && accept.contains("application/json")) { - return new ResponseEntity(objectMapper.readValue("{ \"petId\" : 6, \"quantity\" : 1, \"id\" : 0, \"shipDate\" : \"2000-01-23T04:56:07.000+00:00\", \"complete\" : false, \"status\" : \"placed\"}",Order.class), HttpStatus.OK); + return new ResponseEntity(objectMapper.readValue("{ \"petId\" : 6, \"quantity\" : 1, \"id\" : 0, \"shipDate\" : \"2000-01-23T04:56:07.000+00:00\", \"complete\" : false, \"status\" : \"placed\"}", Order.class), HttpStatus.OK); } return new ResponseEntity(HttpStatus.OK); @@ -62,15 +64,14 @@ public class StoreApiController implements StoreApi { public ResponseEntity placeOrder(@ApiParam(value = "order placed for purchasing the pet" ,required=true ) @Valid @RequestBody Order body, @RequestHeader("Accept") String accept) throws IOException { // do some magic! - - ObjectMapper objectMapper = new ObjectMapper(); if (accept != null && accept.contains("application/xml")) { - return new ResponseEntity(objectMapper.readValue(" 123456789 123456789 123 2000-01-23T04:56:07.000Z aeiou true",Order.class), HttpStatus.OK); + return new ResponseEntity(objectMapper.readValue(" 123456789 123456789 123 2000-01-23T04:56:07.000Z aeiou true", Order.class), HttpStatus.OK); } + if (accept != null && accept.contains("application/json")) { - return new ResponseEntity(objectMapper.readValue("{ \"petId\" : 6, \"quantity\" : 1, \"id\" : 0, \"shipDate\" : \"2000-01-23T04:56:07.000+00:00\", \"complete\" : false, \"status\" : \"placed\"}",Order.class), HttpStatus.OK); + return new ResponseEntity(objectMapper.readValue("{ \"petId\" : 6, \"quantity\" : 1, \"id\" : 0, \"shipDate\" : \"2000-01-23T04:56:07.000+00:00\", \"complete\" : false, \"status\" : \"placed\"}", Order.class), HttpStatus.OK); } return new ResponseEntity(HttpStatus.OK); diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/api/UserApi.java b/samples/server/petstore/springboot/src/main/java/io/swagger/api/UserApi.java index e32fdff69b45..adc0d21d30b1 100644 --- a/samples/server/petstore/springboot/src/main/java/io/swagger/api/UserApi.java +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/api/UserApi.java @@ -25,7 +25,6 @@ public interface UserApi { @ApiOperation(value = "Create user", notes = "This can only be done by the logged in user.", response = Void.class, tags={ "user", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Void.class) }) - @RequestMapping(value = "/user", produces = { "application/xml", "application/json" }, method = RequestMethod.POST) @@ -35,7 +34,6 @@ public interface UserApi { @ApiOperation(value = "Creates list of users with given input array", notes = "", response = Void.class, tags={ "user", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Void.class) }) - @RequestMapping(value = "/user/createWithArray", produces = { "application/xml", "application/json" }, method = RequestMethod.POST) @@ -45,7 +43,6 @@ public interface UserApi { @ApiOperation(value = "Creates list of users with given input array", notes = "", response = Void.class, tags={ "user", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Void.class) }) - @RequestMapping(value = "/user/createWithList", produces = { "application/xml", "application/json" }, method = RequestMethod.POST) @@ -56,7 +53,6 @@ public interface UserApi { @ApiResponses(value = { @ApiResponse(code = 400, message = "Invalid username supplied", response = Void.class), @ApiResponse(code = 404, message = "User not found", response = Void.class) }) - @RequestMapping(value = "/user/{username}", produces = { "application/xml", "application/json" }, method = RequestMethod.DELETE) @@ -68,7 +64,6 @@ public interface UserApi { @ApiResponse(code = 200, message = "successful operation", response = User.class), @ApiResponse(code = 400, message = "Invalid username supplied", response = User.class), @ApiResponse(code = 404, message = "User not found", response = User.class) }) - @RequestMapping(value = "/user/{username}", produces = { "application/xml", "application/json" }, method = RequestMethod.GET) @@ -79,17 +74,15 @@ public interface UserApi { @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = String.class), @ApiResponse(code = 400, message = "Invalid username/password supplied", response = String.class) }) - @RequestMapping(value = "/user/login", produces = { "application/xml", "application/json" }, method = RequestMethod.GET) - ResponseEntity loginUser( @NotNull @ApiParam(value = "The user name for login", required = true) @RequestParam(value = "username", required = true) String username, @NotNull @ApiParam(value = "The password for login in clear text", required = true) @RequestParam(value = "password", required = true) String password, @RequestHeader("Accept") String accept) throws IOException; + ResponseEntity loginUser( @NotNull@ApiParam(value = "The user name for login", required = true) @RequestParam(value = "username", required = true) String username, @NotNull@ApiParam(value = "The password for login in clear text", required = true) @RequestParam(value = "password", required = true) String password, @RequestHeader("Accept") String accept) throws IOException; @ApiOperation(value = "Logs out current logged in user session", notes = "", response = Void.class, tags={ "user", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Void.class) }) - @RequestMapping(value = "/user/logout", produces = { "application/xml", "application/json" }, method = RequestMethod.GET) @@ -100,7 +93,6 @@ public interface UserApi { @ApiResponses(value = { @ApiResponse(code = 400, message = "Invalid user supplied", response = Void.class), @ApiResponse(code = 404, message = "User not found", response = Void.class) }) - @RequestMapping(value = "/user/{username}", produces = { "application/xml", "application/json" }, method = RequestMethod.PUT) diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/api/UserApiController.java b/samples/server/petstore/springboot/src/main/java/io/swagger/api/UserApiController.java index 03a6894d2dd9..24b7e18b9959 100644 --- a/samples/server/petstore/springboot/src/main/java/io/swagger/api/UserApiController.java +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/api/UserApiController.java @@ -14,16 +14,21 @@ import org.springframework.web.bind.annotation.RequestHeader; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestPart; import org.springframework.web.multipart.MultipartFile; -import com.fasterxml.jackson.databind.ObjectMapper; -import java.io.IOException; import java.util.List; - +import com.fasterxml.jackson.databind.ObjectMapper; +import java.io.IOException; import javax.validation.constraints.*; import javax.validation.Valid; @Controller public class UserApiController implements UserApi { + private final ObjectMapper objectMapper; + + public UserApiController(ObjectMapper objectMapper) { + this.objectMapper = objectMapper; + } + public ResponseEntity createUser(@ApiParam(value = "Created user object" ,required=true ) @Valid @RequestBody User body, @RequestHeader("Accept") String accept) { // do some magic! @@ -51,33 +56,31 @@ public class UserApiController implements UserApi { public ResponseEntity getUserByName(@ApiParam(value = "The name that needs to be fetched. Use user1 for testing. ",required=true ) @PathVariable("username") String username, @RequestHeader("Accept") String accept) throws IOException { // do some magic! - - ObjectMapper objectMapper = new ObjectMapper(); if (accept != null && accept.contains("application/xml")) { - return new ResponseEntity(objectMapper.readValue(" 123456789 aeiou aeiou aeiou aeiou aeiou aeiou 123",User.class), HttpStatus.OK); + return new ResponseEntity(objectMapper.readValue(" 123456789 aeiou aeiou aeiou aeiou aeiou aeiou 123", User.class), HttpStatus.OK); } + if (accept != null && accept.contains("application/json")) { - return new ResponseEntity(objectMapper.readValue("{ \"firstName\" : \"aeiou\", \"lastName\" : \"aeiou\", \"password\" : \"aeiou\", \"userStatus\" : 6, \"phone\" : \"aeiou\", \"id\" : 0, \"email\" : \"aeiou\", \"username\" : \"aeiou\"}",User.class), HttpStatus.OK); + return new ResponseEntity(objectMapper.readValue("{ \"firstName\" : \"aeiou\", \"lastName\" : \"aeiou\", \"password\" : \"aeiou\", \"userStatus\" : 6, \"phone\" : \"aeiou\", \"id\" : 0, \"email\" : \"aeiou\", \"username\" : \"aeiou\"}", User.class), HttpStatus.OK); } return new ResponseEntity(HttpStatus.OK); } - public ResponseEntity loginUser( @NotNull @ApiParam(value = "The user name for login", required = true) @RequestParam(value = "username", required = true) String username, - @NotNull @ApiParam(value = "The password for login in clear text", required = true) @RequestParam(value = "password", required = true) String password, + public ResponseEntity loginUser( @NotNull@ApiParam(value = "The user name for login", required = true) @RequestParam(value = "username", required = true) String username, + @NotNull@ApiParam(value = "The password for login in clear text", required = true) @RequestParam(value = "password", required = true) String password, @RequestHeader("Accept") String accept) throws IOException { // do some magic! - - ObjectMapper objectMapper = new ObjectMapper(); if (accept != null && accept.contains("application/xml")) { - return new ResponseEntity(objectMapper.readValue("aeiou",String.class), HttpStatus.OK); + return new ResponseEntity(objectMapper.readValue("aeiou", String.class), HttpStatus.OK); } + if (accept != null && accept.contains("application/json")) { - return new ResponseEntity(objectMapper.readValue("\"aeiou\"",String.class), HttpStatus.OK); + return new ResponseEntity(objectMapper.readValue("\"aeiou\"", String.class), HttpStatus.OK); } return new ResponseEntity(HttpStatus.OK); From 1e9fe51175dc0329f28624b42621b6464dd64b2f Mon Sep 17 00:00:00 2001 From: wing328 Date: Thu, 4 May 2017 18:01:52 +0800 Subject: [PATCH 2/2] use original value of pattern (#5554) --- .../confluenceWikiDocs/param.mustache | 2 +- .../resources/csharp/modelGeneric.mustache | 30 ++++++++++++++----- .../main/resources/erlang-server/api.mustache | 2 +- .../src/main/resources/ze-ph/model.mustache | 2 +- .../Model/AdditionalPropertiesClass.cs | 2 +- .../src/IO.Swagger/Model/Animal.cs | 2 +- .../src/IO.Swagger/Model/AnimalFarm.cs | 2 +- .../src/IO.Swagger/Model/ApiResponse.cs | 2 +- .../Model/ArrayOfArrayOfNumberOnly.cs | 2 +- .../src/IO.Swagger/Model/ArrayOfNumberOnly.cs | 2 +- .../src/IO.Swagger/Model/ArrayTest.cs | 2 +- .../src/IO.Swagger/Model/Capitalization.cs | 2 +- .../SwaggerClient/src/IO.Swagger/Model/Cat.cs | 2 +- .../src/IO.Swagger/Model/Category.cs | 2 +- .../src/IO.Swagger/Model/ClassModel.cs | 2 +- .../SwaggerClient/src/IO.Swagger/Model/Dog.cs | 2 +- .../src/IO.Swagger/Model/EnumArrays.cs | 2 +- .../src/IO.Swagger/Model/EnumTest.cs | 2 +- .../src/IO.Swagger/Model/FormatTest.cs | 2 +- .../src/IO.Swagger/Model/HasOnlyReadOnly.cs | 2 +- .../src/IO.Swagger/Model/List.cs | 2 +- .../src/IO.Swagger/Model/MapTest.cs | 2 +- ...dPropertiesAndAdditionalPropertiesClass.cs | 2 +- .../src/IO.Swagger/Model/Model200Response.cs | 2 +- .../src/IO.Swagger/Model/ModelClient.cs | 2 +- .../src/IO.Swagger/Model/ModelReturn.cs | 2 +- .../src/IO.Swagger/Model/Name.cs | 2 +- .../src/IO.Swagger/Model/NumberOnly.cs | 2 +- .../src/IO.Swagger/Model/Order.cs | 2 +- .../SwaggerClient/src/IO.Swagger/Model/Pet.cs | 2 +- .../src/IO.Swagger/Model/ReadOnlyFirst.cs | 2 +- .../src/IO.Swagger/Model/SpecialModelName.cs | 2 +- .../SwaggerClient/src/IO.Swagger/Model/Tag.cs | 2 +- .../src/IO.Swagger/Model/User.cs | 2 +- .../Model/AdditionalPropertiesClass.cs | 2 +- .../src/IO.Swagger/Model/Animal.cs | 2 +- .../src/IO.Swagger/Model/AnimalFarm.cs | 2 +- .../src/IO.Swagger/Model/ApiResponse.cs | 2 +- .../Model/ArrayOfArrayOfNumberOnly.cs | 2 +- .../src/IO.Swagger/Model/ArrayOfNumberOnly.cs | 2 +- .../src/IO.Swagger/Model/ArrayTest.cs | 2 +- .../src/IO.Swagger/Model/Capitalization.cs | 2 +- .../src/IO.Swagger/Model/Cat.cs | 2 +- .../src/IO.Swagger/Model/Category.cs | 2 +- .../src/IO.Swagger/Model/ClassModel.cs | 2 +- .../src/IO.Swagger/Model/Dog.cs | 2 +- .../src/IO.Swagger/Model/EnumArrays.cs | 2 +- .../src/IO.Swagger/Model/EnumTest.cs | 2 +- .../src/IO.Swagger/Model/FormatTest.cs | 2 +- .../src/IO.Swagger/Model/HasOnlyReadOnly.cs | 2 +- .../src/IO.Swagger/Model/List.cs | 2 +- .../src/IO.Swagger/Model/MapTest.cs | 2 +- ...dPropertiesAndAdditionalPropertiesClass.cs | 2 +- .../src/IO.Swagger/Model/Model200Response.cs | 2 +- .../src/IO.Swagger/Model/ModelClient.cs | 2 +- .../src/IO.Swagger/Model/ModelReturn.cs | 2 +- .../src/IO.Swagger/Model/Name.cs | 2 +- .../src/IO.Swagger/Model/NumberOnly.cs | 2 +- .../src/IO.Swagger/Model/Order.cs | 2 +- .../src/IO.Swagger/Model/Pet.cs | 2 +- .../src/IO.Swagger/Model/ReadOnlyFirst.cs | 2 +- .../src/IO.Swagger/Model/SpecialModelName.cs | 2 +- .../src/IO.Swagger/Model/Tag.cs | 2 +- .../src/IO.Swagger/Model/User.cs | 2 +- 64 files changed, 85 insertions(+), 71 deletions(-) diff --git a/modules/swagger-codegen/src/main/resources/confluenceWikiDocs/param.mustache b/modules/swagger-codegen/src/main/resources/confluenceWikiDocs/param.mustache index fd7d3166c376..87c17b83cc93 100644 --- a/modules/swagger-codegen/src/main/resources/confluenceWikiDocs/param.mustache +++ b/modules/swagger-codegen/src/main/resources/confluenceWikiDocs/param.mustache @@ -1 +1 @@ -|{{paramName}} |{{description}} |{{^required}}(x){{/required}}{{#required}}(/){{/required}} |{{defaultValue}} | {{pattern}} | \ No newline at end of file +|{{paramName}} |{{description}} |{{^required}}(x){{/required}}{{#required}}(/){{/required}} |{{defaultValue}} | {{{pattern}}} | diff --git a/modules/swagger-codegen/src/main/resources/csharp/modelGeneric.mustache b/modules/swagger-codegen/src/main/resources/csharp/modelGeneric.mustache index 2f86f53b4f18..1122b5fa99a9 100644 --- a/modules/swagger-codegen/src/main/resources/csharp/modelGeneric.mustache +++ b/modules/swagger-codegen/src/main/resources/csharp/modelGeneric.mustache @@ -203,38 +203,52 @@ this.{{name}} = {{name}}; /// Validation context /// Validation Result IEnumerable IValidatableObject.Validate(ValidationContext validationContext) - { {{#vars}}{{#hasValidation}}{{#maxLength}} + { + {{#vars}} + {{#hasValidation}} + {{#maxLength}} // {{{name}}} ({{{datatype}}}) maxLength if(this.{{{name}}} != null && this.{{{name}}}.Length > {{maxLength}}) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for {{{name}}}, length must be less than {{maxLength}}.", new [] { "{{{name}}}" }); } -{{/maxLength}}{{#minLength}} + + {{/maxLength}} + {{#minLength}} // {{{name}}} ({{{datatype}}}) minLength if(this.{{{name}}} != null && this.{{{name}}}.Length < {{minLength}}) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for {{{name}}}, length must be greater than {{minLength}}.", new [] { "{{{name}}}" }); } -{{/minLength}}{{#maximum}} + + {{/minLength}} + {{#maximum}} // {{{name}}} ({{{datatype}}}) maximum if(this.{{{name}}} > ({{{datatype}}}){{maximum}}) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for {{{name}}}, must be a value less than or equal to {{maximum}}.", new [] { "{{{name}}}" }); } -{{/maximum}}{{#minimum}} + + {{/maximum}} + {{#minimum}} // {{{name}}} ({{{datatype}}}) minimum if(this.{{{name}}} < ({{{datatype}}}){{minimum}}) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for {{{name}}}, must be a value greater than or equal to {{minimum}}.", new [] { "{{{name}}}" }); } -{{/minimum}}{{#pattern}} + + {{/minimum}} + {{#pattern}} // {{{name}}} ({{{datatype}}}) pattern - Regex regex{{{name}}} = new Regex(@"{{vendorExtensions.x-regex}}"{{#vendorExtensions.x-modifiers}}{{#-first}}, {{/-first}}RegexOptions.{{.}}{{^-last}} | {{/-last}}{{/vendorExtensions.x-modifiers}}); + Regex regex{{{name}}} = new Regex(@"{{{vendorExtensions.x-regex}}}"{{#vendorExtensions.x-modifiers}}{{#-first}}, {{/-first}}RegexOptions.{{{.}}}{{^-last}} | {{/-last}}{{/vendorExtensions.x-modifiers}}); if (false == regex{{{name}}}.Match(this.{{{name}}}).Success) { - yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for {{{name}}}, must match a pattern of {{pattern}}.", new [] { "{{{name}}}" }); + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for {{{name}}}, must match a pattern of {{{pattern}}}.", new [] { "{{{name}}}" }); } -{{/pattern}}{{/hasValidation}}{{/vars}} + + {{/pattern}} + {{/hasValidation}} + {{/vars}} yield break; } {{/validatable}} diff --git a/modules/swagger-codegen/src/main/resources/erlang-server/api.mustache b/modules/swagger-codegen/src/main/resources/erlang-server/api.mustache index 355cfad6dae3..d948bbae4b29 100644 --- a/modules/swagger-codegen/src/main/resources/erlang-server/api.mustache +++ b/modules/swagger-codegen/src/main/resources/erlang-server/api.mustache @@ -70,7 +70,7 @@ request_param_info('{{operationId}}', {{^isBodyParam}}'{{baseName}}'{{/isBodyPar {exclusive_min, {{exclusiveMinimum}} },{{/exclusiveMinimum}}{{#maxLength}} {max_length, {{maxLength}} },{{/maxLength}}{{#minLength}} {min_length, {{minLength}} },{{/minLength}}{{#pattern}} - {pattern, "{{pattern}}" },{{/pattern}}{{#isBodyParam}} + {pattern, "{{{pattern}}}" },{{/pattern}}{{#isBodyParam}} schema,{{/isBodyParam}}{{#required}} required{{/required}}{{^required}} not_required{{/required}} diff --git a/modules/swagger-codegen/src/main/resources/ze-ph/model.mustache b/modules/swagger-codegen/src/main/resources/ze-ph/model.mustache index 69201b27e5a4..5aad31bf70f7 100644 --- a/modules/swagger-codegen/src/main/resources/ze-ph/model.mustache +++ b/modules/swagger-codegen/src/main/resources/ze-ph/model.mustache @@ -120,7 +120,7 @@ class {{classname}} * @DTA\Validator(name="LessThan", options={"max":{{maximum}}{{^exclusiveMaximum}}, "inclusive":true{{/exclusiveMaximum}}}) {{/maximum}} {{#pattern}} - * @DTA\Validator(name="Regex", options={"pattern":"{{pattern}}}) + * @DTA\Validator(name="Regex", options={"pattern":"{{{pattern}}}"}) {{/pattern}} {{/hasValidation}} * @var {{datatype}} diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/AdditionalPropertiesClass.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/AdditionalPropertiesClass.cs index 88a5e642fd0d..7a21399351d7 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/AdditionalPropertiesClass.cs +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/AdditionalPropertiesClass.cs @@ -133,7 +133,7 @@ namespace IO.Swagger.Model /// Validation context /// Validation Result IEnumerable IValidatableObject.Validate(ValidationContext validationContext) - { + { yield break; } } diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/Animal.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/Animal.cs index cf28babdb7fa..e98e2cb8b284 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/Animal.cs +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/Animal.cs @@ -154,7 +154,7 @@ namespace IO.Swagger.Model /// Validation context /// Validation Result IEnumerable IValidatableObject.Validate(ValidationContext validationContext) - { + { yield break; } } diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/AnimalFarm.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/AnimalFarm.cs index 4f1b7bcac796..4f8a821b7609 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/AnimalFarm.cs +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/AnimalFarm.cs @@ -104,7 +104,7 @@ namespace IO.Swagger.Model /// Validation context /// Validation Result IEnumerable IValidatableObject.Validate(ValidationContext validationContext) - { + { yield break; } } diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/ApiResponse.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/ApiResponse.cs index 9184ed576ea9..d7d6049bab32 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/ApiResponse.cs +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/ApiResponse.cs @@ -148,7 +148,7 @@ namespace IO.Swagger.Model /// Validation context /// Validation Result IEnumerable IValidatableObject.Validate(ValidationContext validationContext) - { + { yield break; } } diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/ArrayOfArrayOfNumberOnly.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/ArrayOfArrayOfNumberOnly.cs index 932af1e22c5c..f4dc6e658f4c 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/ArrayOfArrayOfNumberOnly.cs +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/ArrayOfArrayOfNumberOnly.cs @@ -118,7 +118,7 @@ namespace IO.Swagger.Model /// Validation context /// Validation Result IEnumerable IValidatableObject.Validate(ValidationContext validationContext) - { + { yield break; } } diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/ArrayOfNumberOnly.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/ArrayOfNumberOnly.cs index c05593cb075f..1d92b9bdd6c9 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/ArrayOfNumberOnly.cs +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/ArrayOfNumberOnly.cs @@ -118,7 +118,7 @@ namespace IO.Swagger.Model /// Validation context /// Validation Result IEnumerable IValidatableObject.Validate(ValidationContext validationContext) - { + { yield break; } } diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/ArrayTest.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/ArrayTest.cs index c73a118a7dee..490886a74a88 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/ArrayTest.cs +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/ArrayTest.cs @@ -148,7 +148,7 @@ namespace IO.Swagger.Model /// Validation context /// Validation Result IEnumerable IValidatableObject.Validate(ValidationContext validationContext) - { + { yield break; } } diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/Capitalization.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/Capitalization.cs index 236a213f8e0f..b6ba725b1842 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/Capitalization.cs +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/Capitalization.cs @@ -194,7 +194,7 @@ namespace IO.Swagger.Model /// Validation context /// Validation Result IEnumerable IValidatableObject.Validate(ValidationContext validationContext) - { + { yield break; } } diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/Cat.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/Cat.cs index 25893b0bf981..76cad24b4c6c 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/Cat.cs +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/Cat.cs @@ -169,7 +169,7 @@ namespace IO.Swagger.Model /// Validation context /// Validation Result IEnumerable IValidatableObject.Validate(ValidationContext validationContext) - { + { yield break; } } diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/Category.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/Category.cs index 5abe2c2d7902..8d0be0d7626f 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/Category.cs +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/Category.cs @@ -133,7 +133,7 @@ namespace IO.Swagger.Model /// Validation context /// Validation Result IEnumerable IValidatableObject.Validate(ValidationContext validationContext) - { + { yield break; } } diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/ClassModel.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/ClassModel.cs index 2c190f97a27a..ac65cbfc8c3d 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/ClassModel.cs +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/ClassModel.cs @@ -118,7 +118,7 @@ namespace IO.Swagger.Model /// Validation context /// Validation Result IEnumerable IValidatableObject.Validate(ValidationContext validationContext) - { + { yield break; } } diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/Dog.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/Dog.cs index e28d76358059..fe866fc0d967 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/Dog.cs +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/Dog.cs @@ -169,7 +169,7 @@ namespace IO.Swagger.Model /// Validation context /// Validation Result IEnumerable IValidatableObject.Validate(ValidationContext validationContext) - { + { yield break; } } diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/EnumArrays.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/EnumArrays.cs index 7db74d5ba97b..45b4c8d02277 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/EnumArrays.cs +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/EnumArrays.cs @@ -174,7 +174,7 @@ namespace IO.Swagger.Model /// Validation context /// Validation Result IEnumerable IValidatableObject.Validate(ValidationContext validationContext) - { + { yield break; } } diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/EnumTest.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/EnumTest.cs index a75564c1b0d9..f925bfe78b53 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/EnumTest.cs +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/EnumTest.cs @@ -229,7 +229,7 @@ namespace IO.Swagger.Model /// Validation context /// Validation Result IEnumerable IValidatableObject.Validate(ValidationContext validationContext) - { + { yield break; } } diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/FormatTest.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/FormatTest.cs index 21d4c7494fef..67f0fd05288f 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/FormatTest.cs +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/FormatTest.cs @@ -335,7 +335,7 @@ namespace IO.Swagger.Model /// Validation context /// Validation Result IEnumerable IValidatableObject.Validate(ValidationContext validationContext) - { + { // Integer (int?) maximum if(this.Integer > (int?)100) { diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/HasOnlyReadOnly.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/HasOnlyReadOnly.cs index acd815249125..40c8e3b4680d 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/HasOnlyReadOnly.cs +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/HasOnlyReadOnly.cs @@ -130,7 +130,7 @@ namespace IO.Swagger.Model /// Validation context /// Validation Result IEnumerable IValidatableObject.Validate(ValidationContext validationContext) - { + { yield break; } } diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/List.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/List.cs index ff51ee5c4596..518e9f95c489 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/List.cs +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/List.cs @@ -118,7 +118,7 @@ namespace IO.Swagger.Model /// Validation context /// Validation Result IEnumerable IValidatableObject.Validate(ValidationContext validationContext) - { + { yield break; } } diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/MapTest.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/MapTest.cs index d8dcf33a1805..7a5a392e2ae9 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/MapTest.cs +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/MapTest.cs @@ -154,7 +154,7 @@ namespace IO.Swagger.Model /// Validation context /// Validation Result IEnumerable IValidatableObject.Validate(ValidationContext validationContext) - { + { yield break; } } diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/MixedPropertiesAndAdditionalPropertiesClass.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/MixedPropertiesAndAdditionalPropertiesClass.cs index 2af3ddb155f2..69a3df1d99eb 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/MixedPropertiesAndAdditionalPropertiesClass.cs +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/MixedPropertiesAndAdditionalPropertiesClass.cs @@ -148,7 +148,7 @@ namespace IO.Swagger.Model /// Validation context /// Validation Result IEnumerable IValidatableObject.Validate(ValidationContext validationContext) - { + { yield break; } } diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/Model200Response.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/Model200Response.cs index aaafb1937ffe..46b81508e53b 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/Model200Response.cs +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/Model200Response.cs @@ -133,7 +133,7 @@ namespace IO.Swagger.Model /// Validation context /// Validation Result IEnumerable IValidatableObject.Validate(ValidationContext validationContext) - { + { yield break; } } diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/ModelClient.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/ModelClient.cs index 5d9456811489..78a59e7b8b4d 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/ModelClient.cs +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/ModelClient.cs @@ -118,7 +118,7 @@ namespace IO.Swagger.Model /// Validation context /// Validation Result IEnumerable IValidatableObject.Validate(ValidationContext validationContext) - { + { yield break; } } diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/ModelReturn.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/ModelReturn.cs index 3a5c85d6cccb..072123896bc6 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/ModelReturn.cs +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/ModelReturn.cs @@ -118,7 +118,7 @@ namespace IO.Swagger.Model /// Validation context /// Validation Result IEnumerable IValidatableObject.Validate(ValidationContext validationContext) - { + { yield break; } } diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/Name.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/Name.cs index 3d751d0aca14..8011d5efaf1f 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/Name.cs +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/Name.cs @@ -172,7 +172,7 @@ namespace IO.Swagger.Model /// Validation context /// Validation Result IEnumerable IValidatableObject.Validate(ValidationContext validationContext) - { + { yield break; } } diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/NumberOnly.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/NumberOnly.cs index 98c4d4e700fd..c2c22c6638a5 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/NumberOnly.cs +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/NumberOnly.cs @@ -118,7 +118,7 @@ namespace IO.Swagger.Model /// Validation context /// Validation Result IEnumerable IValidatableObject.Validate(ValidationContext validationContext) - { + { yield break; } } diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/Order.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/Order.cs index e783c71f4cdf..7edf5127127c 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/Order.cs +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/Order.cs @@ -229,7 +229,7 @@ namespace IO.Swagger.Model /// Validation context /// Validation Result IEnumerable IValidatableObject.Validate(ValidationContext validationContext) - { + { yield break; } } diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/Pet.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/Pet.cs index 30381e1b1cea..671a476bdce6 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/Pet.cs +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/Pet.cs @@ -242,7 +242,7 @@ namespace IO.Swagger.Model /// Validation context /// Validation Result IEnumerable IValidatableObject.Validate(ValidationContext validationContext) - { + { yield break; } } diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/ReadOnlyFirst.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/ReadOnlyFirst.cs index 06dbaf06c391..0eb2195e7f14 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/ReadOnlyFirst.cs +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/ReadOnlyFirst.cs @@ -131,7 +131,7 @@ namespace IO.Swagger.Model /// Validation context /// Validation Result IEnumerable IValidatableObject.Validate(ValidationContext validationContext) - { + { yield break; } } diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/SpecialModelName.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/SpecialModelName.cs index 469ed8e00811..82d030f2cac6 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/SpecialModelName.cs +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/SpecialModelName.cs @@ -118,7 +118,7 @@ namespace IO.Swagger.Model /// Validation context /// Validation Result IEnumerable IValidatableObject.Validate(ValidationContext validationContext) - { + { yield break; } } diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/Tag.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/Tag.cs index a84c3b03d41a..36028491dacb 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/Tag.cs +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/Tag.cs @@ -133,7 +133,7 @@ namespace IO.Swagger.Model /// Validation context /// Validation Result IEnumerable IValidatableObject.Validate(ValidationContext validationContext) - { + { yield break; } } diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/User.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/User.cs index 260e2b768be1..b12ede328064 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/User.cs +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/User.cs @@ -224,7 +224,7 @@ namespace IO.Swagger.Model /// Validation context /// Validation Result IEnumerable IValidatableObject.Validate(ValidationContext validationContext) - { + { yield break; } } diff --git a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/AdditionalPropertiesClass.cs b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/AdditionalPropertiesClass.cs index 092158675618..7785114129a5 100644 --- a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/AdditionalPropertiesClass.cs +++ b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/AdditionalPropertiesClass.cs @@ -156,7 +156,7 @@ namespace IO.Swagger.Model /// Validation context /// Validation Result IEnumerable IValidatableObject.Validate(ValidationContext validationContext) - { + { yield break; } } diff --git a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/Animal.cs b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/Animal.cs index 799ae667725d..b413f459d066 100644 --- a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/Animal.cs +++ b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/Animal.cs @@ -177,7 +177,7 @@ namespace IO.Swagger.Model /// Validation context /// Validation Result IEnumerable IValidatableObject.Validate(ValidationContext validationContext) - { + { yield break; } } diff --git a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/AnimalFarm.cs b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/AnimalFarm.cs index 0c3ad671a3fa..3931774f6220 100644 --- a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/AnimalFarm.cs +++ b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/AnimalFarm.cs @@ -127,7 +127,7 @@ namespace IO.Swagger.Model /// Validation context /// Validation Result IEnumerable IValidatableObject.Validate(ValidationContext validationContext) - { + { yield break; } } diff --git a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/ApiResponse.cs b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/ApiResponse.cs index 7eb20721639d..d1f9a5ccecad 100644 --- a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/ApiResponse.cs +++ b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/ApiResponse.cs @@ -171,7 +171,7 @@ namespace IO.Swagger.Model /// Validation context /// Validation Result IEnumerable IValidatableObject.Validate(ValidationContext validationContext) - { + { yield break; } } diff --git a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/ArrayOfArrayOfNumberOnly.cs b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/ArrayOfArrayOfNumberOnly.cs index 729d5cb74eb8..ed861217570b 100644 --- a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/ArrayOfArrayOfNumberOnly.cs +++ b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/ArrayOfArrayOfNumberOnly.cs @@ -141,7 +141,7 @@ namespace IO.Swagger.Model /// Validation context /// Validation Result IEnumerable IValidatableObject.Validate(ValidationContext validationContext) - { + { yield break; } } diff --git a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/ArrayOfNumberOnly.cs b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/ArrayOfNumberOnly.cs index 7e04be5927fd..df8c9a0a9545 100644 --- a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/ArrayOfNumberOnly.cs +++ b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/ArrayOfNumberOnly.cs @@ -141,7 +141,7 @@ namespace IO.Swagger.Model /// Validation context /// Validation Result IEnumerable IValidatableObject.Validate(ValidationContext validationContext) - { + { yield break; } } diff --git a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/ArrayTest.cs b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/ArrayTest.cs index 7761e0855ee4..70c8ce1f8f3d 100644 --- a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/ArrayTest.cs +++ b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/ArrayTest.cs @@ -171,7 +171,7 @@ namespace IO.Swagger.Model /// Validation context /// Validation Result IEnumerable IValidatableObject.Validate(ValidationContext validationContext) - { + { yield break; } } diff --git a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/Capitalization.cs b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/Capitalization.cs index 57fab83bd95b..b852774c4603 100644 --- a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/Capitalization.cs +++ b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/Capitalization.cs @@ -217,7 +217,7 @@ namespace IO.Swagger.Model /// Validation context /// Validation Result IEnumerable IValidatableObject.Validate(ValidationContext validationContext) - { + { yield break; } } diff --git a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/Cat.cs b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/Cat.cs index 89846764f3e7..912a86f02872 100644 --- a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/Cat.cs +++ b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/Cat.cs @@ -192,7 +192,7 @@ namespace IO.Swagger.Model /// Validation context /// Validation Result IEnumerable IValidatableObject.Validate(ValidationContext validationContext) - { + { yield break; } } diff --git a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/Category.cs b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/Category.cs index d289bd14dc2a..0444b24f73b6 100644 --- a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/Category.cs +++ b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/Category.cs @@ -156,7 +156,7 @@ namespace IO.Swagger.Model /// Validation context /// Validation Result IEnumerable IValidatableObject.Validate(ValidationContext validationContext) - { + { yield break; } } diff --git a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/ClassModel.cs b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/ClassModel.cs index 7ef8228cade0..383d2ca5c92e 100644 --- a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/ClassModel.cs +++ b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/ClassModel.cs @@ -141,7 +141,7 @@ namespace IO.Swagger.Model /// Validation context /// Validation Result IEnumerable IValidatableObject.Validate(ValidationContext validationContext) - { + { yield break; } } diff --git a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/Dog.cs b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/Dog.cs index ef9e9d0a3843..f80391d4e339 100644 --- a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/Dog.cs +++ b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/Dog.cs @@ -192,7 +192,7 @@ namespace IO.Swagger.Model /// Validation context /// Validation Result IEnumerable IValidatableObject.Validate(ValidationContext validationContext) - { + { yield break; } } diff --git a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/EnumArrays.cs b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/EnumArrays.cs index ec785f28a54f..e0b8f2cb4622 100644 --- a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/EnumArrays.cs +++ b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/EnumArrays.cs @@ -197,7 +197,7 @@ namespace IO.Swagger.Model /// Validation context /// Validation Result IEnumerable IValidatableObject.Validate(ValidationContext validationContext) - { + { yield break; } } diff --git a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/EnumTest.cs b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/EnumTest.cs index c0420f83090d..88b365261423 100644 --- a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/EnumTest.cs +++ b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/EnumTest.cs @@ -252,7 +252,7 @@ namespace IO.Swagger.Model /// Validation context /// Validation Result IEnumerable IValidatableObject.Validate(ValidationContext validationContext) - { + { yield break; } } diff --git a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/FormatTest.cs b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/FormatTest.cs index 916bd3ec1622..fe9be65ebc69 100644 --- a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/FormatTest.cs +++ b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/FormatTest.cs @@ -358,7 +358,7 @@ namespace IO.Swagger.Model /// Validation context /// Validation Result IEnumerable IValidatableObject.Validate(ValidationContext validationContext) - { + { // Integer (int?) maximum if(this.Integer > (int?)100) { diff --git a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/HasOnlyReadOnly.cs b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/HasOnlyReadOnly.cs index a8aacc186127..941ef2903fe8 100644 --- a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/HasOnlyReadOnly.cs +++ b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/HasOnlyReadOnly.cs @@ -153,7 +153,7 @@ namespace IO.Swagger.Model /// Validation context /// Validation Result IEnumerable IValidatableObject.Validate(ValidationContext validationContext) - { + { yield break; } } diff --git a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/List.cs b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/List.cs index 2a0afa0a13c1..d73f9cb0b501 100644 --- a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/List.cs +++ b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/List.cs @@ -141,7 +141,7 @@ namespace IO.Swagger.Model /// Validation context /// Validation Result IEnumerable IValidatableObject.Validate(ValidationContext validationContext) - { + { yield break; } } diff --git a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/MapTest.cs b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/MapTest.cs index 1e3c9b537783..f70a33c4991e 100644 --- a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/MapTest.cs +++ b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/MapTest.cs @@ -177,7 +177,7 @@ namespace IO.Swagger.Model /// Validation context /// Validation Result IEnumerable IValidatableObject.Validate(ValidationContext validationContext) - { + { yield break; } } diff --git a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/MixedPropertiesAndAdditionalPropertiesClass.cs b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/MixedPropertiesAndAdditionalPropertiesClass.cs index e485c0a08839..962e8c102b9d 100644 --- a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/MixedPropertiesAndAdditionalPropertiesClass.cs +++ b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/MixedPropertiesAndAdditionalPropertiesClass.cs @@ -171,7 +171,7 @@ namespace IO.Swagger.Model /// Validation context /// Validation Result IEnumerable IValidatableObject.Validate(ValidationContext validationContext) - { + { yield break; } } diff --git a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/Model200Response.cs b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/Model200Response.cs index 89b25b94367e..afe5bd26adf2 100644 --- a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/Model200Response.cs +++ b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/Model200Response.cs @@ -156,7 +156,7 @@ namespace IO.Swagger.Model /// Validation context /// Validation Result IEnumerable IValidatableObject.Validate(ValidationContext validationContext) - { + { yield break; } } diff --git a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/ModelClient.cs b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/ModelClient.cs index d98021ff5533..f93b57fdc18f 100644 --- a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/ModelClient.cs +++ b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/ModelClient.cs @@ -141,7 +141,7 @@ namespace IO.Swagger.Model /// Validation context /// Validation Result IEnumerable IValidatableObject.Validate(ValidationContext validationContext) - { + { yield break; } } diff --git a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/ModelReturn.cs b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/ModelReturn.cs index c19880adc384..7e616766372c 100644 --- a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/ModelReturn.cs +++ b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/ModelReturn.cs @@ -141,7 +141,7 @@ namespace IO.Swagger.Model /// Validation context /// Validation Result IEnumerable IValidatableObject.Validate(ValidationContext validationContext) - { + { yield break; } } diff --git a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/Name.cs b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/Name.cs index 4cb27c59f036..905093d24a99 100644 --- a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/Name.cs +++ b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/Name.cs @@ -195,7 +195,7 @@ namespace IO.Swagger.Model /// Validation context /// Validation Result IEnumerable IValidatableObject.Validate(ValidationContext validationContext) - { + { yield break; } } diff --git a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/NumberOnly.cs b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/NumberOnly.cs index d352e4a45987..c6aaa57e0021 100644 --- a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/NumberOnly.cs +++ b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/NumberOnly.cs @@ -141,7 +141,7 @@ namespace IO.Swagger.Model /// Validation context /// Validation Result IEnumerable IValidatableObject.Validate(ValidationContext validationContext) - { + { yield break; } } diff --git a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/Order.cs b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/Order.cs index 4e5c4c898ac9..a1cdffcdec98 100644 --- a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/Order.cs +++ b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/Order.cs @@ -252,7 +252,7 @@ namespace IO.Swagger.Model /// Validation context /// Validation Result IEnumerable IValidatableObject.Validate(ValidationContext validationContext) - { + { yield break; } } diff --git a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/Pet.cs b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/Pet.cs index 305f6918a372..9b6970b0ed20 100644 --- a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/Pet.cs +++ b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/Pet.cs @@ -265,7 +265,7 @@ namespace IO.Swagger.Model /// Validation context /// Validation Result IEnumerable IValidatableObject.Validate(ValidationContext validationContext) - { + { yield break; } } diff --git a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/ReadOnlyFirst.cs b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/ReadOnlyFirst.cs index 61e534f2f53c..a89bdeda4e17 100644 --- a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/ReadOnlyFirst.cs +++ b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/ReadOnlyFirst.cs @@ -154,7 +154,7 @@ namespace IO.Swagger.Model /// Validation context /// Validation Result IEnumerable IValidatableObject.Validate(ValidationContext validationContext) - { + { yield break; } } diff --git a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/SpecialModelName.cs b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/SpecialModelName.cs index 1bac10087c48..2954a5110e62 100644 --- a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/SpecialModelName.cs +++ b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/SpecialModelName.cs @@ -141,7 +141,7 @@ namespace IO.Swagger.Model /// Validation context /// Validation Result IEnumerable IValidatableObject.Validate(ValidationContext validationContext) - { + { yield break; } } diff --git a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/Tag.cs b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/Tag.cs index f1451c72cb0e..1534f6a6f4d9 100644 --- a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/Tag.cs +++ b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/Tag.cs @@ -156,7 +156,7 @@ namespace IO.Swagger.Model /// Validation context /// Validation Result IEnumerable IValidatableObject.Validate(ValidationContext validationContext) - { + { yield break; } } diff --git a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/User.cs b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/User.cs index 44ec3bfcecf0..1a85d52c0d62 100644 --- a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/User.cs +++ b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/User.cs @@ -247,7 +247,7 @@ namespace IO.Swagger.Model /// Validation context /// Validation Result IEnumerable IValidatableObject.Validate(ValidationContext validationContext) - { + { yield break; } }