From 2324e927bd2b058604eec1fea5d904773de036c4 Mon Sep 17 00:00:00 2001 From: wing328 Date: Fri, 28 Apr 2017 00:45:06 +0800 Subject: [PATCH] [Java][Spring] fix missing import for java.io.IOException (#5501) * fix issue about import io exception for spring mvc * fix spring-mvc-petstore-j8-async script, config * update spring cloud client, restore petstore.yaml --- bin/spring-mvc-petstore-j8-async-server.sh | 2 +- bin/spring-mvc-petstore-j8-async.json | 5 +- .../main/resources/JavaSpring/api.mustache | 2 +- .../JavaSpring/apiController.mustache | 11 +- .../src/test/resources/2_0/petstore.yaml | 242 ++++++++++-------- .../src/main/java/io/swagger/api/PetApi.java | 1 - .../main/java/io/swagger/api/StoreApi.java | 1 - .../src/main/java/io/swagger/api/UserApi.java | 1 - .../petstore/spring-mvc-j8-async/pom.xml | 4 +- .../src/main/java/io/swagger/api/FakeApi.java | 2 +- .../io/swagger/api/FakeApiController.java | 9 +- .../src/main/java/io/swagger/api/PetApi.java | 4 +- .../java/io/swagger/api/PetApiController.java | 9 +- .../io/swagger/api/StoreApiController.java | 9 +- .../src/main/java/io/swagger/api/UserApi.java | 2 +- .../io/swagger/api/UserApiController.java | 9 +- .../swagger/configuration/HomeController.java | 16 ++ .../configuration/SwaggerUiConfiguration.java | 20 +- .../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/resources/application.properties | 5 + .../src/main/java/io/swagger/api/FakeApi.java | 2 +- .../io/swagger/api/FakeApiController.java | 11 +- .../src/main/java/io/swagger/api/PetApi.java | 4 +- .../java/io/swagger/api/PetApiController.java | 9 +- .../io/swagger/api/StoreApiController.java | 5 +- .../src/main/java/io/swagger/api/UserApi.java | 2 +- .../io/swagger/api/UserApiController.java | 9 +- .../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 ++ 88 files changed, 714 insertions(+), 166 deletions(-) create mode 100644 samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/configuration/HomeController.java create mode 100644 samples/server/petstore/spring-mvc-j8-async/src/main/resources/application.properties diff --git a/bin/spring-mvc-petstore-j8-async-server.sh b/bin/spring-mvc-petstore-j8-async-server.sh index 1dd6f039836..fb092630f39 100755 --- a/bin/spring-mvc-petstore-j8-async-server.sh +++ b/bin/spring-mvc-petstore-j8-async-server.sh @@ -26,6 +26,6 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="$@ generate -t modules/swagger-codegen/src/main/resources/JavaSpring -i modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -l spring --library spring-mvc -o samples/server/petstore/spring-mvc-j8-async -c bin/spring-mvc-petstore-j8-async.json -DhideGenerationTimestamp=true,java8=true,async=true" +ags="$@ generate -t modules/swagger-codegen/src/main/resources/JavaSpring -i modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -l spring -o samples/server/petstore/spring-mvc-j8-async -c bin/spring-mvc-petstore-j8-async.json -DhideGenerationTimestamp=true,java8=true,async=true" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/spring-mvc-petstore-j8-async.json b/bin/spring-mvc-petstore-j8-async.json index c19430ec9ab..92baa989c36 100644 --- a/bin/spring-mvc-petstore-j8-async.json +++ b/bin/spring-mvc-petstore-j8-async.json @@ -1,3 +1,6 @@ { - "library": "j8-async" + "java8": true, + "async": true, + "library": "spring-mvc", + "artifactId": "swagger-spring-mvc-server-j8-async" } diff --git a/modules/swagger-codegen/src/main/resources/JavaSpring/api.mustache b/modules/swagger-codegen/src/main/resources/JavaSpring/api.mustache index 610c97e4117..66b73539ca1 100644 --- a/modules/swagger-codegen/src/main/resources/JavaSpring/api.mustache +++ b/modules/swagger-codegen/src/main/resources/JavaSpring/api.mustache @@ -16,7 +16,7 @@ import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestPart; import org.springframework.web.multipart.MultipartFile; -{{#useSpringCloudClient}} +{{^useSpringCloudClient}} import java.io.IOException; {{/useSpringCloudClient}} diff --git a/modules/swagger-codegen/src/main/resources/JavaSpring/apiController.mustache b/modules/swagger-codegen/src/main/resources/JavaSpring/apiController.mustache index c2f437970ab..bef1835b9a2 100644 --- a/modules/swagger-codegen/src/main/resources/JavaSpring/apiController.mustache +++ b/modules/swagger-codegen/src/main/resources/JavaSpring/apiController.mustache @@ -17,15 +17,16 @@ 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; -{{^useSpringCloudClient}} -import com.fasterxml.jackson.databind.ObjectMapper; -import java.io.IOException; -{{/useSpringCloudClient}} import java.util.List; {{#async}} import java.util.concurrent.Callable; -{{/async}}{{/jdk8-no-delegate}} +{{/async}} +{{/jdk8-no-delegate}} +{{^useSpringCloudClient}} +import com.fasterxml.jackson.databind.ObjectMapper; +import java.io.IOException; +{{/useSpringCloudClient}} {{#useBeanValidation}} import javax.validation.constraints.*; import javax.validation.Valid; diff --git a/modules/swagger-codegen/src/test/resources/2_0/petstore.yaml b/modules/swagger-codegen/src/test/resources/2_0/petstore.yaml index 692689565da..e3ba184ea57 100644 --- a/modules/swagger-codegen/src/test/resources/2_0/petstore.yaml +++ b/modules/swagger-codegen/src/test/resources/2_0/petstore.yaml @@ -1,20 +1,29 @@ swagger: '2.0' info: - description: >- - This is a sample server Petstore server. You can find out more about - Swagger at http://swagger.io or on - irc.freenode.net, #swagger. For this sample, you can use the api key - "special-key" to test the authorization filters + description: 'This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.' version: 1.0.0 title: Swagger Petstore - termsOfService: 'http://helloreverb.com/terms/' + termsOfService: 'http://swagger.io/terms/' contact: - email: apiteam@wordnik.com + email: apiteam@swagger.io license: name: Apache 2.0 url: 'http://www.apache.org/licenses/LICENSE-2.0.html' host: petstore.swagger.io basePath: /v2 +tags: + - name: pet + description: Everything about your Pets + externalDocs: + description: Find out more + url: 'http://swagger.io' + - name: store + description: Access to Petstore orders + - name: user + description: Operations about user + externalDocs: + description: Find out more about our store + url: 'http://swagger.io' schemes: - http paths: @@ -29,13 +38,13 @@ paths: - application/json - application/xml produces: - - application/json - application/xml + - application/json parameters: - in: body name: body description: Pet object that needs to be added to the store - required: false + required: true schema: $ref: '#/definitions/Pet' responses: @@ -55,13 +64,13 @@ paths: - application/json - application/xml produces: - - application/json - application/xml + - application/json parameters: - in: body name: body description: Pet object that needs to be added to the store - required: false + required: true schema: $ref: '#/definitions/Pet' responses: @@ -83,13 +92,13 @@ paths: description: Multiple status values can be provided with comma separated strings operationId: findPetsByStatus produces: - - application/json - application/xml + - application/json parameters: - name: status in: query description: Status values that need to be considered for filter - required: false + required: true type: array items: type: string @@ -97,8 +106,8 @@ paths: - available - pending - sold - collectionFormat: multi - default: available + default: available + collectionFormat: csv responses: '200': description: successful operation @@ -106,13 +115,6 @@ paths: type: array items: $ref: '#/definitions/Pet' - examples: - application/json: - name: Puma - type: Dog - color: Black - gender: Female - breed: Mixed '400': description: Invalid status value security: @@ -124,22 +126,20 @@ paths: tags: - pet summary: Finds Pets by tags - description: >- - Multiple tags can be provided with comma separated strings. Use tag1, - tag2, tag3 for testing. + description: 'Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.' operationId: findPetsByTags produces: - - application/json - application/xml + - application/json parameters: - name: tags in: query description: Tags to filter by - required: false + required: true type: array items: type: string - collectionFormat: multi + collectionFormat: csv responses: '200': description: successful operation @@ -158,17 +158,15 @@ paths: tags: - pet summary: Find pet by ID - description: >- - Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API - error conditions + description: Returns a single pet operationId: getPetById produces: - - application/json - application/xml + - application/json parameters: - name: petId in: path - description: ID of pet that needs to be fetched + description: ID of pet to return required: true type: integer format: int64 @@ -183,9 +181,6 @@ paths: description: Pet not found security: - api_key: [] - - petstore_auth: - - 'write:pets' - - 'read:pets' post: tags: - pet @@ -195,14 +190,15 @@ paths: consumes: - application/x-www-form-urlencoded produces: - - application/json - application/xml + - application/json parameters: - name: petId in: path description: ID of pet that needs to be updated required: true - type: string + type: integer + format: int64 - name: name in: formData description: Updated name of the pet @@ -227,12 +223,11 @@ paths: description: '' operationId: deletePet produces: - - application/json - application/xml + - application/json parameters: - name: api_key in: header - description: '' required: false type: string - name: petId @@ -259,7 +254,6 @@ paths: - multipart/form-data produces: - application/json - - application/xml parameters: - name: petId in: path @@ -278,8 +272,10 @@ paths: required: false type: file responses: - default: + '200': description: successful operation + schema: + $ref: '#/definitions/ApiResponse' security: - petstore_auth: - 'write:pets' @@ -293,7 +289,7 @@ paths: operationId: getInventory produces: - application/json - - application/xml + parameters: [] responses: '200': description: successful operation @@ -312,13 +308,13 @@ paths: description: '' operationId: placeOrder produces: - - application/json - application/xml + - application/json parameters: - in: body name: body description: order placed for purchasing the pet - required: false + required: true schema: $ref: '#/definitions/Order' responses: @@ -333,19 +329,20 @@ paths: tags: - store summary: Find purchase order by ID - description: >- - For valid response try integer IDs with value <= 5 or > 10. Other values - will generated exceptions + description: 'For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions' operationId: getOrderById produces: - - application/json - application/xml + - application/json parameters: - name: orderId in: path description: ID of pet that needs to be fetched required: true - type: string + type: integer + maximum: 5 + minimum: 1 + format: int64 responses: '200': description: successful operation @@ -359,13 +356,11 @@ paths: tags: - store summary: Delete purchase order by ID - description: >- - For valid response try integer IDs with value < 1000. Anything above - 1000 or nonintegers will generate API errors + description: For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors operationId: deleteOrder produces: - - application/json - application/xml + - application/json parameters: - name: orderId in: path @@ -385,13 +380,13 @@ paths: description: This can only be done by the logged in user. operationId: createUser produces: - - application/json - application/xml + - application/json parameters: - in: body name: body description: Created user object - required: false + required: true schema: $ref: '#/definitions/User' responses: @@ -405,13 +400,13 @@ paths: description: '' operationId: createUsersWithArrayInput produces: - - application/json - application/xml + - application/json parameters: - in: body name: body description: List of user object - required: false + required: true schema: type: array items: @@ -427,13 +422,13 @@ paths: description: '' operationId: createUsersWithListInput produces: - - application/json - application/xml + - application/json parameters: - in: body name: body description: List of user object - required: false + required: true schema: type: array items: @@ -449,24 +444,33 @@ paths: description: '' operationId: loginUser produces: - - application/json - application/xml + - application/json parameters: - name: username in: query description: The user name for login - required: false + required: true type: string - name: password in: query description: The password for login in clear text - required: false + required: true type: string responses: '200': description: successful operation schema: type: string + headers: + X-Rate-Limit: + type: integer + format: int32 + description: calls per hour allowed by the user + X-Expires-After: + type: string + format: date-time + description: date in UTC when toekn expires '400': description: Invalid username/password supplied /user/logout: @@ -477,8 +481,9 @@ paths: description: '' operationId: logoutUser produces: - - application/json - application/xml + - application/json + parameters: [] responses: default: description: successful operation @@ -490,8 +495,8 @@ paths: description: '' operationId: getUserByName produces: - - application/json - application/xml + - application/json parameters: - name: username in: path @@ -514,8 +519,8 @@ paths: description: This can only be done by the logged in user. operationId: updateUser produces: - - application/json - application/xml + - application/json parameters: - name: username in: path @@ -525,7 +530,7 @@ paths: - in: body name: body description: Updated user object - required: false + required: true schema: $ref: '#/definitions/User' responses: @@ -540,8 +545,8 @@ paths: description: This can only be done by the logged in user. operationId: deleteUser produces: - - application/json - application/xml + - application/json parameters: - name: username in: path @@ -554,10 +559,6 @@ paths: '404': description: User not found securityDefinitions: - api_key: - type: apiKey - name: api_key - in: header petstore_auth: type: oauth2 authorizationUrl: 'http://petstore.swagger.io/api/oauth/dialog' @@ -565,8 +566,56 @@ securityDefinitions: scopes: 'write:pets': modify pets in your account 'read:pets': read your pets + api_key: + type: apiKey + name: api_key + in: header definitions: + Order: + title: Pet Order + description: An order for a pets from the pet store + type: object + properties: + id: + type: integer + format: int64 + petId: + type: integer + format: int64 + quantity: + type: integer + format: int32 + shipDate: + type: string + format: date-time + status: + type: string + description: Order Status + enum: + - placed + - approved + - delivered + complete: + type: boolean + default: false + xml: + name: Order + Category: + title: Pet catehgry + description: A category for a pet + type: object + properties: + id: + type: integer + format: int64 + name: + type: string + xml: + name: Category User: + title: a User + description: A User who is purchasing from the pet store + type: object properties: id: type: integer @@ -589,7 +638,10 @@ definitions: description: User Status xml: name: User - Category: + Tag: + title: Pet Tag + description: A tag for a pet + type: object properties: id: type: integer @@ -597,8 +649,11 @@ definitions: name: type: string xml: - name: Category + name: Tag Pet: + title: a Pet + description: A pet for sale in the pet store + type: object required: - name - photoUrls @@ -634,37 +689,18 @@ definitions: - sold xml: name: Pet - Tag: + ApiResponse: + title: An uploaded response + description: Describes the result of uploading an image resource + type: object properties: - id: - type: integer - format: int64 - name: - type: string - xml: - name: Tag - Order: - properties: - id: - type: integer - format: int64 - petId: - type: integer - format: int64 - quantity: + code: type: integer format: int32 - shipDate: + type: type: string - format: date-time - status: + message: type: string - description: Order Status - enum: - - placed - - approved - - delivered - complete: - type: boolean - xml: - name: Order +externalDocs: + description: Find out more about Swagger + url: 'http://swagger.io' diff --git a/samples/client/petstore/spring-cloud/src/main/java/io/swagger/api/PetApi.java b/samples/client/petstore/spring-cloud/src/main/java/io/swagger/api/PetApi.java index 5839035f2d3..ad9c5c2929b 100644 --- a/samples/client/petstore/spring-cloud/src/main/java/io/swagger/api/PetApi.java +++ b/samples/client/petstore/spring-cloud/src/main/java/io/swagger/api/PetApi.java @@ -14,7 +14,6 @@ import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestPart; import org.springframework.web.multipart.MultipartFile; -import java.io.IOException; import java.util.List; import javax.validation.constraints.*; diff --git a/samples/client/petstore/spring-cloud/src/main/java/io/swagger/api/StoreApi.java b/samples/client/petstore/spring-cloud/src/main/java/io/swagger/api/StoreApi.java index a0757609319..c8a7cace4d5 100644 --- a/samples/client/petstore/spring-cloud/src/main/java/io/swagger/api/StoreApi.java +++ b/samples/client/petstore/spring-cloud/src/main/java/io/swagger/api/StoreApi.java @@ -13,7 +13,6 @@ import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestPart; import org.springframework.web.multipart.MultipartFile; -import java.io.IOException; import java.util.List; import javax.validation.constraints.*; diff --git a/samples/client/petstore/spring-cloud/src/main/java/io/swagger/api/UserApi.java b/samples/client/petstore/spring-cloud/src/main/java/io/swagger/api/UserApi.java index 3cef5aeb00c..b01bae3dc37 100644 --- a/samples/client/petstore/spring-cloud/src/main/java/io/swagger/api/UserApi.java +++ b/samples/client/petstore/spring-cloud/src/main/java/io/swagger/api/UserApi.java @@ -13,7 +13,6 @@ import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestPart; import org.springframework.web.multipart.MultipartFile; -import java.io.IOException; import java.util.List; import javax.validation.constraints.*; diff --git a/samples/server/petstore/spring-mvc-j8-async/pom.xml b/samples/server/petstore/spring-mvc-j8-async/pom.xml index 68a727affbb..0b555d8bd18 100644 --- a/samples/server/petstore/spring-mvc-j8-async/pom.xml +++ b/samples/server/petstore/spring-mvc-j8-async/pom.xml @@ -1,9 +1,9 @@ 4.0.0 io.swagger - swagger-spring + swagger-spring-mvc-server-j8-async jar - swagger-spring + swagger-spring-mvc-server-j8-async 1.0.0 src/main/java diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/FakeApi.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/FakeApi.java index 83e1a78e6bd..5dc9bce00ef 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/FakeApi.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/FakeApi.java @@ -63,7 +63,7 @@ public interface FakeApi { produces = { "*/*" }, consumes = { "*/*" }, method = RequestMethod.GET) - default CompletableFuture> 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) { + default CompletableFuture> 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 CompletableFuture.completedFuture(new ResponseEntity(HttpStatus.OK)); } diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/FakeApiController.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/FakeApiController.java index be29b9131ef..c9bf94efe6a 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/FakeApiController.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/FakeApiController.java @@ -1,10 +1,17 @@ package io.swagger.api; import org.springframework.stereotype.Controller; - +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; + } + } diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/PetApi.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/PetApi.java index a261cf7d4a4..1c4d6eade78 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/PetApi.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/PetApi.java @@ -72,7 +72,7 @@ public interface PetApi { @RequestMapping(value = "/pet/findByStatus", produces = { "application/xml", "application/json" }, method = RequestMethod.GET) - default CompletableFuture>> 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 { + default CompletableFuture>> 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 CompletableFuture.completedFuture(new ResponseEntity>(HttpStatus.OK)); } @@ -90,7 +90,7 @@ public interface PetApi { @RequestMapping(value = "/pet/findByTags", produces = { "application/xml", "application/json" }, method = RequestMethod.GET) - default CompletableFuture>> findPetsByTags( @NotNull @ApiParam(value = "Tags to filter by", required = true) @RequestParam(value = "tags", required = true) List tags, @RequestHeader("Accept") String accept) throws IOException { + default CompletableFuture>> 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 CompletableFuture.completedFuture(new ResponseEntity>(HttpStatus.OK)); } diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/PetApiController.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/PetApiController.java index b2774ec8115..5dd78a0e768 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/PetApiController.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/PetApiController.java @@ -1,10 +1,17 @@ package io.swagger.api; import org.springframework.stereotype.Controller; - +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; + } + } diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/StoreApiController.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/StoreApiController.java index b0bc99276d7..652923c800b 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/StoreApiController.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/StoreApiController.java @@ -1,10 +1,17 @@ package io.swagger.api; import org.springframework.stereotype.Controller; - +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; + } + } diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/UserApi.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/UserApi.java index f4d9d3dca8f..21aee4b1686 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/UserApi.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/UserApi.java @@ -94,7 +94,7 @@ public interface UserApi { @RequestMapping(value = "/user/login", produces = { "application/xml", "application/json" }, method = RequestMethod.GET) - default CompletableFuture> 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 { + default CompletableFuture> 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 CompletableFuture.completedFuture(new ResponseEntity(HttpStatus.OK)); } diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/UserApiController.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/UserApiController.java index f266cc48616..5afeac776dd 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/UserApiController.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/UserApiController.java @@ -1,10 +1,17 @@ package io.swagger.api; import org.springframework.stereotype.Controller; - +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; + } + } diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/configuration/HomeController.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/configuration/HomeController.java new file mode 100644 index 00000000000..f8328099284 --- /dev/null +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/configuration/HomeController.java @@ -0,0 +1,16 @@ +package io.swagger.configuration; + +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestMapping; + +/** + * Home redirection to swagger api documentation + */ +@Controller +public class HomeController { + @RequestMapping(value = "/") + public String index() { + System.out.println("swagger-ui.html"); + return "redirect:swagger-ui.html"; + } +} diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/configuration/SwaggerUiConfiguration.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/configuration/SwaggerUiConfiguration.java index e05672181db..af1f1da2b60 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/configuration/SwaggerUiConfiguration.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/configuration/SwaggerUiConfiguration.java @@ -6,6 +6,7 @@ import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.PropertySource; import org.springframework.context.annotation.Import; +import org.springframework.context.annotation.Bean; import org.springframework.http.converter.HttpMessageConverter; import org.springframework.http.converter.json.Jackson2ObjectMapperBuilder; import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter; @@ -58,14 +59,23 @@ public class SwaggerUiConfiguration extends WebMvcConfigurerAdapter { } } + @Bean + public Jackson2ObjectMapperBuilder builder() { + Jackson2ObjectMapperBuilder builder = new Jackson2ObjectMapperBuilder() + .indentOutput(true) + .featuresToDisable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS) + .dateFormat(new RFC3339DateFormat()); + return builder; + } + @Override public void configureMessageConverters(List> converters) { - ObjectMapper objectMapper = Jackson2ObjectMapperBuilder.json() - .featuresToDisable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS) - .dateFormat( new RFC3339DateFormat()) - .build(); - converters.add(new MappingJackson2HttpMessageConverter(objectMapper)); + converters.add(new MappingJackson2HttpMessageConverter(objectMapper())); super.configureMessageConverters(converters); } + @Bean + public ObjectMapper objectMapper(){ + return builder().build(); + } } diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/AdditionalPropertiesClass.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/AdditionalPropertiesClass.java index f4cfcadae51..80be4236b0d 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/AdditionalPropertiesClass.java +++ b/samples/server/petstore/spring-mvc-j8-async/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/spring-mvc-j8-async/src/main/java/io/swagger/model/Animal.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/Animal.java index a218f0b5542..bc957d1c803 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/Animal.java +++ b/samples/server/petstore/spring-mvc-j8-async/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/spring-mvc-j8-async/src/main/java/io/swagger/model/AnimalFarm.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/AnimalFarm.java index 33dc04699af..9fa4159f203 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/AnimalFarm.java +++ b/samples/server/petstore/spring-mvc-j8-async/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/spring-mvc-j8-async/src/main/java/io/swagger/model/ArrayOfArrayOfNumberOnly.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/ArrayOfArrayOfNumberOnly.java index 8f975d8feda..f9dca7d60b5 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/ArrayOfArrayOfNumberOnly.java +++ b/samples/server/petstore/spring-mvc-j8-async/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/spring-mvc-j8-async/src/main/java/io/swagger/model/ArrayOfNumberOnly.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/ArrayOfNumberOnly.java index 2c556008554..e9c8a313be0 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/ArrayOfNumberOnly.java +++ b/samples/server/petstore/spring-mvc-j8-async/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/spring-mvc-j8-async/src/main/java/io/swagger/model/ArrayTest.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/ArrayTest.java index 664e319cd35..78c35d3c63a 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/ArrayTest.java +++ b/samples/server/petstore/spring-mvc-j8-async/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/spring-mvc-j8-async/src/main/java/io/swagger/model/Capitalization.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/Capitalization.java index d7ad5642ccf..93533c28822 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/Capitalization.java +++ b/samples/server/petstore/spring-mvc-j8-async/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/spring-mvc-j8-async/src/main/java/io/swagger/model/Cat.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/Cat.java index 747e5dc0c7e..edcbc354be6 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/Cat.java +++ b/samples/server/petstore/spring-mvc-j8-async/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/spring-mvc-j8-async/src/main/java/io/swagger/model/Category.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/Category.java index 9629da6500e..6dd9cb7a2ad 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/Category.java +++ b/samples/server/petstore/spring-mvc-j8-async/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/spring-mvc-j8-async/src/main/java/io/swagger/model/ClassModel.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/ClassModel.java index d69acffefa8..6a6379f5b60 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/ClassModel.java +++ b/samples/server/petstore/spring-mvc-j8-async/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/spring-mvc-j8-async/src/main/java/io/swagger/model/Client.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/Client.java index f9cec5a225e..3b8d16cabf2 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/Client.java +++ b/samples/server/petstore/spring-mvc-j8-async/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/spring-mvc-j8-async/src/main/java/io/swagger/model/Dog.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/Dog.java index 9057e840fc3..513131a9fa7 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/Dog.java +++ b/samples/server/petstore/spring-mvc-j8-async/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/spring-mvc-j8-async/src/main/java/io/swagger/model/EnumArrays.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/EnumArrays.java index f904035e482..bbf4a3036e9 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/EnumArrays.java +++ b/samples/server/petstore/spring-mvc-j8-async/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/spring-mvc-j8-async/src/main/java/io/swagger/model/EnumClass.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/EnumClass.java index cdfc0933c3e..4cfbe4b9fcf 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/EnumClass.java +++ b/samples/server/petstore/spring-mvc-j8-async/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/spring-mvc-j8-async/src/main/java/io/swagger/model/EnumTest.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/EnumTest.java index 9f2a0275a6a..c7e4793cdf7 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/EnumTest.java +++ b/samples/server/petstore/spring-mvc-j8-async/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/spring-mvc-j8-async/src/main/java/io/swagger/model/FormatTest.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/FormatTest.java index c6d568be7ed..f63a8de2c15 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/FormatTest.java +++ b/samples/server/petstore/spring-mvc-j8-async/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/spring-mvc-j8-async/src/main/java/io/swagger/model/HasOnlyReadOnly.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/HasOnlyReadOnly.java index a26492e4912..0f8b608e261 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/HasOnlyReadOnly.java +++ b/samples/server/petstore/spring-mvc-j8-async/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/spring-mvc-j8-async/src/main/java/io/swagger/model/MapTest.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/MapTest.java index 434c3a8f1b5..1530a53f53f 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/MapTest.java +++ b/samples/server/petstore/spring-mvc-j8-async/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/spring-mvc-j8-async/src/main/java/io/swagger/model/MixedPropertiesAndAdditionalPropertiesClass.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/MixedPropertiesAndAdditionalPropertiesClass.java index 727205e40f9..eafbcb4ecb8 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/MixedPropertiesAndAdditionalPropertiesClass.java +++ b/samples/server/petstore/spring-mvc-j8-async/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/spring-mvc-j8-async/src/main/java/io/swagger/model/Model200Response.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/Model200Response.java index 4d47f6c03c9..97349fef05c 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/Model200Response.java +++ b/samples/server/petstore/spring-mvc-j8-async/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/spring-mvc-j8-async/src/main/java/io/swagger/model/ModelApiResponse.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/ModelApiResponse.java index 36da9b20d9d..c8882b3b1e2 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/ModelApiResponse.java +++ b/samples/server/petstore/spring-mvc-j8-async/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/spring-mvc-j8-async/src/main/java/io/swagger/model/ModelReturn.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/ModelReturn.java index 7ffc24a0144..7018d7de09c 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/ModelReturn.java +++ b/samples/server/petstore/spring-mvc-j8-async/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/spring-mvc-j8-async/src/main/java/io/swagger/model/Name.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/Name.java index 953199166ff..46069fdd14b 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/Name.java +++ b/samples/server/petstore/spring-mvc-j8-async/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/spring-mvc-j8-async/src/main/java/io/swagger/model/NumberOnly.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/NumberOnly.java index e6dbf3139e2..e243ecb429b 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/NumberOnly.java +++ b/samples/server/petstore/spring-mvc-j8-async/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/spring-mvc-j8-async/src/main/java/io/swagger/model/Order.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/Order.java index d65ed713151..e1a5d94cc8f 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/Order.java +++ b/samples/server/petstore/spring-mvc-j8-async/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/spring-mvc-j8-async/src/main/java/io/swagger/model/OuterEnum.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/OuterEnum.java index 5f0075e4457..f3c6d31fb86 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/OuterEnum.java +++ b/samples/server/petstore/spring-mvc-j8-async/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/spring-mvc-j8-async/src/main/java/io/swagger/model/Pet.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/Pet.java index b013846b4d6..c84687b699f 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/Pet.java +++ b/samples/server/petstore/spring-mvc-j8-async/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/spring-mvc-j8-async/src/main/java/io/swagger/model/ReadOnlyFirst.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/ReadOnlyFirst.java index 47700659fd2..8e79be0008d 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/ReadOnlyFirst.java +++ b/samples/server/petstore/spring-mvc-j8-async/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/spring-mvc-j8-async/src/main/java/io/swagger/model/SpecialModelName.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/SpecialModelName.java index 880d70599b0..3cb7b04353c 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/SpecialModelName.java +++ b/samples/server/petstore/spring-mvc-j8-async/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/spring-mvc-j8-async/src/main/java/io/swagger/model/Tag.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/Tag.java index 298085317a4..9f8f3a25234 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/Tag.java +++ b/samples/server/petstore/spring-mvc-j8-async/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/spring-mvc-j8-async/src/main/java/io/swagger/model/User.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/User.java index 8e40f7e0594..501c556de27 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/User.java +++ b/samples/server/petstore/spring-mvc-j8-async/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/spring-mvc-j8-async/src/main/resources/application.properties b/samples/server/petstore/spring-mvc-j8-async/src/main/resources/application.properties new file mode 100644 index 00000000000..a72d110dea9 --- /dev/null +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/resources/application.properties @@ -0,0 +1,5 @@ +springfox.documentation.swagger.v2.path=/api-docs +server.contextPath=/v2 +server.port=80 +spring.jackson.date-format=io.swagger.RFC3339DateFormat +spring.jackson.serialization.WRITE_DATES_AS_TIMESTAMPS=false \ No newline at end of file diff --git a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/FakeApi.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/FakeApi.java index d8b307a1f23..8eefd6ed507 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/FakeApi.java +++ b/samples/server/petstore/spring-mvc/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/spring-mvc/src/main/java/io/swagger/api/FakeApiController.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/FakeApiController.java index 10142374ba0..bc079bf6299 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/FakeApiController.java +++ b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/FakeApiController.java @@ -16,11 +16,10 @@ 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; @@ -66,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/spring-mvc/src/main/java/io/swagger/api/PetApi.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/PetApi.java index 5816fb5b92e..1227aedbbd7 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/PetApi.java +++ b/samples/server/petstore/spring-mvc/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/spring-mvc/src/main/java/io/swagger/api/PetApiController.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/PetApiController.java index 6fd43dd5ef1..66e1dbda18d 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/PetApiController.java +++ b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/PetApiController.java @@ -15,11 +15,10 @@ 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; @@ -44,7 +43,7 @@ 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! @@ -60,7 +59,7 @@ 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! diff --git a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/StoreApiController.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/StoreApiController.java index b05a6c92bbf..6154d9c2639 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/StoreApiController.java +++ b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/StoreApiController.java @@ -14,11 +14,10 @@ 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; diff --git a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/UserApi.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/UserApi.java index 53899d1eddd..adc0d21d30b 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/UserApi.java +++ b/samples/server/petstore/spring-mvc/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/spring-mvc/src/main/java/io/swagger/api/UserApiController.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/UserApiController.java index ec36309143e..24b7e18b995 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/UserApiController.java +++ b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/UserApiController.java @@ -14,11 +14,10 @@ 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; @@ -70,8 +69,8 @@ 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! diff --git a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/AdditionalPropertiesClass.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/AdditionalPropertiesClass.java index f4cfcadae51..80be4236b0d 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/AdditionalPropertiesClass.java +++ b/samples/server/petstore/spring-mvc/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/spring-mvc/src/main/java/io/swagger/model/Animal.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/Animal.java index a218f0b5542..bc957d1c803 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/Animal.java +++ b/samples/server/petstore/spring-mvc/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/spring-mvc/src/main/java/io/swagger/model/AnimalFarm.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/AnimalFarm.java index 33dc04699af..9fa4159f203 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/AnimalFarm.java +++ b/samples/server/petstore/spring-mvc/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/spring-mvc/src/main/java/io/swagger/model/ArrayOfArrayOfNumberOnly.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/ArrayOfArrayOfNumberOnly.java index 8f975d8feda..f9dca7d60b5 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/ArrayOfArrayOfNumberOnly.java +++ b/samples/server/petstore/spring-mvc/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/spring-mvc/src/main/java/io/swagger/model/ArrayOfNumberOnly.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/ArrayOfNumberOnly.java index 2c556008554..e9c8a313be0 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/ArrayOfNumberOnly.java +++ b/samples/server/petstore/spring-mvc/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/spring-mvc/src/main/java/io/swagger/model/ArrayTest.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/ArrayTest.java index 664e319cd35..78c35d3c63a 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/ArrayTest.java +++ b/samples/server/petstore/spring-mvc/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/spring-mvc/src/main/java/io/swagger/model/Capitalization.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/Capitalization.java index d7ad5642ccf..93533c28822 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/Capitalization.java +++ b/samples/server/petstore/spring-mvc/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/spring-mvc/src/main/java/io/swagger/model/Cat.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/Cat.java index 747e5dc0c7e..edcbc354be6 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/Cat.java +++ b/samples/server/petstore/spring-mvc/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/spring-mvc/src/main/java/io/swagger/model/Category.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/Category.java index 9629da6500e..6dd9cb7a2ad 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/Category.java +++ b/samples/server/petstore/spring-mvc/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/spring-mvc/src/main/java/io/swagger/model/ClassModel.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/ClassModel.java index d69acffefa8..6a6379f5b60 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/ClassModel.java +++ b/samples/server/petstore/spring-mvc/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/spring-mvc/src/main/java/io/swagger/model/Client.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/Client.java index f9cec5a225e..3b8d16cabf2 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/Client.java +++ b/samples/server/petstore/spring-mvc/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/spring-mvc/src/main/java/io/swagger/model/Dog.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/Dog.java index 9057e840fc3..513131a9fa7 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/Dog.java +++ b/samples/server/petstore/spring-mvc/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/spring-mvc/src/main/java/io/swagger/model/EnumArrays.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/EnumArrays.java index f904035e482..bbf4a3036e9 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/EnumArrays.java +++ b/samples/server/petstore/spring-mvc/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/spring-mvc/src/main/java/io/swagger/model/EnumClass.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/EnumClass.java index cdfc0933c3e..4cfbe4b9fcf 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/EnumClass.java +++ b/samples/server/petstore/spring-mvc/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/spring-mvc/src/main/java/io/swagger/model/EnumTest.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/EnumTest.java index 9f2a0275a6a..c7e4793cdf7 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/EnumTest.java +++ b/samples/server/petstore/spring-mvc/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/spring-mvc/src/main/java/io/swagger/model/FormatTest.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/FormatTest.java index ad8680a3beb..9d6cf5cd4be 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/FormatTest.java +++ b/samples/server/petstore/spring-mvc/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/spring-mvc/src/main/java/io/swagger/model/HasOnlyReadOnly.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/HasOnlyReadOnly.java index a26492e4912..0f8b608e261 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/HasOnlyReadOnly.java +++ b/samples/server/petstore/spring-mvc/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/spring-mvc/src/main/java/io/swagger/model/MapTest.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/MapTest.java index 434c3a8f1b5..1530a53f53f 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/MapTest.java +++ b/samples/server/petstore/spring-mvc/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/spring-mvc/src/main/java/io/swagger/model/MixedPropertiesAndAdditionalPropertiesClass.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/MixedPropertiesAndAdditionalPropertiesClass.java index dba1241f6d6..d4cd89cef34 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/MixedPropertiesAndAdditionalPropertiesClass.java +++ b/samples/server/petstore/spring-mvc/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/spring-mvc/src/main/java/io/swagger/model/Model200Response.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/Model200Response.java index 4d47f6c03c9..97349fef05c 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/Model200Response.java +++ b/samples/server/petstore/spring-mvc/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/spring-mvc/src/main/java/io/swagger/model/ModelApiResponse.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/ModelApiResponse.java index 36da9b20d9d..c8882b3b1e2 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/ModelApiResponse.java +++ b/samples/server/petstore/spring-mvc/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/spring-mvc/src/main/java/io/swagger/model/ModelReturn.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/ModelReturn.java index 7ffc24a0144..7018d7de09c 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/ModelReturn.java +++ b/samples/server/petstore/spring-mvc/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/spring-mvc/src/main/java/io/swagger/model/Name.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/Name.java index 953199166ff..46069fdd14b 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/Name.java +++ b/samples/server/petstore/spring-mvc/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/spring-mvc/src/main/java/io/swagger/model/NumberOnly.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/NumberOnly.java index e6dbf3139e2..e243ecb429b 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/NumberOnly.java +++ b/samples/server/petstore/spring-mvc/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/spring-mvc/src/main/java/io/swagger/model/Order.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/Order.java index 41dec079587..4106ac36198 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/Order.java +++ b/samples/server/petstore/spring-mvc/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/spring-mvc/src/main/java/io/swagger/model/OuterEnum.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/OuterEnum.java index 5f0075e4457..f3c6d31fb86 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/OuterEnum.java +++ b/samples/server/petstore/spring-mvc/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/spring-mvc/src/main/java/io/swagger/model/Pet.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/Pet.java index b013846b4d6..c84687b699f 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/Pet.java +++ b/samples/server/petstore/spring-mvc/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/spring-mvc/src/main/java/io/swagger/model/ReadOnlyFirst.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/ReadOnlyFirst.java index 47700659fd2..8e79be0008d 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/ReadOnlyFirst.java +++ b/samples/server/petstore/spring-mvc/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/spring-mvc/src/main/java/io/swagger/model/SpecialModelName.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/SpecialModelName.java index 880d70599b0..3cb7b04353c 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/SpecialModelName.java +++ b/samples/server/petstore/spring-mvc/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/spring-mvc/src/main/java/io/swagger/model/Tag.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/Tag.java index 298085317a4..9f8f3a25234 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/Tag.java +++ b/samples/server/petstore/spring-mvc/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/spring-mvc/src/main/java/io/swagger/model/User.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/User.java index 8e40f7e0594..501c556de27 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/User.java +++ b/samples/server/petstore/spring-mvc/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; }