diff --git a/modules/swagger-codegen/src/main/resources/JavaSpring/api.mustache b/modules/swagger-codegen/src/main/resources/JavaSpring/api.mustache index 66b73539ca..1371e29c5d 100644 --- a/modules/swagger-codegen/src/main/resources/JavaSpring/api.mustache +++ b/modules/swagger-codegen/src/main/resources/JavaSpring/api.mustache @@ -16,9 +16,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; -{{^useSpringCloudClient}} -import java.io.IOException; -{{/useSpringCloudClient}} import java.util.List; {{#async}} @@ -43,31 +40,20 @@ public interface {{classname}} { }{{/hasAuthMethods}}, tags={ {{#vendorExtensions.x-tags}}"{{tag}}",{{/vendorExtensions.x-tags}} }) @ApiResponses(value = { {{#responses}} @ApiResponse(code = {{{code}}}, message = "{{{message}}}", response = {{{returnType}}}.class){{#hasMore}},{{/hasMore}}{{/responses}} }) - {{#implicitHeaders}} - @ApiImplicitParams({ + {{#implicitHeaders}}@ApiImplicitParams({ {{#headerParams}}{{>implicitHeader}}{{/headerParams}} - }) - {{/implicitHeaders}} + }){{/implicitHeaders}} @RequestMapping(value = "{{{path}}}",{{#singleContentTypes}} produces = "{{{vendorExtensions.x-accepts}}}", consumes = "{{{vendorExtensions.x-contentType}}}",{{/singleContentTypes}}{{^singleContentTypes}}{{#hasProduces}} produces = { {{#produces}}"{{{mediaType}}}"{{#hasMore}}, {{/hasMore}}{{/produces}} }, {{/hasProduces}}{{#hasConsumes}} consumes = { {{#consumes}}"{{{mediaType}}}"{{#hasMore}}, {{/hasMore}}{{/consumes}} },{{/hasConsumes}}{{/singleContentTypes}} method = RequestMethod.{{httpMethod}}) -{{#useSpringCloudClient}} {{#jdk8}}default {{/jdk8}}{{#responseWrapper}}{{.}}<{{/responseWrapper}}ResponseEntity<{{>returnTypes}}>{{#responseWrapper}}>{{/responseWrapper}} {{operationId}}({{#allParams}}{{>queryParams}}{{>pathParams}}{{>headerParams}}{{>bodyParams}}{{>formParams}}{{#hasMore}},{{/hasMore}}{{/allParams}}){{^jdk8}};{{/jdk8}}{{#jdk8}} { // do some magic! return {{#async}}CompletableFuture.completedFuture({{/async}}new ResponseEntity<{{>returnTypes}}>(HttpStatus.OK){{#async}}){{/async}}; }{{/jdk8}} -{{/useSpringCloudClient}} -{{^useSpringCloudClient}} - {{#jdk8}}default {{/jdk8}}{{#responseWrapper}}{{.}}<{{/responseWrapper}}ResponseEntity<{{>returnTypes}}>{{#responseWrapper}}>{{/responseWrapper}} {{operationId}}({{#allParams}}{{>queryParams}}{{>pathParams}}{{>headerParams}}{{>bodyParams}}{{>formParams}},{{/allParams}} @RequestHeader("Accept") String accept){{#examples}}{{#-first}} throws IOException{{/-first}}{{/examples}}{{^jdk8}};{{/jdk8}}{{#jdk8}} { - // do some magic! - return {{#async}}CompletableFuture.completedFuture({{/async}}new ResponseEntity<{{>returnTypes}}>(HttpStatus.OK){{#async}}){{/async}}; - }{{/jdk8}} - -{{/useSpringCloudClient}} {{/operation}} } {{/operations}} diff --git a/modules/swagger-codegen/src/main/resources/JavaSpring/apiController.mustache b/modules/swagger-codegen/src/main/resources/JavaSpring/apiController.mustache index bef1835b9a..b952cd6f51 100644 --- a/modules/swagger-codegen/src/main/resources/JavaSpring/apiController.mustache +++ b/modules/swagger-codegen/src/main/resources/JavaSpring/apiController.mustache @@ -21,12 +21,7 @@ import org.springframework.web.multipart.MultipartFile; import java.util.List; {{#async}} import java.util.concurrent.Callable; -{{/async}} -{{/jdk8-no-delegate}} -{{^useSpringCloudClient}} -import com.fasterxml.jackson.databind.ObjectMapper; -import java.io.IOException; -{{/useSpringCloudClient}} +{{/async}}{{/jdk8-no-delegate}} {{#useBeanValidation}} import javax.validation.constraints.*; import javax.validation.Valid; @@ -35,72 +30,27 @@ import javax.validation.Valid; @Controller {{#operations}} public class {{classname}}Controller implements {{classname}} { - private final ObjectMapper objectMapper; - - public {{classname}}Controller(ObjectMapper objectMapper) { - this.objectMapper = objectMapper; - } - {{#isDelegate}} private final {{classname}}Delegate delegate; @org.springframework.beans.factory.annotation.Autowired public {{classname}}Controller({{classname}}Delegate delegate) { this.delegate = delegate; - } + }{{/isDelegate}} -{{/isDelegate}} -{{^jdk8-no-delegate}} -{{#operation}} - public {{#async}}Callable<{{/async}}ResponseEntity<{{>returnTypes}}>{{#async}}>{{/async}} {{operationId}}({{#allParams}}{{>queryParams}}{{>pathParams}}{{>headerParams}}{{>bodyParams}}{{>formParams}}, - {{/allParams}}@RequestHeader("Accept") String accept){{#examples}}{{#-first}} throws IOException{{/-first}}{{/examples}} { - // do some magic! -{{#useSpringCloudClient}} - {{^isDelegate}} - {{^async}} - return new ResponseEntity<{{>returnTypes}}>(HttpStatus.OK); - {{/async}} - {{#async}} +{{^jdk8-no-delegate}}{{#operation}} + public {{#async}}Callable<{{/async}}ResponseEntity<{{>returnTypes}}>{{#async}}>{{/async}} {{operationId}}({{#allParams}}{{>queryParams}}{{>pathParams}}{{>headerParams}}{{>bodyParams}}{{>formParams}}{{#hasMore}}, + {{/hasMore}}{{/allParams}}) { + // do some magic!{{^isDelegate}}{{^async}} + return new ResponseEntity<{{>returnTypes}}>(HttpStatus.OK);{{/async}}{{#async}} return new CallablereturnTypes}}>>() { @Override public ResponseEntity<{{>returnTypes}}> call() throws Exception { return new ResponseEntity<{{>returnTypes}}>(HttpStatus.OK); } - }; - {{/async}} - {{/isDelegate}} - {{#isDelegate}} - return delegate.{{operationId}}({{#allParams}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}); - {{/isDelegate}} -{{/useSpringCloudClient}} -{{^useSpringCloudClient}} - {{^isDelegate}} - {{^async}} - {{#examples}} - - if (accept != null && accept.contains("{{{contentType}}}")) { - return new ResponseEntity<{{>returnTypes}}>(objectMapper.readValue("{{#lambdaRemoveLineBreak}}{{#lambdaEscapeDoubleQuote}}{{{example}}}{{/lambdaEscapeDoubleQuote}}{{/lambdaRemoveLineBreak}}", {{>exampleReturnTypes}}.class), HttpStatus.OK); - } - - {{/examples}} - return new ResponseEntity<{{>returnTypes}}>(HttpStatus.OK); - {{/async}} - {{#async}} - return new CallablereturnTypes}}>>() { - @Override - public ResponseEntity<{{>returnTypes}}> call() throws Exception { - return new ResponseEntity<{{>returnTypes}}>(HttpStatus.OK); - } - }; - {{/async}} - {{/isDelegate}} - {{#isDelegate}} - return delegate.{{operationId}}({{#allParams}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}); - {{/isDelegate}} -{{/useSpringCloudClient}} + };{{/async}}{{/isDelegate}}{{#isDelegate}} + return delegate.{{operationId}}({{#allParams}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}});{{/isDelegate}} } - -{{/operation}} -{{/jdk8-no-delegate}} +{{/operation}}{{/jdk8-no-delegate}} } {{/operations}} diff --git a/samples/client/petstore/go/go-petstore/pom.xml b/samples/client/petstore/go/go-petstore/pom.xml deleted file mode 100644 index 7680ed95cf..0000000000 --- a/samples/client/petstore/go/go-petstore/pom.xml +++ /dev/null @@ -1,75 +0,0 @@ - - 4.0.0 - com.wordnik - Gopetstore - pom - 1.0.0 - Gopetstore - - - - maven-dependency-plugin - - - package - - copy-dependencies - - - ${project.build.directory} - - - - - - org.codehaus.mojo - exec-maven-plugin - 1.2.1 - - - go-get-testify - pre-integration-test - - exec - - - go - - get - github.com/stretchr/testify/assert - - - - - go-get-sling - pre-integration-test - - exec - - - go - - get - github.com/dghubble/sling - - - - - go-test - integration-test - - exec - - - go - - test - -v - - - - - - - - \ No newline at end of file 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 ad9c5c2929..c155dfa053 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 @@ -30,6 +30,7 @@ public interface PetApi { }, tags={ "pet", }) @ApiResponses(value = { @ApiResponse(code = 405, message = "Invalid input", response = Void.class) }) + @RequestMapping(value = "/pet", produces = "application/json", consumes = "application/json", @@ -45,6 +46,7 @@ public interface PetApi { }, tags={ "pet", }) @ApiResponses(value = { @ApiResponse(code = 400, message = "Invalid pet value", response = Void.class) }) + @RequestMapping(value = "/pet/{petId}", produces = "application/json", consumes = "application/json", @@ -61,6 +63,7 @@ public interface PetApi { @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Pet.class), @ApiResponse(code = 400, message = "Invalid status value", response = Pet.class) }) + @RequestMapping(value = "/pet/findByStatus", produces = "application/json", consumes = "application/json", @@ -77,6 +80,7 @@ public interface PetApi { @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Pet.class), @ApiResponse(code = 400, message = "Invalid tag value", response = Pet.class) }) + @RequestMapping(value = "/pet/findByTags", produces = "application/json", consumes = "application/json", @@ -91,6 +95,7 @@ public interface PetApi { @ApiResponse(code = 200, message = "successful operation", response = Pet.class), @ApiResponse(code = 400, message = "Invalid ID supplied", response = Pet.class), @ApiResponse(code = 404, message = "Pet not found", response = Pet.class) }) + @RequestMapping(value = "/pet/{petId}", produces = "application/json", consumes = "application/json", @@ -108,6 +113,7 @@ public interface PetApi { @ApiResponse(code = 400, message = "Invalid ID supplied", response = Void.class), @ApiResponse(code = 404, message = "Pet not found", response = Void.class), @ApiResponse(code = 405, message = "Validation exception", response = Void.class) }) + @RequestMapping(value = "/pet", produces = "application/json", consumes = "application/json", @@ -123,6 +129,7 @@ public interface PetApi { }, tags={ "pet", }) @ApiResponses(value = { @ApiResponse(code = 405, message = "Invalid input", response = Void.class) }) + @RequestMapping(value = "/pet/{petId}", produces = "application/json", consumes = "application/x-www-form-urlencoded", @@ -138,6 +145,7 @@ public interface PetApi { }, tags={ "pet", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = ModelApiResponse.class) }) + @RequestMapping(value = "/pet/{petId}/uploadImage", produces = "application/json", consumes = "multipart/form-data", diff --git a/samples/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 c8a7cace4d..fc5d6b4889 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 @@ -25,6 +25,7 @@ public interface StoreApi { @ApiResponses(value = { @ApiResponse(code = 400, message = "Invalid ID supplied", response = Void.class), @ApiResponse(code = 404, message = "Order not found", response = Void.class) }) + @RequestMapping(value = "/store/order/{orderId}", produces = "application/json", consumes = "application/json", @@ -37,6 +38,7 @@ public interface StoreApi { }, tags={ "store", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Integer.class) }) + @RequestMapping(value = "/store/inventory", produces = "application/json", consumes = "application/json", @@ -49,6 +51,7 @@ public interface StoreApi { @ApiResponse(code = 200, message = "successful operation", response = Order.class), @ApiResponse(code = 400, message = "Invalid ID supplied", response = Order.class), @ApiResponse(code = 404, message = "Order not found", response = Order.class) }) + @RequestMapping(value = "/store/order/{orderId}", produces = "application/json", consumes = "application/json", @@ -60,6 +63,7 @@ public interface StoreApi { @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Order.class), @ApiResponse(code = 400, message = "Invalid Order", response = Order.class) }) + @RequestMapping(value = "/store/order", produces = "application/json", consumes = "application/json", 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 b01bae3dc3..5014c4cc7c 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 @@ -24,6 +24,7 @@ public interface UserApi { @ApiOperation(value = "Create user", notes = "This can only be done by the logged in user.", response = Void.class, tags={ "user", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Void.class) }) + @RequestMapping(value = "/user", produces = "application/json", consumes = "application/json", @@ -34,6 +35,7 @@ public interface UserApi { @ApiOperation(value = "Creates list of users with given input array", notes = "", response = Void.class, tags={ "user", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Void.class) }) + @RequestMapping(value = "/user/createWithArray", produces = "application/json", consumes = "application/json", @@ -44,6 +46,7 @@ public interface UserApi { @ApiOperation(value = "Creates list of users with given input array", notes = "", response = Void.class, tags={ "user", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Void.class) }) + @RequestMapping(value = "/user/createWithList", produces = "application/json", consumes = "application/json", @@ -55,6 +58,7 @@ public interface UserApi { @ApiResponses(value = { @ApiResponse(code = 400, message = "Invalid username supplied", response = Void.class), @ApiResponse(code = 404, message = "User not found", response = Void.class) }) + @RequestMapping(value = "/user/{username}", produces = "application/json", consumes = "application/json", @@ -67,6 +71,7 @@ public interface UserApi { @ApiResponse(code = 200, message = "successful operation", response = User.class), @ApiResponse(code = 400, message = "Invalid username supplied", response = User.class), @ApiResponse(code = 404, message = "User not found", response = User.class) }) + @RequestMapping(value = "/user/{username}", produces = "application/json", consumes = "application/json", @@ -78,6 +83,7 @@ public interface UserApi { @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = String.class), @ApiResponse(code = 400, message = "Invalid username/password supplied", response = String.class) }) + @RequestMapping(value = "/user/login", produces = "application/json", consumes = "application/json", @@ -88,6 +94,7 @@ public interface UserApi { @ApiOperation(value = "Logs out current logged in user session", notes = "", response = Void.class, tags={ "user", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Void.class) }) + @RequestMapping(value = "/user/logout", produces = "application/json", consumes = "application/json", @@ -99,6 +106,7 @@ public interface UserApi { @ApiResponses(value = { @ApiResponse(code = 400, message = "Invalid user supplied", response = Void.class), @ApiResponse(code = 404, message = "User not found", response = Void.class) }) + @RequestMapping(value = "/user/{username}", produces = "application/json", consumes = "application/json", diff --git a/samples/client/petstore/spring-cloud/src/main/java/io/swagger/model/Category.java b/samples/client/petstore/spring-cloud/src/main/java/io/swagger/model/Category.java index 7289c191a9..55a5d0ec28 100644 --- a/samples/client/petstore/spring-cloud/src/main/java/io/swagger/model/Category.java +++ b/samples/client/petstore/spring-cloud/src/main/java/io/swagger/model/Category.java @@ -31,7 +31,7 @@ public class Category { **/ @ApiModelProperty(value = "") - @Valid + public Long getId() { return id; } @@ -51,7 +51,7 @@ public class Category { **/ @ApiModelProperty(value = "") - @Valid + public String getName() { return name; } diff --git a/samples/client/petstore/spring-cloud/src/main/java/io/swagger/model/ModelApiResponse.java b/samples/client/petstore/spring-cloud/src/main/java/io/swagger/model/ModelApiResponse.java index d9a1123d08..f06b378a52 100644 --- a/samples/client/petstore/spring-cloud/src/main/java/io/swagger/model/ModelApiResponse.java +++ b/samples/client/petstore/spring-cloud/src/main/java/io/swagger/model/ModelApiResponse.java @@ -34,7 +34,7 @@ public class ModelApiResponse { **/ @ApiModelProperty(value = "") - @Valid + public Integer getCode() { return code; } @@ -54,7 +54,7 @@ public class ModelApiResponse { **/ @ApiModelProperty(value = "") - @Valid + public String getType() { return type; } @@ -74,7 +74,7 @@ public class ModelApiResponse { **/ @ApiModelProperty(value = "") - @Valid + public String getMessage() { return message; } diff --git a/samples/client/petstore/spring-cloud/src/main/java/io/swagger/model/Order.java b/samples/client/petstore/spring-cloud/src/main/java/io/swagger/model/Order.java index 728be28129..5240964394 100644 --- a/samples/client/petstore/spring-cloud/src/main/java/io/swagger/model/Order.java +++ b/samples/client/petstore/spring-cloud/src/main/java/io/swagger/model/Order.java @@ -78,7 +78,7 @@ public class Order { **/ @ApiModelProperty(value = "") - @Valid + public Long getId() { return id; } @@ -98,7 +98,7 @@ public class Order { **/ @ApiModelProperty(value = "") - @Valid + public Long getPetId() { return petId; } @@ -118,7 +118,7 @@ public class Order { **/ @ApiModelProperty(value = "") - @Valid + public Integer getQuantity() { return quantity; } @@ -139,6 +139,7 @@ public class Order { @ApiModelProperty(value = "") @Valid + public DateTime getShipDate() { return shipDate; } @@ -158,7 +159,7 @@ public class Order { **/ @ApiModelProperty(value = "Order Status") - @Valid + public StatusEnum getStatus() { return status; } @@ -178,7 +179,7 @@ public class Order { **/ @ApiModelProperty(value = "") - @Valid + public Boolean getComplete() { return complete; } diff --git a/samples/client/petstore/spring-cloud/src/main/java/io/swagger/model/Pet.java b/samples/client/petstore/spring-cloud/src/main/java/io/swagger/model/Pet.java index f79e9ae56d..367ec151b7 100644 --- a/samples/client/petstore/spring-cloud/src/main/java/io/swagger/model/Pet.java +++ b/samples/client/petstore/spring-cloud/src/main/java/io/swagger/model/Pet.java @@ -81,7 +81,7 @@ public class Pet { **/ @ApiModelProperty(value = "") - @Valid + public Long getId() { return id; } @@ -102,6 +102,7 @@ public class Pet { @ApiModelProperty(value = "") @Valid + public Category getCategory() { return category; } @@ -122,7 +123,7 @@ public class Pet { @ApiModelProperty(example = "doggie", required = true, value = "") @NotNull - @Valid + public String getName() { return name; } @@ -148,7 +149,7 @@ public class Pet { @ApiModelProperty(required = true, value = "") @NotNull - @Valid + public List getPhotoUrls() { return photoUrls; } @@ -177,6 +178,7 @@ public class Pet { @ApiModelProperty(value = "") @Valid + public List getTags() { return tags; } @@ -196,7 +198,7 @@ public class Pet { **/ @ApiModelProperty(value = "pet status in the store") - @Valid + public StatusEnum getStatus() { return status; } diff --git a/samples/client/petstore/spring-cloud/src/main/java/io/swagger/model/Tag.java b/samples/client/petstore/spring-cloud/src/main/java/io/swagger/model/Tag.java index e9ad7e5165..b44f2ac0bf 100644 --- a/samples/client/petstore/spring-cloud/src/main/java/io/swagger/model/Tag.java +++ b/samples/client/petstore/spring-cloud/src/main/java/io/swagger/model/Tag.java @@ -31,7 +31,7 @@ public class Tag { **/ @ApiModelProperty(value = "") - @Valid + public Long getId() { return id; } @@ -51,7 +51,7 @@ public class Tag { **/ @ApiModelProperty(value = "") - @Valid + public String getName() { return name; } diff --git a/samples/client/petstore/spring-cloud/src/main/java/io/swagger/model/User.java b/samples/client/petstore/spring-cloud/src/main/java/io/swagger/model/User.java index b3b24907d9..e2abb60d07 100644 --- a/samples/client/petstore/spring-cloud/src/main/java/io/swagger/model/User.java +++ b/samples/client/petstore/spring-cloud/src/main/java/io/swagger/model/User.java @@ -49,7 +49,7 @@ public class User { **/ @ApiModelProperty(value = "") - @Valid + public Long getId() { return id; } @@ -69,7 +69,7 @@ public class User { **/ @ApiModelProperty(value = "") - @Valid + public String getUsername() { return username; } @@ -89,7 +89,7 @@ public class User { **/ @ApiModelProperty(value = "") - @Valid + public String getFirstName() { return firstName; } @@ -109,7 +109,7 @@ public class User { **/ @ApiModelProperty(value = "") - @Valid + public String getLastName() { return lastName; } @@ -129,7 +129,7 @@ public class User { **/ @ApiModelProperty(value = "") - @Valid + public String getEmail() { return email; } @@ -149,7 +149,7 @@ public class User { **/ @ApiModelProperty(value = "") - @Valid + public String getPassword() { return password; } @@ -169,7 +169,7 @@ public class User { **/ @ApiModelProperty(value = "") - @Valid + public String getPhone() { return phone; } @@ -189,7 +189,7 @@ public class User { **/ @ApiModelProperty(value = "User Status") - @Valid + public Integer getUserStatus() { return userStatus; } diff --git a/samples/client/petstore/spring-stubs/src/main/java/io/swagger/api/PetApi.java b/samples/client/petstore/spring-stubs/src/main/java/io/swagger/api/PetApi.java index 45f86ff8cb..db67d11eeb 100644 --- a/samples/client/petstore/spring-stubs/src/main/java/io/swagger/api/PetApi.java +++ b/samples/client/petstore/spring-stubs/src/main/java/io/swagger/api/PetApi.java @@ -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.*; @@ -31,11 +30,12 @@ public interface PetApi { }, tags={ "pet", }) @ApiResponses(value = { @ApiResponse(code = 405, message = "Invalid input", response = Void.class) }) + @RequestMapping(value = "/pet", produces = "application/json", consumes = "application/json", method = RequestMethod.POST) - ResponseEntity addPet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody Pet body, @RequestHeader("Accept") String accept); + ResponseEntity addPet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody Pet body); @ApiOperation(value = "Deletes a pet", notes = "", response = Void.class, authorizations = { @@ -46,11 +46,12 @@ public interface PetApi { }, tags={ "pet", }) @ApiResponses(value = { @ApiResponse(code = 400, message = "Invalid pet value", response = Void.class) }) + @RequestMapping(value = "/pet/{petId}", produces = "application/json", consumes = "application/json", method = RequestMethod.DELETE) - ResponseEntity deletePet(@ApiParam(value = "Pet id to delete",required=true ) @PathVariable("petId") Long petId,@ApiParam(value = "" ) @RequestHeader(value="api_key", required=false) String apiKey, @RequestHeader("Accept") String accept); + ResponseEntity deletePet(@ApiParam(value = "Pet id to delete",required=true ) @PathVariable("petId") Long petId,@ApiParam(value = "" ) @RequestHeader(value="api_key", required=false) String apiKey); @ApiOperation(value = "Finds Pets by status", notes = "Multiple status values can be provided with comma separated strings", response = Pet.class, responseContainer = "List", authorizations = { @@ -62,11 +63,12 @@ public interface PetApi { @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Pet.class), @ApiResponse(code = 400, message = "Invalid status value", response = Pet.class) }) + @RequestMapping(value = "/pet/findByStatus", produces = "application/json", consumes = "application/json", method = RequestMethod.GET) - ResponseEntity> findPetsByStatus( @NotNull@ApiParam(value = "Status values that need to be considered for filter", required = true, allowableValues = "available, pending, sold") @RequestParam(value = "status", required = true) List status, @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); @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 = { @@ -78,11 +80,12 @@ public interface PetApi { @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Pet.class), @ApiResponse(code = 400, message = "Invalid tag value", response = Pet.class) }) + @RequestMapping(value = "/pet/findByTags", produces = "application/json", consumes = "application/json", method = RequestMethod.GET) - ResponseEntity> findPetsByTags( @NotNull@ApiParam(value = "Tags to filter by", required = true) @RequestParam(value = "tags", required = true) List tags, @RequestHeader("Accept") String accept) throws IOException; + ResponseEntity> findPetsByTags( @NotNull@ApiParam(value = "Tags to filter by", required = true) @RequestParam(value = "tags", required = true) List tags); @ApiOperation(value = "Find pet by ID", notes = "Returns a single pet", response = Pet.class, authorizations = { @@ -92,11 +95,12 @@ public interface PetApi { @ApiResponse(code = 200, message = "successful operation", response = Pet.class), @ApiResponse(code = 400, message = "Invalid ID supplied", response = Pet.class), @ApiResponse(code = 404, message = "Pet not found", response = Pet.class) }) + @RequestMapping(value = "/pet/{petId}", produces = "application/json", consumes = "application/json", method = RequestMethod.GET) - ResponseEntity getPetById(@ApiParam(value = "ID of pet to return",required=true ) @PathVariable("petId") Long petId, @RequestHeader("Accept") String accept) throws IOException; + ResponseEntity getPetById(@ApiParam(value = "ID of pet to return",required=true ) @PathVariable("petId") Long petId); @ApiOperation(value = "Update an existing pet", notes = "", response = Void.class, authorizations = { @@ -109,11 +113,12 @@ public interface PetApi { @ApiResponse(code = 400, message = "Invalid ID supplied", response = Void.class), @ApiResponse(code = 404, message = "Pet not found", response = Void.class), @ApiResponse(code = 405, message = "Validation exception", response = Void.class) }) + @RequestMapping(value = "/pet", produces = "application/json", consumes = "application/json", method = RequestMethod.PUT) - ResponseEntity updatePet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody Pet body, @RequestHeader("Accept") String accept); + ResponseEntity updatePet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody Pet body); @ApiOperation(value = "Updates a pet in the store with form data", notes = "", response = Void.class, authorizations = { @@ -124,11 +129,12 @@ public interface PetApi { }, tags={ "pet", }) @ApiResponses(value = { @ApiResponse(code = 405, message = "Invalid input", response = Void.class) }) + @RequestMapping(value = "/pet/{petId}", produces = "application/json", consumes = "application/x-www-form-urlencoded", method = RequestMethod.POST) - ResponseEntity updatePetWithForm(@ApiParam(value = "ID of pet that needs to be updated",required=true ) @PathVariable("petId") Long petId,@ApiParam(value = "Updated name of the pet") @RequestPart(value="name", required=false) String name,@ApiParam(value = "Updated status of the pet") @RequestPart(value="status", required=false) String status, @RequestHeader("Accept") String accept); + ResponseEntity updatePetWithForm(@ApiParam(value = "ID of pet that needs to be updated",required=true ) @PathVariable("petId") Long petId,@ApiParam(value = "Updated name of the pet") @RequestPart(value="name", required=false) String name,@ApiParam(value = "Updated status of the pet") @RequestPart(value="status", required=false) String status); @ApiOperation(value = "uploads an image", notes = "", response = ModelApiResponse.class, authorizations = { @@ -139,10 +145,11 @@ public interface PetApi { }, tags={ "pet", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = ModelApiResponse.class) }) + @RequestMapping(value = "/pet/{petId}/uploadImage", produces = "application/json", consumes = "multipart/form-data", method = RequestMethod.POST) - ResponseEntity uploadFile(@ApiParam(value = "ID of pet to update",required=true ) @PathVariable("petId") Long petId,@ApiParam(value = "Additional data to pass to server") @RequestPart(value="additionalMetadata", required=false) String additionalMetadata,@ApiParam(value = "file detail") @RequestPart("file") MultipartFile file, @RequestHeader("Accept") String accept) throws IOException; + ResponseEntity uploadFile(@ApiParam(value = "ID of pet to update",required=true ) @PathVariable("petId") Long petId,@ApiParam(value = "Additional data to pass to server") @RequestPart(value="additionalMetadata", required=false) String additionalMetadata,@ApiParam(value = "file detail") @RequestPart("file") MultipartFile file); } diff --git a/samples/client/petstore/spring-stubs/src/main/java/io/swagger/api/StoreApi.java b/samples/client/petstore/spring-stubs/src/main/java/io/swagger/api/StoreApi.java index 5f8f31dffe..2e3319c5b1 100644 --- a/samples/client/petstore/spring-stubs/src/main/java/io/swagger/api/StoreApi.java +++ b/samples/client/petstore/spring-stubs/src/main/java/io/swagger/api/StoreApi.java @@ -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.*; @@ -26,11 +25,12 @@ public interface StoreApi { @ApiResponses(value = { @ApiResponse(code = 400, message = "Invalid ID supplied", response = Void.class), @ApiResponse(code = 404, message = "Order not found", response = Void.class) }) + @RequestMapping(value = "/store/order/{orderId}", produces = "application/json", consumes = "application/json", method = RequestMethod.DELETE) - ResponseEntity deleteOrder(@ApiParam(value = "ID of the order that needs to be deleted",required=true ) @PathVariable("orderId") String orderId, @RequestHeader("Accept") String accept); + ResponseEntity deleteOrder(@ApiParam(value = "ID of the order that needs to be deleted",required=true ) @PathVariable("orderId") String orderId); @ApiOperation(value = "Returns pet inventories by status", notes = "Returns a map of status codes to quantities", response = Integer.class, responseContainer = "Map", authorizations = { @@ -38,11 +38,12 @@ public interface StoreApi { }, tags={ "store", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Integer.class) }) + @RequestMapping(value = "/store/inventory", produces = "application/json", consumes = "application/json", method = RequestMethod.GET) - ResponseEntity> getInventory( @RequestHeader("Accept") String accept) throws IOException; + ResponseEntity> getInventory(); @ApiOperation(value = "Find purchase order by ID", notes = "For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions", response = Order.class, tags={ "store", }) @@ -50,21 +51,23 @@ public interface StoreApi { @ApiResponse(code = 200, message = "successful operation", response = Order.class), @ApiResponse(code = 400, message = "Invalid ID supplied", response = Order.class), @ApiResponse(code = 404, message = "Order not found", response = Order.class) }) + @RequestMapping(value = "/store/order/{orderId}", produces = "application/json", consumes = "application/json", method = RequestMethod.GET) - ResponseEntity getOrderById( @Min(1) @Max(5)@ApiParam(value = "ID of pet that needs to be fetched",required=true ) @PathVariable("orderId") Long orderId, @RequestHeader("Accept") String accept) throws IOException; + ResponseEntity getOrderById( @Min(1) @Max(5)@ApiParam(value = "ID of pet that needs to be fetched",required=true ) @PathVariable("orderId") Long orderId); @ApiOperation(value = "Place an order for a pet", notes = "", response = Order.class, tags={ "store", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Order.class), @ApiResponse(code = 400, message = "Invalid Order", response = Order.class) }) + @RequestMapping(value = "/store/order", produces = "application/json", consumes = "application/json", method = RequestMethod.POST) - ResponseEntity placeOrder(@ApiParam(value = "order placed for purchasing the pet" ,required=true ) @Valid @RequestBody Order body, @RequestHeader("Accept") String accept) throws IOException; + ResponseEntity placeOrder(@ApiParam(value = "order placed for purchasing the pet" ,required=true ) @Valid @RequestBody Order body); } diff --git a/samples/client/petstore/spring-stubs/src/main/java/io/swagger/api/UserApi.java b/samples/client/petstore/spring-stubs/src/main/java/io/swagger/api/UserApi.java index 5a4cef2892..ceab49231a 100644 --- a/samples/client/petstore/spring-stubs/src/main/java/io/swagger/api/UserApi.java +++ b/samples/client/petstore/spring-stubs/src/main/java/io/swagger/api/UserApi.java @@ -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.*; @@ -25,42 +24,46 @@ public interface UserApi { @ApiOperation(value = "Create user", notes = "This can only be done by the logged in user.", response = Void.class, tags={ "user", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Void.class) }) + @RequestMapping(value = "/user", produces = "application/json", consumes = "application/json", method = RequestMethod.POST) - ResponseEntity createUser(@ApiParam(value = "Created user object" ,required=true ) @Valid @RequestBody User body, @RequestHeader("Accept") String accept); + ResponseEntity createUser(@ApiParam(value = "Created user object" ,required=true ) @Valid @RequestBody User body); @ApiOperation(value = "Creates list of users with given input array", notes = "", response = Void.class, tags={ "user", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Void.class) }) + @RequestMapping(value = "/user/createWithArray", produces = "application/json", consumes = "application/json", method = RequestMethod.POST) - ResponseEntity createUsersWithArrayInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody List body, @RequestHeader("Accept") String accept); + ResponseEntity createUsersWithArrayInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody List body); @ApiOperation(value = "Creates list of users with given input array", notes = "", response = Void.class, tags={ "user", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Void.class) }) + @RequestMapping(value = "/user/createWithList", produces = "application/json", consumes = "application/json", method = RequestMethod.POST) - ResponseEntity createUsersWithListInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody List body, @RequestHeader("Accept") String accept); + ResponseEntity createUsersWithListInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody List body); @ApiOperation(value = "Delete user", notes = "This can only be done by the logged in user.", response = Void.class, tags={ "user", }) @ApiResponses(value = { @ApiResponse(code = 400, message = "Invalid username supplied", response = Void.class), @ApiResponse(code = 404, message = "User not found", response = Void.class) }) + @RequestMapping(value = "/user/{username}", produces = "application/json", consumes = "application/json", method = RequestMethod.DELETE) - ResponseEntity deleteUser(@ApiParam(value = "The name that needs to be deleted",required=true ) @PathVariable("username") String username, @RequestHeader("Accept") String accept); + ResponseEntity deleteUser(@ApiParam(value = "The name that needs to be deleted",required=true ) @PathVariable("username") String username); @ApiOperation(value = "Get user by user name", notes = "", response = User.class, tags={ "user", }) @@ -68,42 +71,46 @@ public interface UserApi { @ApiResponse(code = 200, message = "successful operation", response = User.class), @ApiResponse(code = 400, message = "Invalid username supplied", response = User.class), @ApiResponse(code = 404, message = "User not found", response = User.class) }) + @RequestMapping(value = "/user/{username}", produces = "application/json", consumes = "application/json", method = RequestMethod.GET) - ResponseEntity getUserByName(@ApiParam(value = "The name that needs to be fetched. Use user1 for testing. ",required=true ) @PathVariable("username") String username, @RequestHeader("Accept") String accept) throws IOException; + ResponseEntity getUserByName(@ApiParam(value = "The name that needs to be fetched. Use user1 for testing. ",required=true ) @PathVariable("username") String username); @ApiOperation(value = "Logs user into the system", notes = "", response = String.class, tags={ "user", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = String.class), @ApiResponse(code = 400, message = "Invalid username/password supplied", response = String.class) }) + @RequestMapping(value = "/user/login", produces = "application/json", consumes = "application/json", method = RequestMethod.GET) - ResponseEntity loginUser( @NotNull@ApiParam(value = "The user name for login", required = true) @RequestParam(value = "username", required = true) String username, @NotNull@ApiParam(value = "The password for login in clear text", required = true) @RequestParam(value = "password", required = true) String password, @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); @ApiOperation(value = "Logs out current logged in user session", notes = "", response = Void.class, tags={ "user", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Void.class) }) + @RequestMapping(value = "/user/logout", produces = "application/json", consumes = "application/json", method = RequestMethod.GET) - ResponseEntity logoutUser( @RequestHeader("Accept") String accept); + ResponseEntity logoutUser(); @ApiOperation(value = "Updated user", notes = "This can only be done by the logged in user.", response = Void.class, tags={ "user", }) @ApiResponses(value = { @ApiResponse(code = 400, message = "Invalid user supplied", response = Void.class), @ApiResponse(code = 404, message = "User not found", response = Void.class) }) + @RequestMapping(value = "/user/{username}", produces = "application/json", consumes = "application/json", method = RequestMethod.PUT) - ResponseEntity updateUser(@ApiParam(value = "name that need to be deleted",required=true ) @PathVariable("username") String username,@ApiParam(value = "Updated user object" ,required=true ) @Valid @RequestBody User body, @RequestHeader("Accept") String accept); + ResponseEntity updateUser(@ApiParam(value = "name that need to be deleted",required=true ) @PathVariable("username") String username,@ApiParam(value = "Updated user object" ,required=true ) @Valid @RequestBody User body); } diff --git a/samples/client/petstore/spring-stubs/src/main/java/io/swagger/model/Category.java b/samples/client/petstore/spring-stubs/src/main/java/io/swagger/model/Category.java index 7289c191a9..55a5d0ec28 100644 --- a/samples/client/petstore/spring-stubs/src/main/java/io/swagger/model/Category.java +++ b/samples/client/petstore/spring-stubs/src/main/java/io/swagger/model/Category.java @@ -31,7 +31,7 @@ public class Category { **/ @ApiModelProperty(value = "") - @Valid + public Long getId() { return id; } @@ -51,7 +51,7 @@ public class Category { **/ @ApiModelProperty(value = "") - @Valid + public String getName() { return name; } diff --git a/samples/client/petstore/spring-stubs/src/main/java/io/swagger/model/ModelApiResponse.java b/samples/client/petstore/spring-stubs/src/main/java/io/swagger/model/ModelApiResponse.java index d9a1123d08..f06b378a52 100644 --- a/samples/client/petstore/spring-stubs/src/main/java/io/swagger/model/ModelApiResponse.java +++ b/samples/client/petstore/spring-stubs/src/main/java/io/swagger/model/ModelApiResponse.java @@ -34,7 +34,7 @@ public class ModelApiResponse { **/ @ApiModelProperty(value = "") - @Valid + public Integer getCode() { return code; } @@ -54,7 +54,7 @@ public class ModelApiResponse { **/ @ApiModelProperty(value = "") - @Valid + public String getType() { return type; } @@ -74,7 +74,7 @@ public class ModelApiResponse { **/ @ApiModelProperty(value = "") - @Valid + public String getMessage() { return message; } diff --git a/samples/client/petstore/spring-stubs/src/main/java/io/swagger/model/Order.java b/samples/client/petstore/spring-stubs/src/main/java/io/swagger/model/Order.java index 728be28129..5240964394 100644 --- a/samples/client/petstore/spring-stubs/src/main/java/io/swagger/model/Order.java +++ b/samples/client/petstore/spring-stubs/src/main/java/io/swagger/model/Order.java @@ -78,7 +78,7 @@ public class Order { **/ @ApiModelProperty(value = "") - @Valid + public Long getId() { return id; } @@ -98,7 +98,7 @@ public class Order { **/ @ApiModelProperty(value = "") - @Valid + public Long getPetId() { return petId; } @@ -118,7 +118,7 @@ public class Order { **/ @ApiModelProperty(value = "") - @Valid + public Integer getQuantity() { return quantity; } @@ -139,6 +139,7 @@ public class Order { @ApiModelProperty(value = "") @Valid + public DateTime getShipDate() { return shipDate; } @@ -158,7 +159,7 @@ public class Order { **/ @ApiModelProperty(value = "Order Status") - @Valid + public StatusEnum getStatus() { return status; } @@ -178,7 +179,7 @@ public class Order { **/ @ApiModelProperty(value = "") - @Valid + public Boolean getComplete() { return complete; } diff --git a/samples/client/petstore/spring-stubs/src/main/java/io/swagger/model/Pet.java b/samples/client/petstore/spring-stubs/src/main/java/io/swagger/model/Pet.java index f79e9ae56d..367ec151b7 100644 --- a/samples/client/petstore/spring-stubs/src/main/java/io/swagger/model/Pet.java +++ b/samples/client/petstore/spring-stubs/src/main/java/io/swagger/model/Pet.java @@ -81,7 +81,7 @@ public class Pet { **/ @ApiModelProperty(value = "") - @Valid + public Long getId() { return id; } @@ -102,6 +102,7 @@ public class Pet { @ApiModelProperty(value = "") @Valid + public Category getCategory() { return category; } @@ -122,7 +123,7 @@ public class Pet { @ApiModelProperty(example = "doggie", required = true, value = "") @NotNull - @Valid + public String getName() { return name; } @@ -148,7 +149,7 @@ public class Pet { @ApiModelProperty(required = true, value = "") @NotNull - @Valid + public List getPhotoUrls() { return photoUrls; } @@ -177,6 +178,7 @@ public class Pet { @ApiModelProperty(value = "") @Valid + public List getTags() { return tags; } @@ -196,7 +198,7 @@ public class Pet { **/ @ApiModelProperty(value = "pet status in the store") - @Valid + public StatusEnum getStatus() { return status; } diff --git a/samples/client/petstore/spring-stubs/src/main/java/io/swagger/model/Tag.java b/samples/client/petstore/spring-stubs/src/main/java/io/swagger/model/Tag.java index e9ad7e5165..b44f2ac0bf 100644 --- a/samples/client/petstore/spring-stubs/src/main/java/io/swagger/model/Tag.java +++ b/samples/client/petstore/spring-stubs/src/main/java/io/swagger/model/Tag.java @@ -31,7 +31,7 @@ public class Tag { **/ @ApiModelProperty(value = "") - @Valid + public Long getId() { return id; } @@ -51,7 +51,7 @@ public class Tag { **/ @ApiModelProperty(value = "") - @Valid + public String getName() { return name; } diff --git a/samples/client/petstore/spring-stubs/src/main/java/io/swagger/model/User.java b/samples/client/petstore/spring-stubs/src/main/java/io/swagger/model/User.java index b3b24907d9..e2abb60d07 100644 --- a/samples/client/petstore/spring-stubs/src/main/java/io/swagger/model/User.java +++ b/samples/client/petstore/spring-stubs/src/main/java/io/swagger/model/User.java @@ -49,7 +49,7 @@ public class User { **/ @ApiModelProperty(value = "") - @Valid + public Long getId() { return id; } @@ -69,7 +69,7 @@ public class User { **/ @ApiModelProperty(value = "") - @Valid + public String getUsername() { return username; } @@ -89,7 +89,7 @@ public class User { **/ @ApiModelProperty(value = "") - @Valid + public String getFirstName() { return firstName; } @@ -109,7 +109,7 @@ public class User { **/ @ApiModelProperty(value = "") - @Valid + public String getLastName() { return lastName; } @@ -129,7 +129,7 @@ public class User { **/ @ApiModelProperty(value = "") - @Valid + public String getEmail() { return email; } @@ -149,7 +149,7 @@ public class User { **/ @ApiModelProperty(value = "") - @Valid + public String getPassword() { return password; } @@ -169,7 +169,7 @@ public class User { **/ @ApiModelProperty(value = "") - @Valid + public String getPhone() { return phone; } @@ -189,7 +189,7 @@ public class User { **/ @ApiModelProperty(value = "User Status") - @Valid + public Integer getUserStatus() { return userStatus; } 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 5dc9bce00e..8903031c0c 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 @@ -16,7 +16,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 java.util.concurrent.CompletableFuture; @@ -29,11 +28,12 @@ public interface FakeApi { @ApiOperation(value = "To test \"client\" model", notes = "To test \"client\" model", response = Client.class, tags={ "fake", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Client.class) }) + @RequestMapping(value = "/fake", produces = { "application/json" }, consumes = { "application/json" }, method = RequestMethod.PATCH) - default CompletableFuture> testClientModel(@ApiParam(value = "client model" ,required=true ) @Valid @RequestBody Client body, @RequestHeader("Accept") String accept) throws IOException { + default CompletableFuture> testClientModel(@ApiParam(value = "client model" ,required=true ) @Valid @RequestBody Client body) { // do some magic! return CompletableFuture.completedFuture(new ResponseEntity(HttpStatus.OK)); } @@ -45,11 +45,12 @@ public interface FakeApi { @ApiResponses(value = { @ApiResponse(code = 400, message = "Invalid username supplied", response = Void.class), @ApiResponse(code = 404, message = "User not found", response = Void.class) }) + @RequestMapping(value = "/fake", produces = { "application/xml; charset=utf-8", "application/json; charset=utf-8" }, consumes = { "application/xml; charset=utf-8", "application/json; charset=utf-8" }, method = RequestMethod.POST) - default CompletableFuture> testEndpointParameters(@ApiParam(value = "None", required=true) @RequestPart(value="number", required=true) BigDecimal number,@ApiParam(value = "None", required=true) @RequestPart(value="double", required=true) Double _double,@ApiParam(value = "None", required=true) @RequestPart(value="pattern_without_delimiter", required=true) String patternWithoutDelimiter,@ApiParam(value = "None", required=true) @RequestPart(value="byte", required=true) byte[] _byte,@ApiParam(value = "None") @RequestPart(value="integer", required=false) Integer integer,@ApiParam(value = "None") @RequestPart(value="int32", required=false) Integer int32,@ApiParam(value = "None") @RequestPart(value="int64", required=false) Long int64,@ApiParam(value = "None") @RequestPart(value="float", required=false) Float _float,@ApiParam(value = "None") @RequestPart(value="string", required=false) String string,@ApiParam(value = "None") @RequestPart(value="binary", required=false) byte[] binary,@ApiParam(value = "None") @RequestPart(value="date", required=false) LocalDate date,@ApiParam(value = "None") @RequestPart(value="dateTime", required=false) OffsetDateTime dateTime,@ApiParam(value = "None") @RequestPart(value="password", required=false) String password,@ApiParam(value = "None") @RequestPart(value="callback", required=false) String paramCallback, @RequestHeader("Accept") String accept) { + default CompletableFuture> testEndpointParameters(@ApiParam(value = "None", required=true) @RequestPart(value="number", required=true) BigDecimal number,@ApiParam(value = "None", required=true) @RequestPart(value="double", required=true) Double _double,@ApiParam(value = "None", required=true) @RequestPart(value="pattern_without_delimiter", required=true) String patternWithoutDelimiter,@ApiParam(value = "None", required=true) @RequestPart(value="byte", required=true) byte[] _byte,@ApiParam(value = "None") @RequestPart(value="integer", required=false) Integer integer,@ApiParam(value = "None") @RequestPart(value="int32", required=false) Integer int32,@ApiParam(value = "None") @RequestPart(value="int64", required=false) Long int64,@ApiParam(value = "None") @RequestPart(value="float", required=false) Float _float,@ApiParam(value = "None") @RequestPart(value="string", required=false) String string,@ApiParam(value = "None") @RequestPart(value="binary", required=false) byte[] binary,@ApiParam(value = "None") @RequestPart(value="date", required=false) LocalDate date,@ApiParam(value = "None") @RequestPart(value="dateTime", required=false) OffsetDateTime dateTime,@ApiParam(value = "None") @RequestPart(value="password", required=false) String password,@ApiParam(value = "None") @RequestPart(value="callback", required=false) String paramCallback) { // do some magic! return CompletableFuture.completedFuture(new ResponseEntity(HttpStatus.OK)); } @@ -59,11 +60,12 @@ public interface FakeApi { @ApiResponses(value = { @ApiResponse(code = 400, message = "Invalid request", response = Void.class), @ApiResponse(code = 404, message = "Not found", response = Void.class) }) + @RequestMapping(value = "/fake", produces = { "*/*" }, consumes = { "*/*" }, method = RequestMethod.GET) - default 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) { // 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 c9bf94efe6..c3ae70f89c 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,17 +1,13 @@ 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 1c4d6eade7..541cf27903 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 @@ -15,7 +15,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 java.util.concurrent.CompletableFuture; @@ -33,11 +32,12 @@ public interface PetApi { }, tags={ "pet", }) @ApiResponses(value = { @ApiResponse(code = 405, message = "Invalid input", response = Void.class) }) + @RequestMapping(value = "/pet", produces = { "application/xml", "application/json" }, consumes = { "application/json", "application/xml" }, method = RequestMethod.POST) - default CompletableFuture> addPet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody Pet body, @RequestHeader("Accept") String accept) { + default CompletableFuture> addPet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody Pet body) { // do some magic! return CompletableFuture.completedFuture(new ResponseEntity(HttpStatus.OK)); } @@ -51,10 +51,11 @@ public interface PetApi { }, tags={ "pet", }) @ApiResponses(value = { @ApiResponse(code = 400, message = "Invalid pet value", response = Void.class) }) + @RequestMapping(value = "/pet/{petId}", produces = { "application/xml", "application/json" }, method = RequestMethod.DELETE) - default CompletableFuture> deletePet(@ApiParam(value = "Pet id to delete",required=true ) @PathVariable("petId") Long petId,@ApiParam(value = "" ) @RequestHeader(value="api_key", required=false) String apiKey, @RequestHeader("Accept") String accept) { + default CompletableFuture> deletePet(@ApiParam(value = "Pet id to delete",required=true ) @PathVariable("petId") Long petId,@ApiParam(value = "" ) @RequestHeader(value="api_key", required=false) String apiKey) { // do some magic! return CompletableFuture.completedFuture(new ResponseEntity(HttpStatus.OK)); } @@ -69,10 +70,11 @@ public interface PetApi { @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Pet.class), @ApiResponse(code = 400, message = "Invalid status value", response = Pet.class) }) + @RequestMapping(value = "/pet/findByStatus", produces = { "application/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) { // do some magic! return CompletableFuture.completedFuture(new ResponseEntity>(HttpStatus.OK)); } @@ -87,10 +89,11 @@ public interface PetApi { @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Pet.class), @ApiResponse(code = 400, message = "Invalid tag value", response = Pet.class) }) + @RequestMapping(value = "/pet/findByTags", produces = { "application/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) { // do some magic! return CompletableFuture.completedFuture(new ResponseEntity>(HttpStatus.OK)); } @@ -103,10 +106,11 @@ public interface PetApi { @ApiResponse(code = 200, message = "successful operation", response = Pet.class), @ApiResponse(code = 400, message = "Invalid ID supplied", response = Pet.class), @ApiResponse(code = 404, message = "Pet not found", response = Pet.class) }) + @RequestMapping(value = "/pet/{petId}", produces = { "application/xml", "application/json" }, method = RequestMethod.GET) - default CompletableFuture> getPetById(@ApiParam(value = "ID of pet to return",required=true ) @PathVariable("petId") Long petId, @RequestHeader("Accept") String accept) throws IOException { + default CompletableFuture> getPetById(@ApiParam(value = "ID of pet to return",required=true ) @PathVariable("petId") Long petId) { // do some magic! return CompletableFuture.completedFuture(new ResponseEntity(HttpStatus.OK)); } @@ -122,11 +126,12 @@ public interface PetApi { @ApiResponse(code = 400, message = "Invalid ID supplied", response = Void.class), @ApiResponse(code = 404, message = "Pet not found", response = Void.class), @ApiResponse(code = 405, message = "Validation exception", response = Void.class) }) + @RequestMapping(value = "/pet", produces = { "application/xml", "application/json" }, consumes = { "application/json", "application/xml" }, method = RequestMethod.PUT) - default CompletableFuture> updatePet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody Pet body, @RequestHeader("Accept") String accept) { + default CompletableFuture> updatePet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody Pet body) { // do some magic! return CompletableFuture.completedFuture(new ResponseEntity(HttpStatus.OK)); } @@ -140,11 +145,12 @@ public interface PetApi { }, tags={ "pet", }) @ApiResponses(value = { @ApiResponse(code = 405, message = "Invalid input", response = Void.class) }) + @RequestMapping(value = "/pet/{petId}", produces = { "application/xml", "application/json" }, consumes = { "application/x-www-form-urlencoded" }, method = RequestMethod.POST) - default CompletableFuture> updatePetWithForm(@ApiParam(value = "ID of pet that needs to be updated",required=true ) @PathVariable("petId") Long petId,@ApiParam(value = "Updated name of the pet") @RequestPart(value="name", required=false) String name,@ApiParam(value = "Updated status of the pet") @RequestPart(value="status", required=false) String status, @RequestHeader("Accept") String accept) { + default CompletableFuture> updatePetWithForm(@ApiParam(value = "ID of pet that needs to be updated",required=true ) @PathVariable("petId") Long petId,@ApiParam(value = "Updated name of the pet") @RequestPart(value="name", required=false) String name,@ApiParam(value = "Updated status of the pet") @RequestPart(value="status", required=false) String status) { // do some magic! return CompletableFuture.completedFuture(new ResponseEntity(HttpStatus.OK)); } @@ -158,11 +164,12 @@ public interface PetApi { }, tags={ "pet", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = ModelApiResponse.class) }) + @RequestMapping(value = "/pet/{petId}/uploadImage", produces = { "application/json" }, consumes = { "multipart/form-data" }, method = RequestMethod.POST) - default CompletableFuture> uploadFile(@ApiParam(value = "ID of pet to update",required=true ) @PathVariable("petId") Long petId,@ApiParam(value = "Additional data to pass to server") @RequestPart(value="additionalMetadata", required=false) String additionalMetadata,@ApiParam(value = "file detail") @RequestPart("file") MultipartFile file, @RequestHeader("Accept") String accept) throws IOException { + default CompletableFuture> uploadFile(@ApiParam(value = "ID of pet to update",required=true ) @PathVariable("petId") Long petId,@ApiParam(value = "Additional data to pass to server") @RequestPart(value="additionalMetadata", required=false) String additionalMetadata,@ApiParam(value = "file detail") @RequestPart("file") MultipartFile file) { // 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 5dd78a0e76..dc21c5e352 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,17 +1,13 @@ 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/StoreApi.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/StoreApi.java index 3039796d0c..8a1056032b 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/StoreApi.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/StoreApi.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 java.util.concurrent.CompletableFuture; @@ -28,10 +27,11 @@ public interface StoreApi { @ApiResponses(value = { @ApiResponse(code = 400, message = "Invalid ID supplied", response = Void.class), @ApiResponse(code = 404, message = "Order not found", response = Void.class) }) + @RequestMapping(value = "/store/order/{order_id}", produces = { "application/xml", "application/json" }, method = RequestMethod.DELETE) - default CompletableFuture> deleteOrder(@ApiParam(value = "ID of the order that needs to be deleted",required=true ) @PathVariable("order_id") String orderId, @RequestHeader("Accept") String accept) { + default CompletableFuture> deleteOrder(@ApiParam(value = "ID of the order that needs to be deleted",required=true ) @PathVariable("order_id") String orderId) { // do some magic! return CompletableFuture.completedFuture(new ResponseEntity(HttpStatus.OK)); } @@ -42,10 +42,11 @@ public interface StoreApi { }, tags={ "store", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Integer.class) }) + @RequestMapping(value = "/store/inventory", produces = { "application/json" }, method = RequestMethod.GET) - default CompletableFuture>> getInventory( @RequestHeader("Accept") String accept) throws IOException { + default CompletableFuture>> getInventory() { // do some magic! return CompletableFuture.completedFuture(new ResponseEntity>(HttpStatus.OK)); } @@ -56,10 +57,11 @@ public interface StoreApi { @ApiResponse(code = 200, message = "successful operation", response = Order.class), @ApiResponse(code = 400, message = "Invalid ID supplied", response = Order.class), @ApiResponse(code = 404, message = "Order not found", response = Order.class) }) + @RequestMapping(value = "/store/order/{order_id}", produces = { "application/xml", "application/json" }, method = RequestMethod.GET) - default CompletableFuture> getOrderById( @Min(1) @Max(5)@ApiParam(value = "ID of pet that needs to be fetched",required=true ) @PathVariable("order_id") Long orderId, @RequestHeader("Accept") String accept) throws IOException { + default CompletableFuture> getOrderById( @Min(1) @Max(5)@ApiParam(value = "ID of pet that needs to be fetched",required=true ) @PathVariable("order_id") Long orderId) { // do some magic! return CompletableFuture.completedFuture(new ResponseEntity(HttpStatus.OK)); } @@ -69,10 +71,11 @@ public interface StoreApi { @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Order.class), @ApiResponse(code = 400, message = "Invalid Order", response = Order.class) }) + @RequestMapping(value = "/store/order", produces = { "application/xml", "application/json" }, method = RequestMethod.POST) - default CompletableFuture> placeOrder(@ApiParam(value = "order placed for purchasing the pet" ,required=true ) @Valid @RequestBody Order body, @RequestHeader("Accept") String accept) throws IOException { + default CompletableFuture> placeOrder(@ApiParam(value = "order placed for purchasing the pet" ,required=true ) @Valid @RequestBody Order body) { // 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/StoreApiController.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/StoreApiController.java index 652923c800..341bd1184a 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,17 +1,13 @@ 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 21aee4b168..97cf9be47e 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 @@ -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 java.util.concurrent.CompletableFuture; @@ -27,10 +26,11 @@ public interface UserApi { @ApiOperation(value = "Create user", notes = "This can only be done by the logged in user.", response = Void.class, tags={ "user", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Void.class) }) + @RequestMapping(value = "/user", produces = { "application/xml", "application/json" }, method = RequestMethod.POST) - default CompletableFuture> createUser(@ApiParam(value = "Created user object" ,required=true ) @Valid @RequestBody User body, @RequestHeader("Accept") String accept) { + default CompletableFuture> createUser(@ApiParam(value = "Created user object" ,required=true ) @Valid @RequestBody User body) { // do some magic! return CompletableFuture.completedFuture(new ResponseEntity(HttpStatus.OK)); } @@ -39,10 +39,11 @@ public interface UserApi { @ApiOperation(value = "Creates list of users with given input array", notes = "", response = Void.class, tags={ "user", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Void.class) }) + @RequestMapping(value = "/user/createWithArray", produces = { "application/xml", "application/json" }, method = RequestMethod.POST) - default CompletableFuture> createUsersWithArrayInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody List body, @RequestHeader("Accept") String accept) { + default CompletableFuture> createUsersWithArrayInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody List body) { // do some magic! return CompletableFuture.completedFuture(new ResponseEntity(HttpStatus.OK)); } @@ -51,10 +52,11 @@ public interface UserApi { @ApiOperation(value = "Creates list of users with given input array", notes = "", response = Void.class, tags={ "user", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Void.class) }) + @RequestMapping(value = "/user/createWithList", produces = { "application/xml", "application/json" }, method = RequestMethod.POST) - default CompletableFuture> createUsersWithListInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody List body, @RequestHeader("Accept") String accept) { + default CompletableFuture> createUsersWithListInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody List body) { // do some magic! return CompletableFuture.completedFuture(new ResponseEntity(HttpStatus.OK)); } @@ -64,10 +66,11 @@ public interface UserApi { @ApiResponses(value = { @ApiResponse(code = 400, message = "Invalid username supplied", response = Void.class), @ApiResponse(code = 404, message = "User not found", response = Void.class) }) + @RequestMapping(value = "/user/{username}", produces = { "application/xml", "application/json" }, method = RequestMethod.DELETE) - default CompletableFuture> deleteUser(@ApiParam(value = "The name that needs to be deleted",required=true ) @PathVariable("username") String username, @RequestHeader("Accept") String accept) { + default CompletableFuture> deleteUser(@ApiParam(value = "The name that needs to be deleted",required=true ) @PathVariable("username") String username) { // do some magic! return CompletableFuture.completedFuture(new ResponseEntity(HttpStatus.OK)); } @@ -78,10 +81,11 @@ public interface UserApi { @ApiResponse(code = 200, message = "successful operation", response = User.class), @ApiResponse(code = 400, message = "Invalid username supplied", response = User.class), @ApiResponse(code = 404, message = "User not found", response = User.class) }) + @RequestMapping(value = "/user/{username}", produces = { "application/xml", "application/json" }, method = RequestMethod.GET) - default CompletableFuture> getUserByName(@ApiParam(value = "The name that needs to be fetched. Use user1 for testing. ",required=true ) @PathVariable("username") String username, @RequestHeader("Accept") String accept) throws IOException { + default CompletableFuture> getUserByName(@ApiParam(value = "The name that needs to be fetched. Use user1 for testing. ",required=true ) @PathVariable("username") String username) { // do some magic! return CompletableFuture.completedFuture(new ResponseEntity(HttpStatus.OK)); } @@ -91,10 +95,11 @@ public interface UserApi { @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = String.class), @ApiResponse(code = 400, message = "Invalid username/password supplied", response = String.class) }) + @RequestMapping(value = "/user/login", produces = { "application/xml", "application/json" }, method = RequestMethod.GET) - default 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) { // do some magic! return CompletableFuture.completedFuture(new ResponseEntity(HttpStatus.OK)); } @@ -103,10 +108,11 @@ public interface UserApi { @ApiOperation(value = "Logs out current logged in user session", notes = "", response = Void.class, tags={ "user", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Void.class) }) + @RequestMapping(value = "/user/logout", produces = { "application/xml", "application/json" }, method = RequestMethod.GET) - default CompletableFuture> logoutUser( @RequestHeader("Accept") String accept) { + default CompletableFuture> logoutUser() { // do some magic! return CompletableFuture.completedFuture(new ResponseEntity(HttpStatus.OK)); } @@ -116,10 +122,11 @@ public interface UserApi { @ApiResponses(value = { @ApiResponse(code = 400, message = "Invalid user supplied", response = Void.class), @ApiResponse(code = 404, message = "User not found", response = Void.class) }) + @RequestMapping(value = "/user/{username}", produces = { "application/xml", "application/json" }, method = RequestMethod.PUT) - default CompletableFuture> updateUser(@ApiParam(value = "name that need to be deleted",required=true ) @PathVariable("username") String username,@ApiParam(value = "Updated user object" ,required=true ) @Valid @RequestBody User body, @RequestHeader("Accept") String accept) { + default CompletableFuture> updateUser(@ApiParam(value = "name that need to be deleted",required=true ) @PathVariable("username") String username,@ApiParam(value = "Updated user object" ,required=true ) @Valid @RequestBody User body) { // 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 5afeac776d..f33d583cd7 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,17 +1,13 @@ 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/model/AdditionalPropertiesClass.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/AdditionalPropertiesClass.java index 80be4236b0..532576aad8 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 @@ -41,7 +41,7 @@ public class AdditionalPropertiesClass { **/ @ApiModelProperty(value = "") - @Valid + public Map getMapProperty() { return mapProperty; } @@ -70,6 +70,7 @@ public class AdditionalPropertiesClass { @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 bc957d1c80..a59dc766c5 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 @@ -38,7 +38,7 @@ public class Animal { @ApiModelProperty(required = true, value = "") @NotNull - @Valid + public String getClassName() { return className; } @@ -58,7 +58,7 @@ public class Animal { **/ @ApiModelProperty(value = "") - @Valid + public String getColor() { return color; } 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 f9dca7d60b..ecff36e416 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 @@ -39,6 +39,7 @@ public class ArrayOfArrayOfNumberOnly { @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 e9c8a313be..a08ff749ee 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 @@ -39,6 +39,7 @@ public class ArrayOfNumberOnly { @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 78c35d3c63..e9022fd028 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 @@ -44,7 +44,7 @@ public class ArrayTest { **/ @ApiModelProperty(value = "") - @Valid + public List getArrayOfString() { return arrayOfString; } @@ -73,6 +73,7 @@ public class ArrayTest { @ApiModelProperty(value = "") @Valid + public List> getArrayArrayOfInteger() { return arrayArrayOfInteger; } @@ -101,6 +102,7 @@ public class ArrayTest { @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 93533c2882..d59005adf1 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 @@ -42,7 +42,7 @@ public class Capitalization { **/ @ApiModelProperty(value = "") - @Valid + public String getSmallCamel() { return smallCamel; } @@ -62,7 +62,7 @@ public class Capitalization { **/ @ApiModelProperty(value = "") - @Valid + public String getCapitalCamel() { return capitalCamel; } @@ -82,7 +82,7 @@ public class Capitalization { **/ @ApiModelProperty(value = "") - @Valid + public String getSmallSnake() { return smallSnake; } @@ -102,7 +102,7 @@ public class Capitalization { **/ @ApiModelProperty(value = "") - @Valid + public String getCapitalSnake() { return capitalSnake; } @@ -122,7 +122,7 @@ public class Capitalization { **/ @ApiModelProperty(value = "") - @Valid + public String getScAETHFlowPoints() { return scAETHFlowPoints; } @@ -142,7 +142,7 @@ public class Capitalization { **/ @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 edcbc354be..28016fa5ad 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 @@ -28,7 +28,7 @@ public class Cat extends Animal { **/ @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 6dd9cb7a2a..e2a67cf25d 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 @@ -30,7 +30,7 @@ public class Category { **/ @ApiModelProperty(value = "") - @Valid + public Long getId() { return id; } @@ -50,7 +50,7 @@ public class Category { **/ @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 6a6379f5b6..a5ef34a233 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 @@ -28,7 +28,7 @@ public class ClassModel { **/ @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 3b8d16cabf..aaa03c570f 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 @@ -27,7 +27,7 @@ public class 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 513131a9fa..8ebd0f46a6 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 @@ -28,7 +28,7 @@ public class Dog extends Animal { **/ @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 bbf4a3036e..4d79aa66c5 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 @@ -95,7 +95,7 @@ public class EnumArrays { **/ @ApiModelProperty(value = "") - @Valid + public JustSymbolEnum getJustSymbol() { return justSymbol; } @@ -123,7 +123,7 @@ public class EnumArrays { **/ @ApiModelProperty(value = "") - @Valid + public List getArrayEnum() { return arrayEnum; } 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 c7e4793cdf..a072f99267 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 @@ -133,7 +133,7 @@ public class EnumTest { **/ @ApiModelProperty(value = "") - @Valid + public EnumStringEnum getEnumString() { return enumString; } @@ -153,7 +153,7 @@ public class EnumTest { **/ @ApiModelProperty(value = "") - @Valid + public EnumIntegerEnum getEnumInteger() { return enumInteger; } @@ -173,7 +173,7 @@ public class EnumTest { **/ @ApiModelProperty(value = "") - @Valid + public EnumNumberEnum getEnumNumber() { return enumNumber; } @@ -194,6 +194,7 @@ public class EnumTest { @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 f63a8de2c1..b5d0c2e250 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 @@ -68,8 +68,8 @@ public class FormatTest { * @return integer **/ @ApiModelProperty(value = "") + @Min(10) @Max(100) - @Valid public Integer getInteger() { return integer; } @@ -90,8 +90,8 @@ public class FormatTest { * @return int32 **/ @ApiModelProperty(value = "") + @Min(20) @Max(200) - @Valid public Integer getInt32() { return int32; } @@ -111,7 +111,7 @@ public class FormatTest { **/ @ApiModelProperty(value = "") - @Valid + public Long getInt64() { return int64; } @@ -133,8 +133,9 @@ public class FormatTest { **/ @ApiModelProperty(required = true, value = "") @NotNull - @DecimalMin("32.1") @DecimalMax("543.2") + @Valid + @DecimalMin("32.1") @DecimalMax("543.2") public BigDecimal getNumber() { return number; } @@ -155,8 +156,8 @@ public class FormatTest { * @return _float **/ @ApiModelProperty(value = "") + @DecimalMin("54.3") @DecimalMax("987.6") - @Valid public Float getFloat() { return _float; } @@ -177,8 +178,8 @@ public class FormatTest { * @return _double **/ @ApiModelProperty(value = "") + @DecimalMin("67.8") @DecimalMax("123.4") - @Valid public Double getDouble() { return _double; } @@ -197,8 +198,8 @@ public class FormatTest { * @return string **/ @ApiModelProperty(value = "") + @Pattern(regexp="/[a-z]/i") - @Valid public String getString() { return string; } @@ -219,7 +220,7 @@ public class FormatTest { @ApiModelProperty(required = true, value = "") @NotNull - @Valid + public byte[] getByte() { return _byte; } @@ -239,7 +240,7 @@ public class FormatTest { **/ @ApiModelProperty(value = "") - @Valid + public byte[] getBinary() { return binary; } @@ -261,6 +262,7 @@ public class FormatTest { @NotNull @Valid + public LocalDate getDate() { return date; } @@ -281,6 +283,7 @@ public class FormatTest { @ApiModelProperty(value = "") @Valid + public OffsetDateTime getDateTime() { return dateTime; } @@ -301,6 +304,7 @@ public class FormatTest { @ApiModelProperty(value = "") @Valid + public UUID getUuid() { return uuid; } @@ -320,8 +324,8 @@ public class FormatTest { **/ @ApiModelProperty(required = true, value = "") @NotNull + @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 0f8b608e26..dc59cf9c78 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 @@ -30,7 +30,7 @@ public class HasOnlyReadOnly { **/ @ApiModelProperty(readOnly = true, value = "") - @Valid + public String getBar() { return bar; } @@ -50,7 +50,7 @@ public class HasOnlyReadOnly { **/ @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 1530a53f53..f179e8e423 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 @@ -74,6 +74,7 @@ public class MapTest { @ApiModelProperty(value = "") @Valid + public Map> getMapMapOfString() { return mapMapOfString; } @@ -101,7 +102,7 @@ public class MapTest { **/ @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 eafbcb4ecb..8848aaab32 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 @@ -40,6 +40,7 @@ public class MixedPropertiesAndAdditionalPropertiesClass { @ApiModelProperty(value = "") @Valid + public UUID getUuid() { return uuid; } @@ -60,6 +61,7 @@ public class MixedPropertiesAndAdditionalPropertiesClass { @ApiModelProperty(value = "") @Valid + public OffsetDateTime getDateTime() { return dateTime; } @@ -88,6 +90,7 @@ public class MixedPropertiesAndAdditionalPropertiesClass { @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 97349fef05..c00e48ea6c 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 @@ -31,7 +31,7 @@ public class Model200Response { **/ @ApiModelProperty(value = "") - @Valid + public Integer getName() { return name; } @@ -51,7 +51,7 @@ public class Model200Response { **/ @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 c8882b3b1e..1df487b353 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 @@ -33,7 +33,7 @@ public class ModelApiResponse { **/ @ApiModelProperty(value = "") - @Valid + public Integer getCode() { return code; } @@ -53,7 +53,7 @@ public class ModelApiResponse { **/ @ApiModelProperty(value = "") - @Valid + public String getType() { return type; } @@ -73,7 +73,7 @@ public class ModelApiResponse { **/ @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 7018d7de09..3b05293b83 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 @@ -28,7 +28,7 @@ public class ModelReturn { **/ @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 46069fdd14..a9835f910a 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 @@ -38,7 +38,7 @@ public class Name { @ApiModelProperty(required = true, value = "") @NotNull - @Valid + public Integer getName() { return name; } @@ -58,7 +58,7 @@ public class Name { **/ @ApiModelProperty(readOnly = true, value = "") - @Valid + public Integer getSnakeCase() { return snakeCase; } @@ -78,7 +78,7 @@ public class Name { **/ @ApiModelProperty(value = "") - @Valid + public String getProperty() { return property; } @@ -98,7 +98,7 @@ public class Name { **/ @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 e243ecb429..a990653f20 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 @@ -29,6 +29,7 @@ public class NumberOnly { @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 e1a5d94cc8..1b5522ac6a 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 @@ -77,7 +77,7 @@ public class Order { **/ @ApiModelProperty(value = "") - @Valid + public Long getId() { return id; } @@ -97,7 +97,7 @@ public class Order { **/ @ApiModelProperty(value = "") - @Valid + public Long getPetId() { return petId; } @@ -117,7 +117,7 @@ public class Order { **/ @ApiModelProperty(value = "") - @Valid + public Integer getQuantity() { return quantity; } @@ -138,6 +138,7 @@ public class Order { @ApiModelProperty(value = "") @Valid + public OffsetDateTime getShipDate() { return shipDate; } @@ -157,7 +158,7 @@ public class Order { **/ @ApiModelProperty(value = "Order Status") - @Valid + public StatusEnum getStatus() { return status; } @@ -177,7 +178,7 @@ public class Order { **/ @ApiModelProperty(value = "") - @Valid + public Boolean getComplete() { return complete; } 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 c84687b699..38d92a5b91 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 @@ -80,7 +80,7 @@ public class Pet { **/ @ApiModelProperty(value = "") - @Valid + public Long getId() { return id; } @@ -101,6 +101,7 @@ public class Pet { @ApiModelProperty(value = "") @Valid + public Category getCategory() { return category; } @@ -121,7 +122,7 @@ public class Pet { @ApiModelProperty(example = "doggie", required = true, value = "") @NotNull - @Valid + public String getName() { return name; } @@ -147,7 +148,7 @@ public class Pet { @ApiModelProperty(required = true, value = "") @NotNull - @Valid + public List getPhotoUrls() { return photoUrls; } @@ -176,6 +177,7 @@ public class Pet { @ApiModelProperty(value = "") @Valid + public List getTags() { return tags; } @@ -195,7 +197,7 @@ public class Pet { **/ @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 8e79be0008..1ff292f185 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 @@ -30,7 +30,7 @@ public class ReadOnlyFirst { **/ @ApiModelProperty(readOnly = true, value = "") - @Valid + public String getBar() { return bar; } @@ -50,7 +50,7 @@ public class ReadOnlyFirst { **/ @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 3cb7b04353..9eabbe3eca 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 @@ -27,7 +27,7 @@ public class SpecialModelName { **/ @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 9f8f3a2523..b3d49a2dc6 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 @@ -30,7 +30,7 @@ public class Tag { **/ @ApiModelProperty(value = "") - @Valid + public Long getId() { return id; } @@ -50,7 +50,7 @@ public class Tag { **/ @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 501c556de2..ef3270b7af 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 @@ -48,7 +48,7 @@ public class User { **/ @ApiModelProperty(value = "") - @Valid + public Long getId() { return id; } @@ -68,7 +68,7 @@ public class User { **/ @ApiModelProperty(value = "") - @Valid + public String getUsername() { return username; } @@ -88,7 +88,7 @@ public class User { **/ @ApiModelProperty(value = "") - @Valid + public String getFirstName() { return firstName; } @@ -108,7 +108,7 @@ public class User { **/ @ApiModelProperty(value = "") - @Valid + public String getLastName() { return lastName; } @@ -128,7 +128,7 @@ public class User { **/ @ApiModelProperty(value = "") - @Valid + public String getEmail() { return email; } @@ -148,7 +148,7 @@ public class User { **/ @ApiModelProperty(value = "") - @Valid + public String getPassword() { return password; } @@ -168,7 +168,7 @@ public class User { **/ @ApiModelProperty(value = "") - @Valid + public String getPhone() { return phone; } @@ -188,7 +188,7 @@ public class User { **/ @ApiModelProperty(value = "User Status") - @Valid + public Integer getUserStatus() { return userStatus; } 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 8eefd6ed50..1e0e970766 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 @@ -15,7 +15,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.*; @@ -27,11 +26,12 @@ public interface FakeApi { @ApiOperation(value = "To test \"client\" model", notes = "To test \"client\" model", response = Client.class, tags={ "fake", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Client.class) }) + @RequestMapping(value = "/fake", produces = { "application/json" }, consumes = { "application/json" }, method = RequestMethod.PATCH) - ResponseEntity testClientModel(@ApiParam(value = "client model" ,required=true ) @Valid @RequestBody Client body, @RequestHeader("Accept") String accept) throws IOException; + ResponseEntity testClientModel(@ApiParam(value = "client model" ,required=true ) @Valid @RequestBody Client body); @ApiOperation(value = "Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 ", notes = "Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 ", response = Void.class, authorizations = { @@ -40,21 +40,23 @@ public interface FakeApi { @ApiResponses(value = { @ApiResponse(code = 400, message = "Invalid username supplied", response = Void.class), @ApiResponse(code = 404, message = "User not found", response = Void.class) }) + @RequestMapping(value = "/fake", produces = { "application/xml; charset=utf-8", "application/json; charset=utf-8" }, consumes = { "application/xml; charset=utf-8", "application/json; charset=utf-8" }, method = RequestMethod.POST) - ResponseEntity testEndpointParameters(@ApiParam(value = "None", required=true) @RequestPart(value="number", required=true) BigDecimal number,@ApiParam(value = "None", required=true) @RequestPart(value="double", required=true) Double _double,@ApiParam(value = "None", required=true) @RequestPart(value="pattern_without_delimiter", required=true) String patternWithoutDelimiter,@ApiParam(value = "None", required=true) @RequestPart(value="byte", required=true) byte[] _byte,@ApiParam(value = "None") @RequestPart(value="integer", required=false) Integer integer,@ApiParam(value = "None") @RequestPart(value="int32", required=false) Integer int32,@ApiParam(value = "None") @RequestPart(value="int64", required=false) Long int64,@ApiParam(value = "None") @RequestPart(value="float", required=false) Float _float,@ApiParam(value = "None") @RequestPart(value="string", required=false) String string,@ApiParam(value = "None") @RequestPart(value="binary", required=false) byte[] binary,@ApiParam(value = "None") @RequestPart(value="date", required=false) LocalDate date,@ApiParam(value = "None") @RequestPart(value="dateTime", required=false) DateTime dateTime,@ApiParam(value = "None") @RequestPart(value="password", required=false) String password,@ApiParam(value = "None") @RequestPart(value="callback", required=false) String paramCallback, @RequestHeader("Accept") String accept); + ResponseEntity testEndpointParameters(@ApiParam(value = "None", required=true) @RequestPart(value="number", required=true) BigDecimal number,@ApiParam(value = "None", required=true) @RequestPart(value="double", required=true) Double _double,@ApiParam(value = "None", required=true) @RequestPart(value="pattern_without_delimiter", required=true) String patternWithoutDelimiter,@ApiParam(value = "None", required=true) @RequestPart(value="byte", required=true) byte[] _byte,@ApiParam(value = "None") @RequestPart(value="integer", required=false) Integer integer,@ApiParam(value = "None") @RequestPart(value="int32", required=false) Integer int32,@ApiParam(value = "None") @RequestPart(value="int64", required=false) Long int64,@ApiParam(value = "None") @RequestPart(value="float", required=false) Float _float,@ApiParam(value = "None") @RequestPart(value="string", required=false) String string,@ApiParam(value = "None") @RequestPart(value="binary", required=false) byte[] binary,@ApiParam(value = "None") @RequestPart(value="date", required=false) LocalDate date,@ApiParam(value = "None") @RequestPart(value="dateTime", required=false) DateTime dateTime,@ApiParam(value = "None") @RequestPart(value="password", required=false) String password,@ApiParam(value = "None") @RequestPart(value="callback", required=false) String paramCallback); @ApiOperation(value = "To test enum parameters", notes = "To test enum parameters", response = Void.class, tags={ "fake", }) @ApiResponses(value = { @ApiResponse(code = 400, message = "Invalid request", response = Void.class), @ApiResponse(code = 404, message = "Not found", response = Void.class) }) + @RequestMapping(value = "/fake", produces = { "*/*" }, consumes = { "*/*" }, method = RequestMethod.GET) - ResponseEntity testEnumParameters(@ApiParam(value = "Form parameter enum test (string array)", allowableValues=">, $") @RequestPart(value="enum_form_string_array", required=false) List enumFormStringArray,@ApiParam(value = "Form parameter enum test (string)", allowableValues="_abc, -efg, (xyz)", defaultValue="-efg") @RequestPart(value="enum_form_string", required=false) String enumFormString,@ApiParam(value = "Header parameter enum test (string array)" , allowableValues=">, $") @RequestHeader(value="enum_header_string_array", required=false) List enumHeaderStringArray,@ApiParam(value = "Header parameter enum test (string)" , allowableValues="_abc, -efg, (xyz)", defaultValue="-efg") @RequestHeader(value="enum_header_string", required=false) String enumHeaderString,@ApiParam(value = "Query parameter enum test (string array)", allowableValues = ">, $") @RequestParam(value = "enum_query_string_array", required = false) List enumQueryStringArray,@ApiParam(value = "Query parameter enum test (string)", allowableValues = "_abc, -efg, (xyz)", defaultValue = "-efg") @RequestParam(value = "enum_query_string", required = false, defaultValue="-efg") String enumQueryString,@ApiParam(value = "Query parameter enum test (double)", allowableValues = "1, -2") @RequestParam(value = "enum_query_integer", required = false) Integer enumQueryInteger,@ApiParam(value = "Query parameter enum test (double)", allowableValues="1.1, -1.2") @RequestPart(value="enum_query_double", required=false) Double enumQueryDouble, @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); } 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 bc079bf629..9edc15a4fc 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 @@ -18,27 +18,17 @@ import org.springframework.web.bind.annotation.RequestPart; import org.springframework.web.multipart.MultipartFile; import java.util.List; -import com.fasterxml.jackson.databind.ObjectMapper; -import java.io.IOException; + import javax.validation.constraints.*; import javax.validation.Valid; @Controller public class FakeApiController implements FakeApi { - private final ObjectMapper objectMapper; - public FakeApiController(ObjectMapper objectMapper) { - this.objectMapper = objectMapper; - } - public ResponseEntity testClientModel(@ApiParam(value = "client model" ,required=true ) @Valid @RequestBody Client body, - @RequestHeader("Accept") String accept) throws IOException { + + public ResponseEntity testClientModel(@ApiParam(value = "client model" ,required=true ) @Valid @RequestBody Client body) { // do some magic! - - if (accept != null && accept.contains("application/json")) { - return new ResponseEntity(objectMapper.readValue("{ \"client\" : \"aeiou\"}", Client.class), HttpStatus.OK); - } - return new ResponseEntity(HttpStatus.OK); } @@ -55,8 +45,7 @@ public class FakeApiController implements FakeApi { @ApiParam(value = "None") @RequestPart(value="date", required=false) LocalDate date, @ApiParam(value = "None") @RequestPart(value="dateTime", required=false) DateTime dateTime, @ApiParam(value = "None") @RequestPart(value="password", required=false) String password, - @ApiParam(value = "None") @RequestPart(value="callback", required=false) String paramCallback, - @RequestHeader("Accept") String accept) { + @ApiParam(value = "None") @RequestPart(value="callback", required=false) String paramCallback) { // do some magic! return new ResponseEntity(HttpStatus.OK); } @@ -68,8 +57,7 @@ public class FakeApiController implements FakeApi { @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) { + @ApiParam(value = "Query parameter enum test (double)", allowableValues="1.1, -1.2") @RequestPart(value="enum_query_double", required=false) Double enumQueryDouble) { // do some magic! return new ResponseEntity(HttpStatus.OK); } 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 1227aedbbd..9e5bad2b5a 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 @@ -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.*; @@ -31,11 +30,12 @@ public interface PetApi { }, tags={ "pet", }) @ApiResponses(value = { @ApiResponse(code = 405, message = "Invalid input", response = Void.class) }) + @RequestMapping(value = "/pet", produces = { "application/xml", "application/json" }, consumes = { "application/json", "application/xml" }, method = RequestMethod.POST) - ResponseEntity addPet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody Pet body, @RequestHeader("Accept") String accept); + ResponseEntity addPet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody Pet body); @ApiOperation(value = "Deletes a pet", notes = "", response = Void.class, authorizations = { @@ -46,10 +46,11 @@ public interface PetApi { }, tags={ "pet", }) @ApiResponses(value = { @ApiResponse(code = 400, message = "Invalid pet value", response = Void.class) }) + @RequestMapping(value = "/pet/{petId}", produces = { "application/xml", "application/json" }, method = RequestMethod.DELETE) - ResponseEntity deletePet(@ApiParam(value = "Pet id to delete",required=true ) @PathVariable("petId") Long petId,@ApiParam(value = "" ) @RequestHeader(value="api_key", required=false) String apiKey, @RequestHeader("Accept") String accept); + ResponseEntity deletePet(@ApiParam(value = "Pet id to delete",required=true ) @PathVariable("petId") Long petId,@ApiParam(value = "" ) @RequestHeader(value="api_key", required=false) String apiKey); @ApiOperation(value = "Finds Pets by status", notes = "Multiple status values can be provided with comma separated strings", response = Pet.class, responseContainer = "List", authorizations = { @@ -61,10 +62,11 @@ public interface PetApi { @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Pet.class), @ApiResponse(code = 400, message = "Invalid status value", response = Pet.class) }) + @RequestMapping(value = "/pet/findByStatus", produces = { "application/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); @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 = { @@ -76,10 +78,11 @@ public interface PetApi { @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Pet.class), @ApiResponse(code = 400, message = "Invalid tag value", response = Pet.class) }) + @RequestMapping(value = "/pet/findByTags", produces = { "application/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); @ApiOperation(value = "Find pet by ID", notes = "Returns a single pet", response = Pet.class, authorizations = { @@ -89,10 +92,11 @@ public interface PetApi { @ApiResponse(code = 200, message = "successful operation", response = Pet.class), @ApiResponse(code = 400, message = "Invalid ID supplied", response = Pet.class), @ApiResponse(code = 404, message = "Pet not found", response = Pet.class) }) + @RequestMapping(value = "/pet/{petId}", produces = { "application/xml", "application/json" }, method = RequestMethod.GET) - ResponseEntity getPetById(@ApiParam(value = "ID of pet to return",required=true ) @PathVariable("petId") Long petId, @RequestHeader("Accept") String accept) throws IOException; + ResponseEntity getPetById(@ApiParam(value = "ID of pet to return",required=true ) @PathVariable("petId") Long petId); @ApiOperation(value = "Update an existing pet", notes = "", response = Void.class, authorizations = { @@ -105,11 +109,12 @@ public interface PetApi { @ApiResponse(code = 400, message = "Invalid ID supplied", response = Void.class), @ApiResponse(code = 404, message = "Pet not found", response = Void.class), @ApiResponse(code = 405, message = "Validation exception", response = Void.class) }) + @RequestMapping(value = "/pet", produces = { "application/xml", "application/json" }, consumes = { "application/json", "application/xml" }, method = RequestMethod.PUT) - ResponseEntity updatePet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody Pet body, @RequestHeader("Accept") String accept); + ResponseEntity updatePet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody Pet body); @ApiOperation(value = "Updates a pet in the store with form data", notes = "", response = Void.class, authorizations = { @@ -120,11 +125,12 @@ public interface PetApi { }, tags={ "pet", }) @ApiResponses(value = { @ApiResponse(code = 405, message = "Invalid input", response = Void.class) }) + @RequestMapping(value = "/pet/{petId}", produces = { "application/xml", "application/json" }, consumes = { "application/x-www-form-urlencoded" }, method = RequestMethod.POST) - ResponseEntity updatePetWithForm(@ApiParam(value = "ID of pet that needs to be updated",required=true ) @PathVariable("petId") Long petId,@ApiParam(value = "Updated name of the pet") @RequestPart(value="name", required=false) String name,@ApiParam(value = "Updated status of the pet") @RequestPart(value="status", required=false) String status, @RequestHeader("Accept") String accept); + ResponseEntity updatePetWithForm(@ApiParam(value = "ID of pet that needs to be updated",required=true ) @PathVariable("petId") Long petId,@ApiParam(value = "Updated name of the pet") @RequestPart(value="name", required=false) String name,@ApiParam(value = "Updated status of the pet") @RequestPart(value="status", required=false) String status); @ApiOperation(value = "uploads an image", notes = "", response = ModelApiResponse.class, authorizations = { @@ -135,10 +141,11 @@ public interface PetApi { }, tags={ "pet", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = ModelApiResponse.class) }) + @RequestMapping(value = "/pet/{petId}/uploadImage", produces = { "application/json" }, consumes = { "multipart/form-data" }, method = RequestMethod.POST) - ResponseEntity uploadFile(@ApiParam(value = "ID of pet to update",required=true ) @PathVariable("petId") Long petId,@ApiParam(value = "Additional data to pass to server") @RequestPart(value="additionalMetadata", required=false) String additionalMetadata,@ApiParam(value = "file detail") @RequestPart("file") MultipartFile file, @RequestHeader("Accept") String accept) throws IOException; + ResponseEntity uploadFile(@ApiParam(value = "ID of pet to update",required=true ) @PathVariable("petId") Long petId,@ApiParam(value = "Additional data to pass to server") @RequestPart(value="additionalMetadata", required=false) String additionalMetadata,@ApiParam(value = "file detail") @RequestPart("file") MultipartFile file); } 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 66e1dbda18..6ad4390e16 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 @@ -17,104 +17,57 @@ import org.springframework.web.bind.annotation.RequestPart; import org.springframework.web.multipart.MultipartFile; import java.util.List; -import com.fasterxml.jackson.databind.ObjectMapper; -import java.io.IOException; + import javax.validation.constraints.*; import javax.validation.Valid; @Controller public class PetApiController implements PetApi { - private final ObjectMapper objectMapper; - public PetApiController(ObjectMapper objectMapper) { - this.objectMapper = objectMapper; - } - public ResponseEntity addPet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody Pet body, - @RequestHeader("Accept") String accept) { + + public ResponseEntity addPet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody Pet body) { // do some magic! return new ResponseEntity(HttpStatus.OK); } public ResponseEntity deletePet(@ApiParam(value = "Pet id to delete",required=true ) @PathVariable("petId") Long petId, - @ApiParam(value = "" ) @RequestHeader(value="api_key", required=false) String apiKey, - @RequestHeader("Accept") String accept) { + @ApiParam(value = "" ) @RequestHeader(value="api_key", required=false) String apiKey) { // do some magic! 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, - @RequestHeader("Accept") String accept) throws IOException { + public ResponseEntity> findPetsByStatus( @NotNull@ApiParam(value = "Status values that need to be considered for filter", required = true, allowableValues = "available, pending, sold") @RequestParam(value = "status", required = true) List status) { // do some magic! - - if (accept != null && accept.contains("application/xml")) { - return new ResponseEntity>(objectMapper.readValue(" 123456789 doggie aeiou aeiou", List.class), HttpStatus.OK); - } - - - if (accept != null && accept.contains("application/json")) { - return new ResponseEntity>(objectMapper.readValue("[ { \"photoUrls\" : [ \"aeiou\" ], \"name\" : \"doggie\", \"id\" : 0, \"category\" : { \"name\" : \"aeiou\", \"id\" : 6 }, \"tags\" : [ { \"name\" : \"aeiou\", \"id\" : 1 } ], \"status\" : \"available\"} ]", List.class), HttpStatus.OK); - } - return new ResponseEntity>(HttpStatus.OK); } - 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 { + public ResponseEntity> findPetsByTags( @NotNull@ApiParam(value = "Tags to filter by", required = true) @RequestParam(value = "tags", required = true) List tags) { // do some magic! - - if (accept != null && accept.contains("application/xml")) { - return new ResponseEntity>(objectMapper.readValue(" 123456789 doggie aeiou aeiou", List.class), HttpStatus.OK); - } - - - if (accept != null && accept.contains("application/json")) { - return new ResponseEntity>(objectMapper.readValue("[ { \"photoUrls\" : [ \"aeiou\" ], \"name\" : \"doggie\", \"id\" : 0, \"category\" : { \"name\" : \"aeiou\", \"id\" : 6 }, \"tags\" : [ { \"name\" : \"aeiou\", \"id\" : 1 } ], \"status\" : \"available\"} ]", List.class), HttpStatus.OK); - } - return new ResponseEntity>(HttpStatus.OK); } - public ResponseEntity getPetById(@ApiParam(value = "ID of pet to return",required=true ) @PathVariable("petId") Long petId, - @RequestHeader("Accept") String accept) throws IOException { + public ResponseEntity getPetById(@ApiParam(value = "ID of pet to return",required=true ) @PathVariable("petId") Long petId) { // do some magic! - - if (accept != null && accept.contains("application/xml")) { - return new ResponseEntity(objectMapper.readValue(" 123456789 doggie aeiou aeiou", Pet.class), HttpStatus.OK); - } - - - if (accept != null && accept.contains("application/json")) { - return new ResponseEntity(objectMapper.readValue("{ \"photoUrls\" : [ \"aeiou\" ], \"name\" : \"doggie\", \"id\" : 0, \"category\" : { \"name\" : \"aeiou\", \"id\" : 6 }, \"tags\" : [ { \"name\" : \"aeiou\", \"id\" : 1 } ], \"status\" : \"available\"}", Pet.class), HttpStatus.OK); - } - return new ResponseEntity(HttpStatus.OK); } - public ResponseEntity updatePet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody Pet body, - @RequestHeader("Accept") String accept) { + public ResponseEntity updatePet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody Pet body) { // do some magic! return new ResponseEntity(HttpStatus.OK); } public ResponseEntity updatePetWithForm(@ApiParam(value = "ID of pet that needs to be updated",required=true ) @PathVariable("petId") Long petId, @ApiParam(value = "Updated name of the pet") @RequestPart(value="name", required=false) String name, - @ApiParam(value = "Updated status of the pet") @RequestPart(value="status", required=false) String status, - @RequestHeader("Accept") String accept) { + @ApiParam(value = "Updated status of the pet") @RequestPart(value="status", required=false) String status) { // do some magic! return new ResponseEntity(HttpStatus.OK); } public ResponseEntity uploadFile(@ApiParam(value = "ID of pet to update",required=true ) @PathVariable("petId") Long petId, @ApiParam(value = "Additional data to pass to server") @RequestPart(value="additionalMetadata", required=false) String additionalMetadata, - @ApiParam(value = "file detail") @RequestPart("file") MultipartFile file, - @RequestHeader("Accept") String accept) throws IOException { + @ApiParam(value = "file detail") @RequestPart("file") MultipartFile file) { // do some magic! - - if (accept != null && accept.contains("application/json")) { - return new ResponseEntity(objectMapper.readValue("{ \"code\" : 0, \"type\" : \"aeiou\", \"message\" : \"aeiou\"}", ModelApiResponse.class), HttpStatus.OK); - } - return new ResponseEntity(HttpStatus.OK); } diff --git a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/StoreApi.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/StoreApi.java index fb8f3d706f..8b080a440d 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/StoreApi.java +++ b/samples/server/petstore/spring-mvc/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.*; @@ -26,10 +25,11 @@ public interface StoreApi { @ApiResponses(value = { @ApiResponse(code = 400, message = "Invalid ID supplied", response = Void.class), @ApiResponse(code = 404, message = "Order not found", response = Void.class) }) + @RequestMapping(value = "/store/order/{order_id}", produces = { "application/xml", "application/json" }, method = RequestMethod.DELETE) - ResponseEntity deleteOrder(@ApiParam(value = "ID of the order that needs to be deleted",required=true ) @PathVariable("order_id") String orderId, @RequestHeader("Accept") String accept); + ResponseEntity deleteOrder(@ApiParam(value = "ID of the order that needs to be deleted",required=true ) @PathVariable("order_id") String orderId); @ApiOperation(value = "Returns pet inventories by status", notes = "Returns a map of status codes to quantities", response = Integer.class, responseContainer = "Map", authorizations = { @@ -37,10 +37,11 @@ public interface StoreApi { }, tags={ "store", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Integer.class) }) + @RequestMapping(value = "/store/inventory", produces = { "application/json" }, method = RequestMethod.GET) - ResponseEntity> getInventory( @RequestHeader("Accept") String accept) throws IOException; + ResponseEntity> getInventory(); @ApiOperation(value = "Find purchase order by ID", notes = "For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions", response = Order.class, tags={ "store", }) @@ -48,19 +49,21 @@ public interface StoreApi { @ApiResponse(code = 200, message = "successful operation", response = Order.class), @ApiResponse(code = 400, message = "Invalid ID supplied", response = Order.class), @ApiResponse(code = 404, message = "Order not found", response = Order.class) }) + @RequestMapping(value = "/store/order/{order_id}", produces = { "application/xml", "application/json" }, method = RequestMethod.GET) - ResponseEntity getOrderById( @Min(1) @Max(5)@ApiParam(value = "ID of pet that needs to be fetched",required=true ) @PathVariable("order_id") Long orderId, @RequestHeader("Accept") String accept) throws IOException; + ResponseEntity getOrderById( @Min(1) @Max(5)@ApiParam(value = "ID of pet that needs to be fetched",required=true ) @PathVariable("order_id") Long orderId); @ApiOperation(value = "Place an order for a pet", notes = "", response = Order.class, tags={ "store", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Order.class), @ApiResponse(code = 400, message = "Invalid Order", response = Order.class) }) + @RequestMapping(value = "/store/order", produces = { "application/xml", "application/json" }, method = RequestMethod.POST) - ResponseEntity placeOrder(@ApiParam(value = "order placed for purchasing the pet" ,required=true ) @Valid @RequestBody Order body, @RequestHeader("Accept") String accept) throws IOException; + ResponseEntity placeOrder(@ApiParam(value = "order placed for purchasing the pet" ,required=true ) @Valid @RequestBody Order body); } 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 6154d9c263..472bda2ada 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 @@ -16,64 +16,32 @@ import org.springframework.web.bind.annotation.RequestPart; import org.springframework.web.multipart.MultipartFile; import java.util.List; -import com.fasterxml.jackson.databind.ObjectMapper; -import java.io.IOException; + import javax.validation.constraints.*; import javax.validation.Valid; @Controller public class StoreApiController implements StoreApi { - private final ObjectMapper objectMapper; - public StoreApiController(ObjectMapper objectMapper) { - this.objectMapper = objectMapper; - } - public ResponseEntity deleteOrder(@ApiParam(value = "ID of the order that needs to be deleted",required=true ) @PathVariable("order_id") String orderId, - @RequestHeader("Accept") String accept) { + + public ResponseEntity deleteOrder(@ApiParam(value = "ID of the order that needs to be deleted",required=true ) @PathVariable("order_id") String orderId) { // do some magic! return new ResponseEntity(HttpStatus.OK); } - public ResponseEntity> getInventory(@RequestHeader("Accept") String accept) throws IOException { + public ResponseEntity> getInventory() { // do some magic! - - if (accept != null && accept.contains("application/json")) { - return new ResponseEntity>(objectMapper.readValue("{ \"key\" : 0}", Map.class), HttpStatus.OK); - } - return new ResponseEntity>(HttpStatus.OK); } - public ResponseEntity getOrderById( @Min(1) @Max(5)@ApiParam(value = "ID of pet that needs to be fetched",required=true ) @PathVariable("order_id") Long orderId, - @RequestHeader("Accept") String accept) throws IOException { + public ResponseEntity getOrderById( @Min(1) @Max(5)@ApiParam(value = "ID of pet that needs to be fetched",required=true ) @PathVariable("order_id") Long orderId) { // do some magic! - - if (accept != null && accept.contains("application/xml")) { - return new ResponseEntity(objectMapper.readValue(" 123456789 123456789 123 2000-01-23T04:56:07.000Z aeiou true", Order.class), HttpStatus.OK); - } - - - if (accept != null && accept.contains("application/json")) { - return new ResponseEntity(objectMapper.readValue("{ \"petId\" : 6, \"quantity\" : 1, \"id\" : 0, \"shipDate\" : \"2000-01-23T04:56:07.000+00:00\", \"complete\" : false, \"status\" : \"placed\"}", Order.class), HttpStatus.OK); - } - return new ResponseEntity(HttpStatus.OK); } - public ResponseEntity placeOrder(@ApiParam(value = "order placed for purchasing the pet" ,required=true ) @Valid @RequestBody Order body, - @RequestHeader("Accept") String accept) throws IOException { + public ResponseEntity placeOrder(@ApiParam(value = "order placed for purchasing the pet" ,required=true ) @Valid @RequestBody Order body) { // do some magic! - - if (accept != null && accept.contains("application/xml")) { - return new ResponseEntity(objectMapper.readValue(" 123456789 123456789 123 2000-01-23T04:56:07.000Z aeiou true", Order.class), HttpStatus.OK); - } - - - if (accept != null && accept.contains("application/json")) { - return new ResponseEntity(objectMapper.readValue("{ \"petId\" : 6, \"quantity\" : 1, \"id\" : 0, \"shipDate\" : \"2000-01-23T04:56:07.000+00:00\", \"complete\" : false, \"status\" : \"placed\"}", Order.class), HttpStatus.OK); - } - return new ResponseEntity(HttpStatus.OK); } 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 adc0d21d30..55fe9faf68 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 @@ -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.*; @@ -25,38 +24,42 @@ public interface UserApi { @ApiOperation(value = "Create user", notes = "This can only be done by the logged in user.", response = Void.class, tags={ "user", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Void.class) }) + @RequestMapping(value = "/user", produces = { "application/xml", "application/json" }, method = RequestMethod.POST) - ResponseEntity createUser(@ApiParam(value = "Created user object" ,required=true ) @Valid @RequestBody User body, @RequestHeader("Accept") String accept); + ResponseEntity createUser(@ApiParam(value = "Created user object" ,required=true ) @Valid @RequestBody User body); @ApiOperation(value = "Creates list of users with given input array", notes = "", response = Void.class, tags={ "user", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Void.class) }) + @RequestMapping(value = "/user/createWithArray", produces = { "application/xml", "application/json" }, method = RequestMethod.POST) - ResponseEntity createUsersWithArrayInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody List body, @RequestHeader("Accept") String accept); + ResponseEntity createUsersWithArrayInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody List body); @ApiOperation(value = "Creates list of users with given input array", notes = "", response = Void.class, tags={ "user", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Void.class) }) + @RequestMapping(value = "/user/createWithList", produces = { "application/xml", "application/json" }, method = RequestMethod.POST) - ResponseEntity createUsersWithListInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody List body, @RequestHeader("Accept") String accept); + ResponseEntity createUsersWithListInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody List body); @ApiOperation(value = "Delete user", notes = "This can only be done by the logged in user.", response = Void.class, tags={ "user", }) @ApiResponses(value = { @ApiResponse(code = 400, message = "Invalid username supplied", response = Void.class), @ApiResponse(code = 404, message = "User not found", response = Void.class) }) + @RequestMapping(value = "/user/{username}", produces = { "application/xml", "application/json" }, method = RequestMethod.DELETE) - ResponseEntity deleteUser(@ApiParam(value = "The name that needs to be deleted",required=true ) @PathVariable("username") String username, @RequestHeader("Accept") String accept); + ResponseEntity deleteUser(@ApiParam(value = "The name that needs to be deleted",required=true ) @PathVariable("username") String username); @ApiOperation(value = "Get user by user name", notes = "", response = User.class, tags={ "user", }) @@ -64,38 +67,42 @@ public interface UserApi { @ApiResponse(code = 200, message = "successful operation", response = User.class), @ApiResponse(code = 400, message = "Invalid username supplied", response = User.class), @ApiResponse(code = 404, message = "User not found", response = User.class) }) + @RequestMapping(value = "/user/{username}", produces = { "application/xml", "application/json" }, method = RequestMethod.GET) - ResponseEntity getUserByName(@ApiParam(value = "The name that needs to be fetched. Use user1 for testing. ",required=true ) @PathVariable("username") String username, @RequestHeader("Accept") String accept) throws IOException; + ResponseEntity getUserByName(@ApiParam(value = "The name that needs to be fetched. Use user1 for testing. ",required=true ) @PathVariable("username") String username); @ApiOperation(value = "Logs user into the system", notes = "", response = String.class, tags={ "user", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = String.class), @ApiResponse(code = 400, message = "Invalid username/password supplied", response = String.class) }) + @RequestMapping(value = "/user/login", produces = { "application/xml", "application/json" }, method = RequestMethod.GET) - ResponseEntity loginUser( @NotNull@ApiParam(value = "The user name for login", required = true) @RequestParam(value = "username", required = true) String username, @NotNull@ApiParam(value = "The password for login in clear text", required = true) @RequestParam(value = "password", required = true) String password, @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); @ApiOperation(value = "Logs out current logged in user session", notes = "", response = Void.class, tags={ "user", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Void.class) }) + @RequestMapping(value = "/user/logout", produces = { "application/xml", "application/json" }, method = RequestMethod.GET) - ResponseEntity logoutUser( @RequestHeader("Accept") String accept); + ResponseEntity logoutUser(); @ApiOperation(value = "Updated user", notes = "This can only be done by the logged in user.", response = Void.class, tags={ "user", }) @ApiResponses(value = { @ApiResponse(code = 400, message = "Invalid user supplied", response = Void.class), @ApiResponse(code = 404, message = "User not found", response = Void.class) }) + @RequestMapping(value = "/user/{username}", produces = { "application/xml", "application/json" }, method = RequestMethod.PUT) - ResponseEntity updateUser(@ApiParam(value = "name that need to be deleted",required=true ) @PathVariable("username") String username,@ApiParam(value = "Updated user object" ,required=true ) @Valid @RequestBody User body, @RequestHeader("Accept") String accept); + ResponseEntity updateUser(@ApiParam(value = "name that need to be deleted",required=true ) @PathVariable("username") String username,@ApiParam(value = "Updated user object" ,required=true ) @Valid @RequestBody User body); } 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 24b7e18b99..e751209da2 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 @@ -16,84 +16,53 @@ import org.springframework.web.bind.annotation.RequestPart; import org.springframework.web.multipart.MultipartFile; import java.util.List; -import com.fasterxml.jackson.databind.ObjectMapper; -import java.io.IOException; + import javax.validation.constraints.*; import javax.validation.Valid; @Controller public class UserApiController implements UserApi { - private final ObjectMapper objectMapper; - public UserApiController(ObjectMapper objectMapper) { - this.objectMapper = objectMapper; - } - public ResponseEntity createUser(@ApiParam(value = "Created user object" ,required=true ) @Valid @RequestBody User body, - @RequestHeader("Accept") String accept) { + + public ResponseEntity createUser(@ApiParam(value = "Created user object" ,required=true ) @Valid @RequestBody User body) { // do some magic! return new ResponseEntity(HttpStatus.OK); } - public ResponseEntity createUsersWithArrayInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody List body, - @RequestHeader("Accept") String accept) { + public ResponseEntity createUsersWithArrayInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody List body) { // do some magic! return new ResponseEntity(HttpStatus.OK); } - public ResponseEntity createUsersWithListInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody List body, - @RequestHeader("Accept") String accept) { + public ResponseEntity createUsersWithListInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody List body) { // do some magic! return new ResponseEntity(HttpStatus.OK); } - public ResponseEntity deleteUser(@ApiParam(value = "The name that needs to be deleted",required=true ) @PathVariable("username") String username, - @RequestHeader("Accept") String accept) { + public ResponseEntity deleteUser(@ApiParam(value = "The name that needs to be deleted",required=true ) @PathVariable("username") String username) { // do some magic! return new ResponseEntity(HttpStatus.OK); } - public ResponseEntity getUserByName(@ApiParam(value = "The name that needs to be fetched. Use user1 for testing. ",required=true ) @PathVariable("username") String username, - @RequestHeader("Accept") String accept) throws IOException { + public ResponseEntity getUserByName(@ApiParam(value = "The name that needs to be fetched. Use user1 for testing. ",required=true ) @PathVariable("username") String username) { // do some magic! - - if (accept != null && accept.contains("application/xml")) { - return new ResponseEntity(objectMapper.readValue(" 123456789 aeiou aeiou aeiou aeiou aeiou aeiou 123", User.class), HttpStatus.OK); - } - - - if (accept != null && accept.contains("application/json")) { - return new ResponseEntity(objectMapper.readValue("{ \"firstName\" : \"aeiou\", \"lastName\" : \"aeiou\", \"password\" : \"aeiou\", \"userStatus\" : 6, \"phone\" : \"aeiou\", \"id\" : 0, \"email\" : \"aeiou\", \"username\" : \"aeiou\"}", User.class), HttpStatus.OK); - } - 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, - @RequestHeader("Accept") String accept) throws IOException { + @NotNull@ApiParam(value = "The password for login in clear text", required = true) @RequestParam(value = "password", required = true) String password) { // do some magic! - - if (accept != null && accept.contains("application/xml")) { - return new ResponseEntity(objectMapper.readValue("aeiou", String.class), HttpStatus.OK); - } - - - if (accept != null && accept.contains("application/json")) { - return new ResponseEntity(objectMapper.readValue("\"aeiou\"", String.class), HttpStatus.OK); - } - return new ResponseEntity(HttpStatus.OK); } - public ResponseEntity logoutUser(@RequestHeader("Accept") String accept) { + public ResponseEntity logoutUser() { // do some magic! return new ResponseEntity(HttpStatus.OK); } public ResponseEntity updateUser(@ApiParam(value = "name that need to be deleted",required=true ) @PathVariable("username") String username, - @ApiParam(value = "Updated user object" ,required=true ) @Valid @RequestBody User body, - @RequestHeader("Accept") String accept) { + @ApiParam(value = "Updated user object" ,required=true ) @Valid @RequestBody User body) { // do some magic! return new ResponseEntity(HttpStatus.OK); } 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 80be4236b0..532576aad8 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 @@ -41,7 +41,7 @@ public class AdditionalPropertiesClass { **/ @ApiModelProperty(value = "") - @Valid + public Map getMapProperty() { return mapProperty; } @@ -70,6 +70,7 @@ public class AdditionalPropertiesClass { @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 bc957d1c80..a59dc766c5 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 @@ -38,7 +38,7 @@ public class Animal { @ApiModelProperty(required = true, value = "") @NotNull - @Valid + public String getClassName() { return className; } @@ -58,7 +58,7 @@ public class Animal { **/ @ApiModelProperty(value = "") - @Valid + public String getColor() { return color; } 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 f9dca7d60b..ecff36e416 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 @@ -39,6 +39,7 @@ public class ArrayOfArrayOfNumberOnly { @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 e9c8a313be..a08ff749ee 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 @@ -39,6 +39,7 @@ public class ArrayOfNumberOnly { @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 78c35d3c63..e9022fd028 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 @@ -44,7 +44,7 @@ public class ArrayTest { **/ @ApiModelProperty(value = "") - @Valid + public List getArrayOfString() { return arrayOfString; } @@ -73,6 +73,7 @@ public class ArrayTest { @ApiModelProperty(value = "") @Valid + public List> getArrayArrayOfInteger() { return arrayArrayOfInteger; } @@ -101,6 +102,7 @@ public class ArrayTest { @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 93533c2882..d59005adf1 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 @@ -42,7 +42,7 @@ public class Capitalization { **/ @ApiModelProperty(value = "") - @Valid + public String getSmallCamel() { return smallCamel; } @@ -62,7 +62,7 @@ public class Capitalization { **/ @ApiModelProperty(value = "") - @Valid + public String getCapitalCamel() { return capitalCamel; } @@ -82,7 +82,7 @@ public class Capitalization { **/ @ApiModelProperty(value = "") - @Valid + public String getSmallSnake() { return smallSnake; } @@ -102,7 +102,7 @@ public class Capitalization { **/ @ApiModelProperty(value = "") - @Valid + public String getCapitalSnake() { return capitalSnake; } @@ -122,7 +122,7 @@ public class Capitalization { **/ @ApiModelProperty(value = "") - @Valid + public String getScAETHFlowPoints() { return scAETHFlowPoints; } @@ -142,7 +142,7 @@ public class Capitalization { **/ @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 edcbc354be..28016fa5ad 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 @@ -28,7 +28,7 @@ public class Cat extends Animal { **/ @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 6dd9cb7a2a..e2a67cf25d 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 @@ -30,7 +30,7 @@ public class Category { **/ @ApiModelProperty(value = "") - @Valid + public Long getId() { return id; } @@ -50,7 +50,7 @@ public class Category { **/ @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 6a6379f5b6..a5ef34a233 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 @@ -28,7 +28,7 @@ public class ClassModel { **/ @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 3b8d16cabf..aaa03c570f 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 @@ -27,7 +27,7 @@ public class 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 513131a9fa..8ebd0f46a6 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 @@ -28,7 +28,7 @@ public class Dog extends Animal { **/ @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 bbf4a3036e..4d79aa66c5 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 @@ -95,7 +95,7 @@ public class EnumArrays { **/ @ApiModelProperty(value = "") - @Valid + public JustSymbolEnum getJustSymbol() { return justSymbol; } @@ -123,7 +123,7 @@ public class EnumArrays { **/ @ApiModelProperty(value = "") - @Valid + public List getArrayEnum() { return arrayEnum; } 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 c7e4793cdf..a072f99267 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 @@ -133,7 +133,7 @@ public class EnumTest { **/ @ApiModelProperty(value = "") - @Valid + public EnumStringEnum getEnumString() { return enumString; } @@ -153,7 +153,7 @@ public class EnumTest { **/ @ApiModelProperty(value = "") - @Valid + public EnumIntegerEnum getEnumInteger() { return enumInteger; } @@ -173,7 +173,7 @@ public class EnumTest { **/ @ApiModelProperty(value = "") - @Valid + public EnumNumberEnum getEnumNumber() { return enumNumber; } @@ -194,6 +194,7 @@ public class EnumTest { @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 9d6cf5cd4b..5ef3ec9215 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 @@ -68,8 +68,8 @@ public class FormatTest { * @return integer **/ @ApiModelProperty(value = "") + @Min(10) @Max(100) - @Valid public Integer getInteger() { return integer; } @@ -90,8 +90,8 @@ public class FormatTest { * @return int32 **/ @ApiModelProperty(value = "") + @Min(20) @Max(200) - @Valid public Integer getInt32() { return int32; } @@ -111,7 +111,7 @@ public class FormatTest { **/ @ApiModelProperty(value = "") - @Valid + public Long getInt64() { return int64; } @@ -133,8 +133,9 @@ public class FormatTest { **/ @ApiModelProperty(required = true, value = "") @NotNull - @DecimalMin("32.1") @DecimalMax("543.2") + @Valid + @DecimalMin("32.1") @DecimalMax("543.2") public BigDecimal getNumber() { return number; } @@ -155,8 +156,8 @@ public class FormatTest { * @return _float **/ @ApiModelProperty(value = "") + @DecimalMin("54.3") @DecimalMax("987.6") - @Valid public Float getFloat() { return _float; } @@ -177,8 +178,8 @@ public class FormatTest { * @return _double **/ @ApiModelProperty(value = "") + @DecimalMin("67.8") @DecimalMax("123.4") - @Valid public Double getDouble() { return _double; } @@ -197,8 +198,8 @@ public class FormatTest { * @return string **/ @ApiModelProperty(value = "") + @Pattern(regexp="/[a-z]/i") - @Valid public String getString() { return string; } @@ -219,7 +220,7 @@ public class FormatTest { @ApiModelProperty(required = true, value = "") @NotNull - @Valid + public byte[] getByte() { return _byte; } @@ -239,7 +240,7 @@ public class FormatTest { **/ @ApiModelProperty(value = "") - @Valid + public byte[] getBinary() { return binary; } @@ -261,6 +262,7 @@ public class FormatTest { @NotNull @Valid + public LocalDate getDate() { return date; } @@ -281,6 +283,7 @@ public class FormatTest { @ApiModelProperty(value = "") @Valid + public DateTime getDateTime() { return dateTime; } @@ -301,6 +304,7 @@ public class FormatTest { @ApiModelProperty(value = "") @Valid + public UUID getUuid() { return uuid; } @@ -320,8 +324,8 @@ public class FormatTest { **/ @ApiModelProperty(required = true, value = "") @NotNull + @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 0f8b608e26..dc59cf9c78 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 @@ -30,7 +30,7 @@ public class HasOnlyReadOnly { **/ @ApiModelProperty(readOnly = true, value = "") - @Valid + public String getBar() { return bar; } @@ -50,7 +50,7 @@ public class HasOnlyReadOnly { **/ @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 1530a53f53..f179e8e423 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 @@ -74,6 +74,7 @@ public class MapTest { @ApiModelProperty(value = "") @Valid + public Map> getMapMapOfString() { return mapMapOfString; } @@ -101,7 +102,7 @@ public class MapTest { **/ @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 d4cd89cef3..d25bba89a9 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 @@ -40,6 +40,7 @@ public class MixedPropertiesAndAdditionalPropertiesClass { @ApiModelProperty(value = "") @Valid + public UUID getUuid() { return uuid; } @@ -60,6 +61,7 @@ public class MixedPropertiesAndAdditionalPropertiesClass { @ApiModelProperty(value = "") @Valid + public DateTime getDateTime() { return dateTime; } @@ -88,6 +90,7 @@ public class MixedPropertiesAndAdditionalPropertiesClass { @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 97349fef05..c00e48ea6c 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 @@ -31,7 +31,7 @@ public class Model200Response { **/ @ApiModelProperty(value = "") - @Valid + public Integer getName() { return name; } @@ -51,7 +51,7 @@ public class Model200Response { **/ @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 c8882b3b1e..1df487b353 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 @@ -33,7 +33,7 @@ public class ModelApiResponse { **/ @ApiModelProperty(value = "") - @Valid + public Integer getCode() { return code; } @@ -53,7 +53,7 @@ public class ModelApiResponse { **/ @ApiModelProperty(value = "") - @Valid + public String getType() { return type; } @@ -73,7 +73,7 @@ public class ModelApiResponse { **/ @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 7018d7de09..3b05293b83 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 @@ -28,7 +28,7 @@ public class ModelReturn { **/ @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 46069fdd14..a9835f910a 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 @@ -38,7 +38,7 @@ public class Name { @ApiModelProperty(required = true, value = "") @NotNull - @Valid + public Integer getName() { return name; } @@ -58,7 +58,7 @@ public class Name { **/ @ApiModelProperty(readOnly = true, value = "") - @Valid + public Integer getSnakeCase() { return snakeCase; } @@ -78,7 +78,7 @@ public class Name { **/ @ApiModelProperty(value = "") - @Valid + public String getProperty() { return property; } @@ -98,7 +98,7 @@ public class Name { **/ @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 e243ecb429..a990653f20 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 @@ -29,6 +29,7 @@ public class NumberOnly { @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 4106ac3619..5bfcf28b3e 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 @@ -77,7 +77,7 @@ public class Order { **/ @ApiModelProperty(value = "") - @Valid + public Long getId() { return id; } @@ -97,7 +97,7 @@ public class Order { **/ @ApiModelProperty(value = "") - @Valid + public Long getPetId() { return petId; } @@ -117,7 +117,7 @@ public class Order { **/ @ApiModelProperty(value = "") - @Valid + public Integer getQuantity() { return quantity; } @@ -138,6 +138,7 @@ public class Order { @ApiModelProperty(value = "") @Valid + public DateTime getShipDate() { return shipDate; } @@ -157,7 +158,7 @@ public class Order { **/ @ApiModelProperty(value = "Order Status") - @Valid + public StatusEnum getStatus() { return status; } @@ -177,7 +178,7 @@ public class Order { **/ @ApiModelProperty(value = "") - @Valid + public Boolean getComplete() { return complete; } 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 c84687b699..38d92a5b91 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 @@ -80,7 +80,7 @@ public class Pet { **/ @ApiModelProperty(value = "") - @Valid + public Long getId() { return id; } @@ -101,6 +101,7 @@ public class Pet { @ApiModelProperty(value = "") @Valid + public Category getCategory() { return category; } @@ -121,7 +122,7 @@ public class Pet { @ApiModelProperty(example = "doggie", required = true, value = "") @NotNull - @Valid + public String getName() { return name; } @@ -147,7 +148,7 @@ public class Pet { @ApiModelProperty(required = true, value = "") @NotNull - @Valid + public List getPhotoUrls() { return photoUrls; } @@ -176,6 +177,7 @@ public class Pet { @ApiModelProperty(value = "") @Valid + public List getTags() { return tags; } @@ -195,7 +197,7 @@ public class Pet { **/ @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 8e79be0008..1ff292f185 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 @@ -30,7 +30,7 @@ public class ReadOnlyFirst { **/ @ApiModelProperty(readOnly = true, value = "") - @Valid + public String getBar() { return bar; } @@ -50,7 +50,7 @@ public class ReadOnlyFirst { **/ @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 3cb7b04353..9eabbe3eca 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 @@ -27,7 +27,7 @@ public class SpecialModelName { **/ @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 9f8f3a2523..b3d49a2dc6 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 @@ -30,7 +30,7 @@ public class Tag { **/ @ApiModelProperty(value = "") - @Valid + public Long getId() { return id; } @@ -50,7 +50,7 @@ public class Tag { **/ @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 501c556de2..ef3270b7af 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 @@ -48,7 +48,7 @@ public class User { **/ @ApiModelProperty(value = "") - @Valid + public Long getId() { return id; } @@ -68,7 +68,7 @@ public class User { **/ @ApiModelProperty(value = "") - @Valid + public String getUsername() { return username; } @@ -88,7 +88,7 @@ public class User { **/ @ApiModelProperty(value = "") - @Valid + public String getFirstName() { return firstName; } @@ -108,7 +108,7 @@ public class User { **/ @ApiModelProperty(value = "") - @Valid + public String getLastName() { return lastName; } @@ -128,7 +128,7 @@ public class User { **/ @ApiModelProperty(value = "") - @Valid + public String getEmail() { return email; } @@ -148,7 +148,7 @@ public class User { **/ @ApiModelProperty(value = "") - @Valid + public String getPassword() { return password; } @@ -168,7 +168,7 @@ public class User { **/ @ApiModelProperty(value = "") - @Valid + public String getPhone() { return phone; } @@ -188,7 +188,7 @@ public class User { **/ @ApiModelProperty(value = "User Status") - @Valid + public Integer getUserStatus() { return userStatus; } diff --git a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/api/FakeApi.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/api/FakeApi.java index 8eefd6ed50..1e0e970766 100644 --- a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/api/FakeApi.java +++ b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/api/FakeApi.java @@ -15,7 +15,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.*; @@ -27,11 +26,12 @@ public interface FakeApi { @ApiOperation(value = "To test \"client\" model", notes = "To test \"client\" model", response = Client.class, tags={ "fake", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Client.class) }) + @RequestMapping(value = "/fake", produces = { "application/json" }, consumes = { "application/json" }, method = RequestMethod.PATCH) - ResponseEntity testClientModel(@ApiParam(value = "client model" ,required=true ) @Valid @RequestBody Client body, @RequestHeader("Accept") String accept) throws IOException; + ResponseEntity testClientModel(@ApiParam(value = "client model" ,required=true ) @Valid @RequestBody Client body); @ApiOperation(value = "Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 ", notes = "Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 ", response = Void.class, authorizations = { @@ -40,21 +40,23 @@ public interface FakeApi { @ApiResponses(value = { @ApiResponse(code = 400, message = "Invalid username supplied", response = Void.class), @ApiResponse(code = 404, message = "User not found", response = Void.class) }) + @RequestMapping(value = "/fake", produces = { "application/xml; charset=utf-8", "application/json; charset=utf-8" }, consumes = { "application/xml; charset=utf-8", "application/json; charset=utf-8" }, method = RequestMethod.POST) - ResponseEntity testEndpointParameters(@ApiParam(value = "None", required=true) @RequestPart(value="number", required=true) BigDecimal number,@ApiParam(value = "None", required=true) @RequestPart(value="double", required=true) Double _double,@ApiParam(value = "None", required=true) @RequestPart(value="pattern_without_delimiter", required=true) String patternWithoutDelimiter,@ApiParam(value = "None", required=true) @RequestPart(value="byte", required=true) byte[] _byte,@ApiParam(value = "None") @RequestPart(value="integer", required=false) Integer integer,@ApiParam(value = "None") @RequestPart(value="int32", required=false) Integer int32,@ApiParam(value = "None") @RequestPart(value="int64", required=false) Long int64,@ApiParam(value = "None") @RequestPart(value="float", required=false) Float _float,@ApiParam(value = "None") @RequestPart(value="string", required=false) String string,@ApiParam(value = "None") @RequestPart(value="binary", required=false) byte[] binary,@ApiParam(value = "None") @RequestPart(value="date", required=false) LocalDate date,@ApiParam(value = "None") @RequestPart(value="dateTime", required=false) DateTime dateTime,@ApiParam(value = "None") @RequestPart(value="password", required=false) String password,@ApiParam(value = "None") @RequestPart(value="callback", required=false) String paramCallback, @RequestHeader("Accept") String accept); + ResponseEntity testEndpointParameters(@ApiParam(value = "None", required=true) @RequestPart(value="number", required=true) BigDecimal number,@ApiParam(value = "None", required=true) @RequestPart(value="double", required=true) Double _double,@ApiParam(value = "None", required=true) @RequestPart(value="pattern_without_delimiter", required=true) String patternWithoutDelimiter,@ApiParam(value = "None", required=true) @RequestPart(value="byte", required=true) byte[] _byte,@ApiParam(value = "None") @RequestPart(value="integer", required=false) Integer integer,@ApiParam(value = "None") @RequestPart(value="int32", required=false) Integer int32,@ApiParam(value = "None") @RequestPart(value="int64", required=false) Long int64,@ApiParam(value = "None") @RequestPart(value="float", required=false) Float _float,@ApiParam(value = "None") @RequestPart(value="string", required=false) String string,@ApiParam(value = "None") @RequestPart(value="binary", required=false) byte[] binary,@ApiParam(value = "None") @RequestPart(value="date", required=false) LocalDate date,@ApiParam(value = "None") @RequestPart(value="dateTime", required=false) DateTime dateTime,@ApiParam(value = "None") @RequestPart(value="password", required=false) String password,@ApiParam(value = "None") @RequestPart(value="callback", required=false) String paramCallback); @ApiOperation(value = "To test enum parameters", notes = "To test enum parameters", response = Void.class, tags={ "fake", }) @ApiResponses(value = { @ApiResponse(code = 400, message = "Invalid request", response = Void.class), @ApiResponse(code = 404, message = "Not found", response = Void.class) }) + @RequestMapping(value = "/fake", produces = { "*/*" }, consumes = { "*/*" }, method = RequestMethod.GET) - ResponseEntity testEnumParameters(@ApiParam(value = "Form parameter enum test (string array)", allowableValues=">, $") @RequestPart(value="enum_form_string_array", required=false) List enumFormStringArray,@ApiParam(value = "Form parameter enum test (string)", allowableValues="_abc, -efg, (xyz)", defaultValue="-efg") @RequestPart(value="enum_form_string", required=false) String enumFormString,@ApiParam(value = "Header parameter enum test (string array)" , allowableValues=">, $") @RequestHeader(value="enum_header_string_array", required=false) List enumHeaderStringArray,@ApiParam(value = "Header parameter enum test (string)" , allowableValues="_abc, -efg, (xyz)", defaultValue="-efg") @RequestHeader(value="enum_header_string", required=false) String enumHeaderString,@ApiParam(value = "Query parameter enum test (string array)", allowableValues = ">, $") @RequestParam(value = "enum_query_string_array", required = false) List enumQueryStringArray,@ApiParam(value = "Query parameter enum test (string)", allowableValues = "_abc, -efg, (xyz)", defaultValue = "-efg") @RequestParam(value = "enum_query_string", required = false, defaultValue="-efg") String enumQueryString,@ApiParam(value = "Query parameter enum test (double)", allowableValues = "1, -2") @RequestParam(value = "enum_query_integer", required = false) Integer enumQueryInteger,@ApiParam(value = "Query parameter enum test (double)", allowableValues="1.1, -1.2") @RequestPart(value="enum_query_double", required=false) Double enumQueryDouble, @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); } diff --git a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/api/FakeApiController.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/api/FakeApiController.java index bc079bf629..9edc15a4fc 100644 --- a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/api/FakeApiController.java +++ b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/api/FakeApiController.java @@ -18,27 +18,17 @@ import org.springframework.web.bind.annotation.RequestPart; import org.springframework.web.multipart.MultipartFile; import java.util.List; -import com.fasterxml.jackson.databind.ObjectMapper; -import java.io.IOException; + import javax.validation.constraints.*; import javax.validation.Valid; @Controller public class FakeApiController implements FakeApi { - private final ObjectMapper objectMapper; - public FakeApiController(ObjectMapper objectMapper) { - this.objectMapper = objectMapper; - } - public ResponseEntity testClientModel(@ApiParam(value = "client model" ,required=true ) @Valid @RequestBody Client body, - @RequestHeader("Accept") String accept) throws IOException { + + public ResponseEntity testClientModel(@ApiParam(value = "client model" ,required=true ) @Valid @RequestBody Client body) { // do some magic! - - if (accept != null && accept.contains("application/json")) { - return new ResponseEntity(objectMapper.readValue("{ \"client\" : \"aeiou\"}", Client.class), HttpStatus.OK); - } - return new ResponseEntity(HttpStatus.OK); } @@ -55,8 +45,7 @@ public class FakeApiController implements FakeApi { @ApiParam(value = "None") @RequestPart(value="date", required=false) LocalDate date, @ApiParam(value = "None") @RequestPart(value="dateTime", required=false) DateTime dateTime, @ApiParam(value = "None") @RequestPart(value="password", required=false) String password, - @ApiParam(value = "None") @RequestPart(value="callback", required=false) String paramCallback, - @RequestHeader("Accept") String accept) { + @ApiParam(value = "None") @RequestPart(value="callback", required=false) String paramCallback) { // do some magic! return new ResponseEntity(HttpStatus.OK); } @@ -68,8 +57,7 @@ public class FakeApiController implements FakeApi { @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) { + @ApiParam(value = "Query parameter enum test (double)", allowableValues="1.1, -1.2") @RequestPart(value="enum_query_double", required=false) Double enumQueryDouble) { // do some magic! return new ResponseEntity(HttpStatus.OK); } diff --git a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/api/PetApi.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/api/PetApi.java index 1227aedbbd..9e5bad2b5a 100644 --- a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/api/PetApi.java +++ b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/api/PetApi.java @@ -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.*; @@ -31,11 +30,12 @@ public interface PetApi { }, tags={ "pet", }) @ApiResponses(value = { @ApiResponse(code = 405, message = "Invalid input", response = Void.class) }) + @RequestMapping(value = "/pet", produces = { "application/xml", "application/json" }, consumes = { "application/json", "application/xml" }, method = RequestMethod.POST) - ResponseEntity addPet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody Pet body, @RequestHeader("Accept") String accept); + ResponseEntity addPet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody Pet body); @ApiOperation(value = "Deletes a pet", notes = "", response = Void.class, authorizations = { @@ -46,10 +46,11 @@ public interface PetApi { }, tags={ "pet", }) @ApiResponses(value = { @ApiResponse(code = 400, message = "Invalid pet value", response = Void.class) }) + @RequestMapping(value = "/pet/{petId}", produces = { "application/xml", "application/json" }, method = RequestMethod.DELETE) - ResponseEntity deletePet(@ApiParam(value = "Pet id to delete",required=true ) @PathVariable("petId") Long petId,@ApiParam(value = "" ) @RequestHeader(value="api_key", required=false) String apiKey, @RequestHeader("Accept") String accept); + ResponseEntity deletePet(@ApiParam(value = "Pet id to delete",required=true ) @PathVariable("petId") Long petId,@ApiParam(value = "" ) @RequestHeader(value="api_key", required=false) String apiKey); @ApiOperation(value = "Finds Pets by status", notes = "Multiple status values can be provided with comma separated strings", response = Pet.class, responseContainer = "List", authorizations = { @@ -61,10 +62,11 @@ public interface PetApi { @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Pet.class), @ApiResponse(code = 400, message = "Invalid status value", response = Pet.class) }) + @RequestMapping(value = "/pet/findByStatus", produces = { "application/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); @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 = { @@ -76,10 +78,11 @@ public interface PetApi { @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Pet.class), @ApiResponse(code = 400, message = "Invalid tag value", response = Pet.class) }) + @RequestMapping(value = "/pet/findByTags", produces = { "application/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); @ApiOperation(value = "Find pet by ID", notes = "Returns a single pet", response = Pet.class, authorizations = { @@ -89,10 +92,11 @@ public interface PetApi { @ApiResponse(code = 200, message = "successful operation", response = Pet.class), @ApiResponse(code = 400, message = "Invalid ID supplied", response = Pet.class), @ApiResponse(code = 404, message = "Pet not found", response = Pet.class) }) + @RequestMapping(value = "/pet/{petId}", produces = { "application/xml", "application/json" }, method = RequestMethod.GET) - ResponseEntity getPetById(@ApiParam(value = "ID of pet to return",required=true ) @PathVariable("petId") Long petId, @RequestHeader("Accept") String accept) throws IOException; + ResponseEntity getPetById(@ApiParam(value = "ID of pet to return",required=true ) @PathVariable("petId") Long petId); @ApiOperation(value = "Update an existing pet", notes = "", response = Void.class, authorizations = { @@ -105,11 +109,12 @@ public interface PetApi { @ApiResponse(code = 400, message = "Invalid ID supplied", response = Void.class), @ApiResponse(code = 404, message = "Pet not found", response = Void.class), @ApiResponse(code = 405, message = "Validation exception", response = Void.class) }) + @RequestMapping(value = "/pet", produces = { "application/xml", "application/json" }, consumes = { "application/json", "application/xml" }, method = RequestMethod.PUT) - ResponseEntity updatePet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody Pet body, @RequestHeader("Accept") String accept); + ResponseEntity updatePet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody Pet body); @ApiOperation(value = "Updates a pet in the store with form data", notes = "", response = Void.class, authorizations = { @@ -120,11 +125,12 @@ public interface PetApi { }, tags={ "pet", }) @ApiResponses(value = { @ApiResponse(code = 405, message = "Invalid input", response = Void.class) }) + @RequestMapping(value = "/pet/{petId}", produces = { "application/xml", "application/json" }, consumes = { "application/x-www-form-urlencoded" }, method = RequestMethod.POST) - ResponseEntity updatePetWithForm(@ApiParam(value = "ID of pet that needs to be updated",required=true ) @PathVariable("petId") Long petId,@ApiParam(value = "Updated name of the pet") @RequestPart(value="name", required=false) String name,@ApiParam(value = "Updated status of the pet") @RequestPart(value="status", required=false) String status, @RequestHeader("Accept") String accept); + ResponseEntity updatePetWithForm(@ApiParam(value = "ID of pet that needs to be updated",required=true ) @PathVariable("petId") Long petId,@ApiParam(value = "Updated name of the pet") @RequestPart(value="name", required=false) String name,@ApiParam(value = "Updated status of the pet") @RequestPart(value="status", required=false) String status); @ApiOperation(value = "uploads an image", notes = "", response = ModelApiResponse.class, authorizations = { @@ -135,10 +141,11 @@ public interface PetApi { }, tags={ "pet", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = ModelApiResponse.class) }) + @RequestMapping(value = "/pet/{petId}/uploadImage", produces = { "application/json" }, consumes = { "multipart/form-data" }, method = RequestMethod.POST) - ResponseEntity uploadFile(@ApiParam(value = "ID of pet to update",required=true ) @PathVariable("petId") Long petId,@ApiParam(value = "Additional data to pass to server") @RequestPart(value="additionalMetadata", required=false) String additionalMetadata,@ApiParam(value = "file detail") @RequestPart("file") MultipartFile file, @RequestHeader("Accept") String accept) throws IOException; + ResponseEntity uploadFile(@ApiParam(value = "ID of pet to update",required=true ) @PathVariable("petId") Long petId,@ApiParam(value = "Additional data to pass to server") @RequestPart(value="additionalMetadata", required=false) String additionalMetadata,@ApiParam(value = "file detail") @RequestPart("file") MultipartFile file); } diff --git a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/api/PetApiController.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/api/PetApiController.java index 66e1dbda18..6ad4390e16 100644 --- a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/api/PetApiController.java +++ b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/api/PetApiController.java @@ -17,104 +17,57 @@ import org.springframework.web.bind.annotation.RequestPart; import org.springframework.web.multipart.MultipartFile; import java.util.List; -import com.fasterxml.jackson.databind.ObjectMapper; -import java.io.IOException; + import javax.validation.constraints.*; import javax.validation.Valid; @Controller public class PetApiController implements PetApi { - private final ObjectMapper objectMapper; - public PetApiController(ObjectMapper objectMapper) { - this.objectMapper = objectMapper; - } - public ResponseEntity addPet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody Pet body, - @RequestHeader("Accept") String accept) { + + public ResponseEntity addPet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody Pet body) { // do some magic! return new ResponseEntity(HttpStatus.OK); } public ResponseEntity deletePet(@ApiParam(value = "Pet id to delete",required=true ) @PathVariable("petId") Long petId, - @ApiParam(value = "" ) @RequestHeader(value="api_key", required=false) String apiKey, - @RequestHeader("Accept") String accept) { + @ApiParam(value = "" ) @RequestHeader(value="api_key", required=false) String apiKey) { // do some magic! 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, - @RequestHeader("Accept") String accept) throws IOException { + public ResponseEntity> findPetsByStatus( @NotNull@ApiParam(value = "Status values that need to be considered for filter", required = true, allowableValues = "available, pending, sold") @RequestParam(value = "status", required = true) List status) { // do some magic! - - if (accept != null && accept.contains("application/xml")) { - return new ResponseEntity>(objectMapper.readValue(" 123456789 doggie aeiou aeiou", List.class), HttpStatus.OK); - } - - - if (accept != null && accept.contains("application/json")) { - return new ResponseEntity>(objectMapper.readValue("[ { \"photoUrls\" : [ \"aeiou\" ], \"name\" : \"doggie\", \"id\" : 0, \"category\" : { \"name\" : \"aeiou\", \"id\" : 6 }, \"tags\" : [ { \"name\" : \"aeiou\", \"id\" : 1 } ], \"status\" : \"available\"} ]", List.class), HttpStatus.OK); - } - return new ResponseEntity>(HttpStatus.OK); } - 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 { + public ResponseEntity> findPetsByTags( @NotNull@ApiParam(value = "Tags to filter by", required = true) @RequestParam(value = "tags", required = true) List tags) { // do some magic! - - if (accept != null && accept.contains("application/xml")) { - return new ResponseEntity>(objectMapper.readValue(" 123456789 doggie aeiou aeiou", List.class), HttpStatus.OK); - } - - - if (accept != null && accept.contains("application/json")) { - return new ResponseEntity>(objectMapper.readValue("[ { \"photoUrls\" : [ \"aeiou\" ], \"name\" : \"doggie\", \"id\" : 0, \"category\" : { \"name\" : \"aeiou\", \"id\" : 6 }, \"tags\" : [ { \"name\" : \"aeiou\", \"id\" : 1 } ], \"status\" : \"available\"} ]", List.class), HttpStatus.OK); - } - return new ResponseEntity>(HttpStatus.OK); } - public ResponseEntity getPetById(@ApiParam(value = "ID of pet to return",required=true ) @PathVariable("petId") Long petId, - @RequestHeader("Accept") String accept) throws IOException { + public ResponseEntity getPetById(@ApiParam(value = "ID of pet to return",required=true ) @PathVariable("petId") Long petId) { // do some magic! - - if (accept != null && accept.contains("application/xml")) { - return new ResponseEntity(objectMapper.readValue(" 123456789 doggie aeiou aeiou", Pet.class), HttpStatus.OK); - } - - - if (accept != null && accept.contains("application/json")) { - return new ResponseEntity(objectMapper.readValue("{ \"photoUrls\" : [ \"aeiou\" ], \"name\" : \"doggie\", \"id\" : 0, \"category\" : { \"name\" : \"aeiou\", \"id\" : 6 }, \"tags\" : [ { \"name\" : \"aeiou\", \"id\" : 1 } ], \"status\" : \"available\"}", Pet.class), HttpStatus.OK); - } - return new ResponseEntity(HttpStatus.OK); } - public ResponseEntity updatePet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody Pet body, - @RequestHeader("Accept") String accept) { + public ResponseEntity updatePet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody Pet body) { // do some magic! return new ResponseEntity(HttpStatus.OK); } public ResponseEntity updatePetWithForm(@ApiParam(value = "ID of pet that needs to be updated",required=true ) @PathVariable("petId") Long petId, @ApiParam(value = "Updated name of the pet") @RequestPart(value="name", required=false) String name, - @ApiParam(value = "Updated status of the pet") @RequestPart(value="status", required=false) String status, - @RequestHeader("Accept") String accept) { + @ApiParam(value = "Updated status of the pet") @RequestPart(value="status", required=false) String status) { // do some magic! return new ResponseEntity(HttpStatus.OK); } public ResponseEntity uploadFile(@ApiParam(value = "ID of pet to update",required=true ) @PathVariable("petId") Long petId, @ApiParam(value = "Additional data to pass to server") @RequestPart(value="additionalMetadata", required=false) String additionalMetadata, - @ApiParam(value = "file detail") @RequestPart("file") MultipartFile file, - @RequestHeader("Accept") String accept) throws IOException { + @ApiParam(value = "file detail") @RequestPart("file") MultipartFile file) { // do some magic! - - if (accept != null && accept.contains("application/json")) { - return new ResponseEntity(objectMapper.readValue("{ \"code\" : 0, \"type\" : \"aeiou\", \"message\" : \"aeiou\"}", ModelApiResponse.class), HttpStatus.OK); - } - return new ResponseEntity(HttpStatus.OK); } diff --git a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/api/StoreApi.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/api/StoreApi.java index fb8f3d706f..8b080a440d 100644 --- a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/api/StoreApi.java +++ b/samples/server/petstore/springboot-beanvalidation/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.*; @@ -26,10 +25,11 @@ public interface StoreApi { @ApiResponses(value = { @ApiResponse(code = 400, message = "Invalid ID supplied", response = Void.class), @ApiResponse(code = 404, message = "Order not found", response = Void.class) }) + @RequestMapping(value = "/store/order/{order_id}", produces = { "application/xml", "application/json" }, method = RequestMethod.DELETE) - ResponseEntity deleteOrder(@ApiParam(value = "ID of the order that needs to be deleted",required=true ) @PathVariable("order_id") String orderId, @RequestHeader("Accept") String accept); + ResponseEntity deleteOrder(@ApiParam(value = "ID of the order that needs to be deleted",required=true ) @PathVariable("order_id") String orderId); @ApiOperation(value = "Returns pet inventories by status", notes = "Returns a map of status codes to quantities", response = Integer.class, responseContainer = "Map", authorizations = { @@ -37,10 +37,11 @@ public interface StoreApi { }, tags={ "store", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Integer.class) }) + @RequestMapping(value = "/store/inventory", produces = { "application/json" }, method = RequestMethod.GET) - ResponseEntity> getInventory( @RequestHeader("Accept") String accept) throws IOException; + ResponseEntity> getInventory(); @ApiOperation(value = "Find purchase order by ID", notes = "For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions", response = Order.class, tags={ "store", }) @@ -48,19 +49,21 @@ public interface StoreApi { @ApiResponse(code = 200, message = "successful operation", response = Order.class), @ApiResponse(code = 400, message = "Invalid ID supplied", response = Order.class), @ApiResponse(code = 404, message = "Order not found", response = Order.class) }) + @RequestMapping(value = "/store/order/{order_id}", produces = { "application/xml", "application/json" }, method = RequestMethod.GET) - ResponseEntity getOrderById( @Min(1) @Max(5)@ApiParam(value = "ID of pet that needs to be fetched",required=true ) @PathVariable("order_id") Long orderId, @RequestHeader("Accept") String accept) throws IOException; + ResponseEntity getOrderById( @Min(1) @Max(5)@ApiParam(value = "ID of pet that needs to be fetched",required=true ) @PathVariable("order_id") Long orderId); @ApiOperation(value = "Place an order for a pet", notes = "", response = Order.class, tags={ "store", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Order.class), @ApiResponse(code = 400, message = "Invalid Order", response = Order.class) }) + @RequestMapping(value = "/store/order", produces = { "application/xml", "application/json" }, method = RequestMethod.POST) - ResponseEntity placeOrder(@ApiParam(value = "order placed for purchasing the pet" ,required=true ) @Valid @RequestBody Order body, @RequestHeader("Accept") String accept) throws IOException; + ResponseEntity placeOrder(@ApiParam(value = "order placed for purchasing the pet" ,required=true ) @Valid @RequestBody Order body); } diff --git a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/api/StoreApiController.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/api/StoreApiController.java index 6154d9c263..472bda2ada 100644 --- a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/api/StoreApiController.java +++ b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/api/StoreApiController.java @@ -16,64 +16,32 @@ import org.springframework.web.bind.annotation.RequestPart; import org.springframework.web.multipart.MultipartFile; import java.util.List; -import com.fasterxml.jackson.databind.ObjectMapper; -import java.io.IOException; + import javax.validation.constraints.*; import javax.validation.Valid; @Controller public class StoreApiController implements StoreApi { - private final ObjectMapper objectMapper; - public StoreApiController(ObjectMapper objectMapper) { - this.objectMapper = objectMapper; - } - public ResponseEntity deleteOrder(@ApiParam(value = "ID of the order that needs to be deleted",required=true ) @PathVariable("order_id") String orderId, - @RequestHeader("Accept") String accept) { + + public ResponseEntity deleteOrder(@ApiParam(value = "ID of the order that needs to be deleted",required=true ) @PathVariable("order_id") String orderId) { // do some magic! return new ResponseEntity(HttpStatus.OK); } - public ResponseEntity> getInventory(@RequestHeader("Accept") String accept) throws IOException { + public ResponseEntity> getInventory() { // do some magic! - - if (accept != null && accept.contains("application/json")) { - return new ResponseEntity>(objectMapper.readValue("{ \"key\" : 0}", Map.class), HttpStatus.OK); - } - return new ResponseEntity>(HttpStatus.OK); } - public ResponseEntity getOrderById( @Min(1) @Max(5)@ApiParam(value = "ID of pet that needs to be fetched",required=true ) @PathVariable("order_id") Long orderId, - @RequestHeader("Accept") String accept) throws IOException { + public ResponseEntity getOrderById( @Min(1) @Max(5)@ApiParam(value = "ID of pet that needs to be fetched",required=true ) @PathVariable("order_id") Long orderId) { // do some magic! - - if (accept != null && accept.contains("application/xml")) { - return new ResponseEntity(objectMapper.readValue(" 123456789 123456789 123 2000-01-23T04:56:07.000Z aeiou true", Order.class), HttpStatus.OK); - } - - - if (accept != null && accept.contains("application/json")) { - return new ResponseEntity(objectMapper.readValue("{ \"petId\" : 6, \"quantity\" : 1, \"id\" : 0, \"shipDate\" : \"2000-01-23T04:56:07.000+00:00\", \"complete\" : false, \"status\" : \"placed\"}", Order.class), HttpStatus.OK); - } - return new ResponseEntity(HttpStatus.OK); } - public ResponseEntity placeOrder(@ApiParam(value = "order placed for purchasing the pet" ,required=true ) @Valid @RequestBody Order body, - @RequestHeader("Accept") String accept) throws IOException { + public ResponseEntity placeOrder(@ApiParam(value = "order placed for purchasing the pet" ,required=true ) @Valid @RequestBody Order body) { // do some magic! - - if (accept != null && accept.contains("application/xml")) { - return new ResponseEntity(objectMapper.readValue(" 123456789 123456789 123 2000-01-23T04:56:07.000Z aeiou true", Order.class), HttpStatus.OK); - } - - - if (accept != null && accept.contains("application/json")) { - return new ResponseEntity(objectMapper.readValue("{ \"petId\" : 6, \"quantity\" : 1, \"id\" : 0, \"shipDate\" : \"2000-01-23T04:56:07.000+00:00\", \"complete\" : false, \"status\" : \"placed\"}", Order.class), HttpStatus.OK); - } - return new ResponseEntity(HttpStatus.OK); } diff --git a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/api/UserApi.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/api/UserApi.java index adc0d21d30..55fe9faf68 100644 --- a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/api/UserApi.java +++ b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/api/UserApi.java @@ -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.*; @@ -25,38 +24,42 @@ public interface UserApi { @ApiOperation(value = "Create user", notes = "This can only be done by the logged in user.", response = Void.class, tags={ "user", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Void.class) }) + @RequestMapping(value = "/user", produces = { "application/xml", "application/json" }, method = RequestMethod.POST) - ResponseEntity createUser(@ApiParam(value = "Created user object" ,required=true ) @Valid @RequestBody User body, @RequestHeader("Accept") String accept); + ResponseEntity createUser(@ApiParam(value = "Created user object" ,required=true ) @Valid @RequestBody User body); @ApiOperation(value = "Creates list of users with given input array", notes = "", response = Void.class, tags={ "user", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Void.class) }) + @RequestMapping(value = "/user/createWithArray", produces = { "application/xml", "application/json" }, method = RequestMethod.POST) - ResponseEntity createUsersWithArrayInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody List body, @RequestHeader("Accept") String accept); + ResponseEntity createUsersWithArrayInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody List body); @ApiOperation(value = "Creates list of users with given input array", notes = "", response = Void.class, tags={ "user", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Void.class) }) + @RequestMapping(value = "/user/createWithList", produces = { "application/xml", "application/json" }, method = RequestMethod.POST) - ResponseEntity createUsersWithListInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody List body, @RequestHeader("Accept") String accept); + ResponseEntity createUsersWithListInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody List body); @ApiOperation(value = "Delete user", notes = "This can only be done by the logged in user.", response = Void.class, tags={ "user", }) @ApiResponses(value = { @ApiResponse(code = 400, message = "Invalid username supplied", response = Void.class), @ApiResponse(code = 404, message = "User not found", response = Void.class) }) + @RequestMapping(value = "/user/{username}", produces = { "application/xml", "application/json" }, method = RequestMethod.DELETE) - ResponseEntity deleteUser(@ApiParam(value = "The name that needs to be deleted",required=true ) @PathVariable("username") String username, @RequestHeader("Accept") String accept); + ResponseEntity deleteUser(@ApiParam(value = "The name that needs to be deleted",required=true ) @PathVariable("username") String username); @ApiOperation(value = "Get user by user name", notes = "", response = User.class, tags={ "user", }) @@ -64,38 +67,42 @@ public interface UserApi { @ApiResponse(code = 200, message = "successful operation", response = User.class), @ApiResponse(code = 400, message = "Invalid username supplied", response = User.class), @ApiResponse(code = 404, message = "User not found", response = User.class) }) + @RequestMapping(value = "/user/{username}", produces = { "application/xml", "application/json" }, method = RequestMethod.GET) - ResponseEntity getUserByName(@ApiParam(value = "The name that needs to be fetched. Use user1 for testing. ",required=true ) @PathVariable("username") String username, @RequestHeader("Accept") String accept) throws IOException; + ResponseEntity getUserByName(@ApiParam(value = "The name that needs to be fetched. Use user1 for testing. ",required=true ) @PathVariable("username") String username); @ApiOperation(value = "Logs user into the system", notes = "", response = String.class, tags={ "user", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = String.class), @ApiResponse(code = 400, message = "Invalid username/password supplied", response = String.class) }) + @RequestMapping(value = "/user/login", produces = { "application/xml", "application/json" }, method = RequestMethod.GET) - ResponseEntity loginUser( @NotNull@ApiParam(value = "The user name for login", required = true) @RequestParam(value = "username", required = true) String username, @NotNull@ApiParam(value = "The password for login in clear text", required = true) @RequestParam(value = "password", required = true) String password, @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); @ApiOperation(value = "Logs out current logged in user session", notes = "", response = Void.class, tags={ "user", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Void.class) }) + @RequestMapping(value = "/user/logout", produces = { "application/xml", "application/json" }, method = RequestMethod.GET) - ResponseEntity logoutUser( @RequestHeader("Accept") String accept); + ResponseEntity logoutUser(); @ApiOperation(value = "Updated user", notes = "This can only be done by the logged in user.", response = Void.class, tags={ "user", }) @ApiResponses(value = { @ApiResponse(code = 400, message = "Invalid user supplied", response = Void.class), @ApiResponse(code = 404, message = "User not found", response = Void.class) }) + @RequestMapping(value = "/user/{username}", produces = { "application/xml", "application/json" }, method = RequestMethod.PUT) - ResponseEntity updateUser(@ApiParam(value = "name that need to be deleted",required=true ) @PathVariable("username") String username,@ApiParam(value = "Updated user object" ,required=true ) @Valid @RequestBody User body, @RequestHeader("Accept") String accept); + ResponseEntity updateUser(@ApiParam(value = "name that need to be deleted",required=true ) @PathVariable("username") String username,@ApiParam(value = "Updated user object" ,required=true ) @Valid @RequestBody User body); } diff --git a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/api/UserApiController.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/api/UserApiController.java index 24b7e18b99..e751209da2 100644 --- a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/api/UserApiController.java +++ b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/api/UserApiController.java @@ -16,84 +16,53 @@ import org.springframework.web.bind.annotation.RequestPart; import org.springframework.web.multipart.MultipartFile; import java.util.List; -import com.fasterxml.jackson.databind.ObjectMapper; -import java.io.IOException; + import javax.validation.constraints.*; import javax.validation.Valid; @Controller public class UserApiController implements UserApi { - private final ObjectMapper objectMapper; - public UserApiController(ObjectMapper objectMapper) { - this.objectMapper = objectMapper; - } - public ResponseEntity createUser(@ApiParam(value = "Created user object" ,required=true ) @Valid @RequestBody User body, - @RequestHeader("Accept") String accept) { + + public ResponseEntity createUser(@ApiParam(value = "Created user object" ,required=true ) @Valid @RequestBody User body) { // do some magic! return new ResponseEntity(HttpStatus.OK); } - public ResponseEntity createUsersWithArrayInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody List body, - @RequestHeader("Accept") String accept) { + public ResponseEntity createUsersWithArrayInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody List body) { // do some magic! return new ResponseEntity(HttpStatus.OK); } - public ResponseEntity createUsersWithListInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody List body, - @RequestHeader("Accept") String accept) { + public ResponseEntity createUsersWithListInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody List body) { // do some magic! return new ResponseEntity(HttpStatus.OK); } - public ResponseEntity deleteUser(@ApiParam(value = "The name that needs to be deleted",required=true ) @PathVariable("username") String username, - @RequestHeader("Accept") String accept) { + public ResponseEntity deleteUser(@ApiParam(value = "The name that needs to be deleted",required=true ) @PathVariable("username") String username) { // do some magic! return new ResponseEntity(HttpStatus.OK); } - public ResponseEntity getUserByName(@ApiParam(value = "The name that needs to be fetched. Use user1 for testing. ",required=true ) @PathVariable("username") String username, - @RequestHeader("Accept") String accept) throws IOException { + public ResponseEntity getUserByName(@ApiParam(value = "The name that needs to be fetched. Use user1 for testing. ",required=true ) @PathVariable("username") String username) { // do some magic! - - if (accept != null && accept.contains("application/xml")) { - return new ResponseEntity(objectMapper.readValue(" 123456789 aeiou aeiou aeiou aeiou aeiou aeiou 123", User.class), HttpStatus.OK); - } - - - if (accept != null && accept.contains("application/json")) { - return new ResponseEntity(objectMapper.readValue("{ \"firstName\" : \"aeiou\", \"lastName\" : \"aeiou\", \"password\" : \"aeiou\", \"userStatus\" : 6, \"phone\" : \"aeiou\", \"id\" : 0, \"email\" : \"aeiou\", \"username\" : \"aeiou\"}", User.class), HttpStatus.OK); - } - 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, - @RequestHeader("Accept") String accept) throws IOException { + @NotNull@ApiParam(value = "The password for login in clear text", required = true) @RequestParam(value = "password", required = true) String password) { // do some magic! - - if (accept != null && accept.contains("application/xml")) { - return new ResponseEntity(objectMapper.readValue("aeiou", String.class), HttpStatus.OK); - } - - - if (accept != null && accept.contains("application/json")) { - return new ResponseEntity(objectMapper.readValue("\"aeiou\"", String.class), HttpStatus.OK); - } - return new ResponseEntity(HttpStatus.OK); } - public ResponseEntity logoutUser(@RequestHeader("Accept") String accept) { + public ResponseEntity logoutUser() { // do some magic! return new ResponseEntity(HttpStatus.OK); } public ResponseEntity updateUser(@ApiParam(value = "name that need to be deleted",required=true ) @PathVariable("username") String username, - @ApiParam(value = "Updated user object" ,required=true ) @Valid @RequestBody User body, - @RequestHeader("Accept") String accept) { + @ApiParam(value = "Updated user object" ,required=true ) @Valid @RequestBody User body) { // do some magic! return new ResponseEntity(HttpStatus.OK); } diff --git a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/AdditionalPropertiesClass.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/AdditionalPropertiesClass.java index 80be4236b0..532576aad8 100644 --- a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/AdditionalPropertiesClass.java +++ b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/AdditionalPropertiesClass.java @@ -41,7 +41,7 @@ public class AdditionalPropertiesClass { **/ @ApiModelProperty(value = "") - @Valid + public Map getMapProperty() { return mapProperty; } @@ -70,6 +70,7 @@ public class AdditionalPropertiesClass { @ApiModelProperty(value = "") @Valid + public Map> getMapOfMapProperty() { return mapOfMapProperty; } diff --git a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/Animal.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/Animal.java index bc957d1c80..a59dc766c5 100644 --- a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/Animal.java +++ b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/Animal.java @@ -38,7 +38,7 @@ public class Animal { @ApiModelProperty(required = true, value = "") @NotNull - @Valid + public String getClassName() { return className; } @@ -58,7 +58,7 @@ public class Animal { **/ @ApiModelProperty(value = "") - @Valid + public String getColor() { return color; } diff --git a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/ArrayOfArrayOfNumberOnly.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/ArrayOfArrayOfNumberOnly.java index f9dca7d60b..ecff36e416 100644 --- a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/ArrayOfArrayOfNumberOnly.java +++ b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/ArrayOfArrayOfNumberOnly.java @@ -39,6 +39,7 @@ public class ArrayOfArrayOfNumberOnly { @ApiModelProperty(value = "") @Valid + public List> getArrayArrayNumber() { return arrayArrayNumber; } diff --git a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/ArrayOfNumberOnly.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/ArrayOfNumberOnly.java index e9c8a313be..a08ff749ee 100644 --- a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/ArrayOfNumberOnly.java +++ b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/ArrayOfNumberOnly.java @@ -39,6 +39,7 @@ public class ArrayOfNumberOnly { @ApiModelProperty(value = "") @Valid + public List getArrayNumber() { return arrayNumber; } diff --git a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/ArrayTest.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/ArrayTest.java index 78c35d3c63..e9022fd028 100644 --- a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/ArrayTest.java +++ b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/ArrayTest.java @@ -44,7 +44,7 @@ public class ArrayTest { **/ @ApiModelProperty(value = "") - @Valid + public List getArrayOfString() { return arrayOfString; } @@ -73,6 +73,7 @@ public class ArrayTest { @ApiModelProperty(value = "") @Valid + public List> getArrayArrayOfInteger() { return arrayArrayOfInteger; } @@ -101,6 +102,7 @@ public class ArrayTest { @ApiModelProperty(value = "") @Valid + public List> getArrayArrayOfModel() { return arrayArrayOfModel; } diff --git a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/Capitalization.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/Capitalization.java index 93533c2882..d59005adf1 100644 --- a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/Capitalization.java +++ b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/Capitalization.java @@ -42,7 +42,7 @@ public class Capitalization { **/ @ApiModelProperty(value = "") - @Valid + public String getSmallCamel() { return smallCamel; } @@ -62,7 +62,7 @@ public class Capitalization { **/ @ApiModelProperty(value = "") - @Valid + public String getCapitalCamel() { return capitalCamel; } @@ -82,7 +82,7 @@ public class Capitalization { **/ @ApiModelProperty(value = "") - @Valid + public String getSmallSnake() { return smallSnake; } @@ -102,7 +102,7 @@ public class Capitalization { **/ @ApiModelProperty(value = "") - @Valid + public String getCapitalSnake() { return capitalSnake; } @@ -122,7 +122,7 @@ public class Capitalization { **/ @ApiModelProperty(value = "") - @Valid + public String getScAETHFlowPoints() { return scAETHFlowPoints; } @@ -142,7 +142,7 @@ public class Capitalization { **/ @ApiModelProperty(value = "Name of the pet ") - @Valid + public String getATTNAME() { return ATT_NAME; } diff --git a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/Cat.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/Cat.java index edcbc354be..28016fa5ad 100644 --- a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/Cat.java +++ b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/Cat.java @@ -28,7 +28,7 @@ public class Cat extends Animal { **/ @ApiModelProperty(value = "") - @Valid + public Boolean getDeclawed() { return declawed; } diff --git a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/Category.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/Category.java index 6dd9cb7a2a..e2a67cf25d 100644 --- a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/Category.java +++ b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/Category.java @@ -30,7 +30,7 @@ public class Category { **/ @ApiModelProperty(value = "") - @Valid + public Long getId() { return id; } @@ -50,7 +50,7 @@ public class Category { **/ @ApiModelProperty(value = "") - @Valid + public String getName() { return name; } diff --git a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/ClassModel.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/ClassModel.java index 6a6379f5b6..a5ef34a233 100644 --- a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/ClassModel.java +++ b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/ClassModel.java @@ -28,7 +28,7 @@ public class ClassModel { **/ @ApiModelProperty(value = "") - @Valid + public String getPropertyClass() { return propertyClass; } diff --git a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/Client.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/Client.java index 3b8d16cabf..aaa03c570f 100644 --- a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/Client.java +++ b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/Client.java @@ -27,7 +27,7 @@ public class Client { **/ @ApiModelProperty(value = "") - @Valid + public String getClient() { return client; } diff --git a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/Dog.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/Dog.java index 513131a9fa..8ebd0f46a6 100644 --- a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/Dog.java +++ b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/Dog.java @@ -28,7 +28,7 @@ public class Dog extends Animal { **/ @ApiModelProperty(value = "") - @Valid + public String getBreed() { return breed; } diff --git a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/EnumArrays.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/EnumArrays.java index bbf4a3036e..4d79aa66c5 100644 --- a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/EnumArrays.java +++ b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/EnumArrays.java @@ -95,7 +95,7 @@ public class EnumArrays { **/ @ApiModelProperty(value = "") - @Valid + public JustSymbolEnum getJustSymbol() { return justSymbol; } @@ -123,7 +123,7 @@ public class EnumArrays { **/ @ApiModelProperty(value = "") - @Valid + public List getArrayEnum() { return arrayEnum; } diff --git a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/EnumTest.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/EnumTest.java index c7e4793cdf..a072f99267 100644 --- a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/EnumTest.java +++ b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/EnumTest.java @@ -133,7 +133,7 @@ public class EnumTest { **/ @ApiModelProperty(value = "") - @Valid + public EnumStringEnum getEnumString() { return enumString; } @@ -153,7 +153,7 @@ public class EnumTest { **/ @ApiModelProperty(value = "") - @Valid + public EnumIntegerEnum getEnumInteger() { return enumInteger; } @@ -173,7 +173,7 @@ public class EnumTest { **/ @ApiModelProperty(value = "") - @Valid + public EnumNumberEnum getEnumNumber() { return enumNumber; } @@ -194,6 +194,7 @@ public class EnumTest { @ApiModelProperty(value = "") @Valid + public OuterEnum getOuterEnum() { return outerEnum; } diff --git a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/FormatTest.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/FormatTest.java index 9d6cf5cd4b..5ef3ec9215 100644 --- a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/FormatTest.java +++ b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/FormatTest.java @@ -68,8 +68,8 @@ public class FormatTest { * @return integer **/ @ApiModelProperty(value = "") + @Min(10) @Max(100) - @Valid public Integer getInteger() { return integer; } @@ -90,8 +90,8 @@ public class FormatTest { * @return int32 **/ @ApiModelProperty(value = "") + @Min(20) @Max(200) - @Valid public Integer getInt32() { return int32; } @@ -111,7 +111,7 @@ public class FormatTest { **/ @ApiModelProperty(value = "") - @Valid + public Long getInt64() { return int64; } @@ -133,8 +133,9 @@ public class FormatTest { **/ @ApiModelProperty(required = true, value = "") @NotNull - @DecimalMin("32.1") @DecimalMax("543.2") + @Valid + @DecimalMin("32.1") @DecimalMax("543.2") public BigDecimal getNumber() { return number; } @@ -155,8 +156,8 @@ public class FormatTest { * @return _float **/ @ApiModelProperty(value = "") + @DecimalMin("54.3") @DecimalMax("987.6") - @Valid public Float getFloat() { return _float; } @@ -177,8 +178,8 @@ public class FormatTest { * @return _double **/ @ApiModelProperty(value = "") + @DecimalMin("67.8") @DecimalMax("123.4") - @Valid public Double getDouble() { return _double; } @@ -197,8 +198,8 @@ public class FormatTest { * @return string **/ @ApiModelProperty(value = "") + @Pattern(regexp="/[a-z]/i") - @Valid public String getString() { return string; } @@ -219,7 +220,7 @@ public class FormatTest { @ApiModelProperty(required = true, value = "") @NotNull - @Valid + public byte[] getByte() { return _byte; } @@ -239,7 +240,7 @@ public class FormatTest { **/ @ApiModelProperty(value = "") - @Valid + public byte[] getBinary() { return binary; } @@ -261,6 +262,7 @@ public class FormatTest { @NotNull @Valid + public LocalDate getDate() { return date; } @@ -281,6 +283,7 @@ public class FormatTest { @ApiModelProperty(value = "") @Valid + public DateTime getDateTime() { return dateTime; } @@ -301,6 +304,7 @@ public class FormatTest { @ApiModelProperty(value = "") @Valid + public UUID getUuid() { return uuid; } @@ -320,8 +324,8 @@ public class FormatTest { **/ @ApiModelProperty(required = true, value = "") @NotNull + @Size(min=10,max=64) - @Valid public String getPassword() { return password; } diff --git a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/HasOnlyReadOnly.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/HasOnlyReadOnly.java index 0f8b608e26..dc59cf9c78 100644 --- a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/HasOnlyReadOnly.java +++ b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/HasOnlyReadOnly.java @@ -30,7 +30,7 @@ public class HasOnlyReadOnly { **/ @ApiModelProperty(readOnly = true, value = "") - @Valid + public String getBar() { return bar; } @@ -50,7 +50,7 @@ public class HasOnlyReadOnly { **/ @ApiModelProperty(readOnly = true, value = "") - @Valid + public String getFoo() { return foo; } diff --git a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/MapTest.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/MapTest.java index 1530a53f53..f179e8e423 100644 --- a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/MapTest.java +++ b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/MapTest.java @@ -74,6 +74,7 @@ public class MapTest { @ApiModelProperty(value = "") @Valid + public Map> getMapMapOfString() { return mapMapOfString; } @@ -101,7 +102,7 @@ public class MapTest { **/ @ApiModelProperty(value = "") - @Valid + public Map getMapOfEnumString() { return mapOfEnumString; } diff --git a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/MixedPropertiesAndAdditionalPropertiesClass.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/MixedPropertiesAndAdditionalPropertiesClass.java index d4cd89cef3..d25bba89a9 100644 --- a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/MixedPropertiesAndAdditionalPropertiesClass.java +++ b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/MixedPropertiesAndAdditionalPropertiesClass.java @@ -40,6 +40,7 @@ public class MixedPropertiesAndAdditionalPropertiesClass { @ApiModelProperty(value = "") @Valid + public UUID getUuid() { return uuid; } @@ -60,6 +61,7 @@ public class MixedPropertiesAndAdditionalPropertiesClass { @ApiModelProperty(value = "") @Valid + public DateTime getDateTime() { return dateTime; } @@ -88,6 +90,7 @@ public class MixedPropertiesAndAdditionalPropertiesClass { @ApiModelProperty(value = "") @Valid + public Map getMap() { return map; } diff --git a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/Model200Response.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/Model200Response.java index 97349fef05..c00e48ea6c 100644 --- a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/Model200Response.java +++ b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/Model200Response.java @@ -31,7 +31,7 @@ public class Model200Response { **/ @ApiModelProperty(value = "") - @Valid + public Integer getName() { return name; } @@ -51,7 +51,7 @@ public class Model200Response { **/ @ApiModelProperty(value = "") - @Valid + public String getPropertyClass() { return propertyClass; } diff --git a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/ModelApiResponse.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/ModelApiResponse.java index c8882b3b1e..1df487b353 100644 --- a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/ModelApiResponse.java +++ b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/ModelApiResponse.java @@ -33,7 +33,7 @@ public class ModelApiResponse { **/ @ApiModelProperty(value = "") - @Valid + public Integer getCode() { return code; } @@ -53,7 +53,7 @@ public class ModelApiResponse { **/ @ApiModelProperty(value = "") - @Valid + public String getType() { return type; } @@ -73,7 +73,7 @@ public class ModelApiResponse { **/ @ApiModelProperty(value = "") - @Valid + public String getMessage() { return message; } diff --git a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/ModelReturn.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/ModelReturn.java index 7018d7de09..3b05293b83 100644 --- a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/ModelReturn.java +++ b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/ModelReturn.java @@ -28,7 +28,7 @@ public class ModelReturn { **/ @ApiModelProperty(value = "") - @Valid + public Integer getReturn() { return _return; } diff --git a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/Name.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/Name.java index 46069fdd14..a9835f910a 100644 --- a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/Name.java +++ b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/Name.java @@ -38,7 +38,7 @@ public class Name { @ApiModelProperty(required = true, value = "") @NotNull - @Valid + public Integer getName() { return name; } @@ -58,7 +58,7 @@ public class Name { **/ @ApiModelProperty(readOnly = true, value = "") - @Valid + public Integer getSnakeCase() { return snakeCase; } @@ -78,7 +78,7 @@ public class Name { **/ @ApiModelProperty(value = "") - @Valid + public String getProperty() { return property; } @@ -98,7 +98,7 @@ public class Name { **/ @ApiModelProperty(readOnly = true, value = "") - @Valid + public Integer get123Number() { return _123Number; } diff --git a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/NumberOnly.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/NumberOnly.java index e243ecb429..a990653f20 100644 --- a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/NumberOnly.java +++ b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/NumberOnly.java @@ -29,6 +29,7 @@ public class NumberOnly { @ApiModelProperty(value = "") @Valid + public BigDecimal getJustNumber() { return justNumber; } diff --git a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/Order.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/Order.java index 4106ac3619..5bfcf28b3e 100644 --- a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/Order.java +++ b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/Order.java @@ -77,7 +77,7 @@ public class Order { **/ @ApiModelProperty(value = "") - @Valid + public Long getId() { return id; } @@ -97,7 +97,7 @@ public class Order { **/ @ApiModelProperty(value = "") - @Valid + public Long getPetId() { return petId; } @@ -117,7 +117,7 @@ public class Order { **/ @ApiModelProperty(value = "") - @Valid + public Integer getQuantity() { return quantity; } @@ -138,6 +138,7 @@ public class Order { @ApiModelProperty(value = "") @Valid + public DateTime getShipDate() { return shipDate; } @@ -157,7 +158,7 @@ public class Order { **/ @ApiModelProperty(value = "Order Status") - @Valid + public StatusEnum getStatus() { return status; } @@ -177,7 +178,7 @@ public class Order { **/ @ApiModelProperty(value = "") - @Valid + public Boolean getComplete() { return complete; } diff --git a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/Pet.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/Pet.java index c84687b699..38d92a5b91 100644 --- a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/Pet.java +++ b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/Pet.java @@ -80,7 +80,7 @@ public class Pet { **/ @ApiModelProperty(value = "") - @Valid + public Long getId() { return id; } @@ -101,6 +101,7 @@ public class Pet { @ApiModelProperty(value = "") @Valid + public Category getCategory() { return category; } @@ -121,7 +122,7 @@ public class Pet { @ApiModelProperty(example = "doggie", required = true, value = "") @NotNull - @Valid + public String getName() { return name; } @@ -147,7 +148,7 @@ public class Pet { @ApiModelProperty(required = true, value = "") @NotNull - @Valid + public List getPhotoUrls() { return photoUrls; } @@ -176,6 +177,7 @@ public class Pet { @ApiModelProperty(value = "") @Valid + public List getTags() { return tags; } @@ -195,7 +197,7 @@ public class Pet { **/ @ApiModelProperty(value = "pet status in the store") - @Valid + public StatusEnum getStatus() { return status; } diff --git a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/ReadOnlyFirst.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/ReadOnlyFirst.java index 8e79be0008..1ff292f185 100644 --- a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/ReadOnlyFirst.java +++ b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/ReadOnlyFirst.java @@ -30,7 +30,7 @@ public class ReadOnlyFirst { **/ @ApiModelProperty(readOnly = true, value = "") - @Valid + public String getBar() { return bar; } @@ -50,7 +50,7 @@ public class ReadOnlyFirst { **/ @ApiModelProperty(value = "") - @Valid + public String getBaz() { return baz; } diff --git a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/SpecialModelName.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/SpecialModelName.java index 3cb7b04353..9eabbe3eca 100644 --- a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/SpecialModelName.java +++ b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/SpecialModelName.java @@ -27,7 +27,7 @@ public class SpecialModelName { **/ @ApiModelProperty(value = "") - @Valid + public Long getSpecialPropertyName() { return specialPropertyName; } diff --git a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/Tag.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/Tag.java index 9f8f3a2523..b3d49a2dc6 100644 --- a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/Tag.java +++ b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/Tag.java @@ -30,7 +30,7 @@ public class Tag { **/ @ApiModelProperty(value = "") - @Valid + public Long getId() { return id; } @@ -50,7 +50,7 @@ public class Tag { **/ @ApiModelProperty(value = "") - @Valid + public String getName() { return name; } diff --git a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/User.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/User.java index 501c556de2..ef3270b7af 100644 --- a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/User.java +++ b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/User.java @@ -48,7 +48,7 @@ public class User { **/ @ApiModelProperty(value = "") - @Valid + public Long getId() { return id; } @@ -68,7 +68,7 @@ public class User { **/ @ApiModelProperty(value = "") - @Valid + public String getUsername() { return username; } @@ -88,7 +88,7 @@ public class User { **/ @ApiModelProperty(value = "") - @Valid + public String getFirstName() { return firstName; } @@ -108,7 +108,7 @@ public class User { **/ @ApiModelProperty(value = "") - @Valid + public String getLastName() { return lastName; } @@ -128,7 +128,7 @@ public class User { **/ @ApiModelProperty(value = "") - @Valid + public String getEmail() { return email; } @@ -148,7 +148,7 @@ public class User { **/ @ApiModelProperty(value = "") - @Valid + public String getPassword() { return password; } @@ -168,7 +168,7 @@ public class User { **/ @ApiModelProperty(value = "") - @Valid + public String getPhone() { return phone; } @@ -188,7 +188,7 @@ public class User { **/ @ApiModelProperty(value = "User Status") - @Valid + public Integer getUserStatus() { return userStatus; } diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/api/FakeApi.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/api/FakeApi.java index 332c9b1101..eecc3dd4f3 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/api/FakeApi.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/api/FakeApi.java @@ -16,7 +16,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.*; @@ -28,11 +27,12 @@ public interface FakeApi { @ApiOperation(value = "To test \"client\" model", notes = "To test \"client\" model", response = Client.class, tags={ "fake", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Client.class) }) + @RequestMapping(value = "/fake", produces = { "application/json" }, consumes = { "application/json" }, method = RequestMethod.PATCH) - default ResponseEntity testClientModel(@ApiParam(value = "client model" ,required=true ) @Valid @RequestBody Client body, @RequestHeader("Accept") String accept) throws IOException { + default ResponseEntity testClientModel(@ApiParam(value = "client model" ,required=true ) @Valid @RequestBody Client body) { // do some magic! return new ResponseEntity(HttpStatus.OK); } @@ -44,11 +44,12 @@ public interface FakeApi { @ApiResponses(value = { @ApiResponse(code = 400, message = "Invalid username supplied", response = Void.class), @ApiResponse(code = 404, message = "User not found", response = Void.class) }) + @RequestMapping(value = "/fake", produces = { "application/xml; charset=utf-8", "application/json; charset=utf-8" }, consumes = { "application/xml; charset=utf-8", "application/json; charset=utf-8" }, method = RequestMethod.POST) - default ResponseEntity testEndpointParameters(@ApiParam(value = "None", required=true) @RequestPart(value="number", required=true) BigDecimal number,@ApiParam(value = "None", required=true) @RequestPart(value="double", required=true) Double _double,@ApiParam(value = "None", required=true) @RequestPart(value="pattern_without_delimiter", required=true) String patternWithoutDelimiter,@ApiParam(value = "None", required=true) @RequestPart(value="byte", required=true) byte[] _byte,@ApiParam(value = "None") @RequestPart(value="integer", required=false) Integer integer,@ApiParam(value = "None") @RequestPart(value="int32", required=false) Integer int32,@ApiParam(value = "None") @RequestPart(value="int64", required=false) Long int64,@ApiParam(value = "None") @RequestPart(value="float", required=false) Float _float,@ApiParam(value = "None") @RequestPart(value="string", required=false) String string,@ApiParam(value = "None") @RequestPart(value="binary", required=false) byte[] binary,@ApiParam(value = "None") @RequestPart(value="date", required=false) LocalDate date,@ApiParam(value = "None") @RequestPart(value="dateTime", required=false) OffsetDateTime dateTime,@ApiParam(value = "None") @RequestPart(value="password", required=false) String password,@ApiParam(value = "None") @RequestPart(value="callback", required=false) String paramCallback, @RequestHeader("Accept") String accept) { + default ResponseEntity testEndpointParameters(@ApiParam(value = "None", required=true) @RequestPart(value="number", required=true) BigDecimal number,@ApiParam(value = "None", required=true) @RequestPart(value="double", required=true) Double _double,@ApiParam(value = "None", required=true) @RequestPart(value="pattern_without_delimiter", required=true) String patternWithoutDelimiter,@ApiParam(value = "None", required=true) @RequestPart(value="byte", required=true) byte[] _byte,@ApiParam(value = "None") @RequestPart(value="integer", required=false) Integer integer,@ApiParam(value = "None") @RequestPart(value="int32", required=false) Integer int32,@ApiParam(value = "None") @RequestPart(value="int64", required=false) Long int64,@ApiParam(value = "None") @RequestPart(value="float", required=false) Float _float,@ApiParam(value = "None") @RequestPart(value="string", required=false) String string,@ApiParam(value = "None") @RequestPart(value="binary", required=false) byte[] binary,@ApiParam(value = "None") @RequestPart(value="date", required=false) LocalDate date,@ApiParam(value = "None") @RequestPart(value="dateTime", required=false) OffsetDateTime dateTime,@ApiParam(value = "None") @RequestPart(value="password", required=false) String password,@ApiParam(value = "None") @RequestPart(value="callback", required=false) String paramCallback) { // do some magic! return new ResponseEntity(HttpStatus.OK); } @@ -58,11 +59,12 @@ public interface FakeApi { @ApiResponses(value = { @ApiResponse(code = 400, message = "Invalid request", response = Void.class), @ApiResponse(code = 404, message = "Not found", response = Void.class) }) + @RequestMapping(value = "/fake", produces = { "*/*" }, consumes = { "*/*" }, method = RequestMethod.GET) - default ResponseEntity testEnumParameters(@ApiParam(value = "Form parameter enum test (string array)", allowableValues=">, $") @RequestPart(value="enum_form_string_array", required=false) List enumFormStringArray,@ApiParam(value = "Form parameter enum test (string)", allowableValues="_abc, -efg, (xyz)", defaultValue="-efg") @RequestPart(value="enum_form_string", required=false) String enumFormString,@ApiParam(value = "Header parameter enum test (string array)" , allowableValues=">, $") @RequestHeader(value="enum_header_string_array", required=false) List enumHeaderStringArray,@ApiParam(value = "Header parameter enum test (string)" , allowableValues="_abc, -efg, (xyz)", defaultValue="-efg") @RequestHeader(value="enum_header_string", required=false) String enumHeaderString,@ApiParam(value = "Query parameter enum test (string array)", allowableValues = ">, $") @RequestParam(value = "enum_query_string_array", required = false) List enumQueryStringArray,@ApiParam(value = "Query parameter enum test (string)", allowableValues = "_abc, -efg, (xyz)", defaultValue = "-efg") @RequestParam(value = "enum_query_string", required = false, defaultValue="-efg") String enumQueryString,@ApiParam(value = "Query parameter enum test (double)", allowableValues = "1, -2") @RequestParam(value = "enum_query_integer", required = false) Integer enumQueryInteger,@ApiParam(value = "Query parameter enum test (double)", allowableValues="1.1, -1.2") @RequestPart(value="enum_query_double", required=false) Double enumQueryDouble, @RequestHeader("Accept") String accept) { + default ResponseEntity testEnumParameters(@ApiParam(value = "Form parameter enum test (string array)", allowableValues=">, $") @RequestPart(value="enum_form_string_array", required=false) List enumFormStringArray,@ApiParam(value = "Form parameter enum test (string)", allowableValues="_abc, -efg, (xyz)", defaultValue="-efg") @RequestPart(value="enum_form_string", required=false) String enumFormString,@ApiParam(value = "Header parameter enum test (string array)" , allowableValues=">, $") @RequestHeader(value="enum_header_string_array", required=false) List enumHeaderStringArray,@ApiParam(value = "Header parameter enum test (string)" , allowableValues="_abc, -efg, (xyz)", defaultValue="-efg") @RequestHeader(value="enum_header_string", required=false) String enumHeaderString,@ApiParam(value = "Query parameter enum test (string array)", allowableValues = ">, $") @RequestParam(value = "enum_query_string_array", required = false) List enumQueryStringArray,@ApiParam(value = "Query parameter enum test (string)", allowableValues = "_abc, -efg, (xyz)", defaultValue = "-efg") @RequestParam(value = "enum_query_string", required = false, defaultValue="-efg") String enumQueryString,@ApiParam(value = "Query parameter enum test (double)", allowableValues = "1, -2") @RequestParam(value = "enum_query_integer", required = false) Integer enumQueryInteger,@ApiParam(value = "Query parameter enum test (double)", allowableValues="1.1, -1.2") @RequestPart(value="enum_query_double", required=false) Double enumQueryDouble) { // do some magic! return new ResponseEntity(HttpStatus.OK); } diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/api/FakeApiController.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/api/FakeApiController.java index 487414784a..72de87558b 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/api/FakeApiController.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/api/FakeApiController.java @@ -18,19 +18,12 @@ import org.springframework.web.bind.annotation.RequestPart; import org.springframework.web.multipart.MultipartFile; import java.util.List; -import com.fasterxml.jackson.databind.ObjectMapper; -import java.io.IOException; + import javax.validation.constraints.*; import javax.validation.Valid; @Controller public class FakeApiController implements FakeApi { - private final ObjectMapper objectMapper; - - public FakeApiController(ObjectMapper objectMapper) { - this.objectMapper = objectMapper; - } - private final FakeApiDelegate delegate; @org.springframework.beans.factory.annotation.Autowired @@ -38,8 +31,8 @@ public class FakeApiController implements FakeApi { this.delegate = delegate; } - public ResponseEntity testClientModel(@ApiParam(value = "client model" ,required=true ) @Valid @RequestBody Client body, - @RequestHeader("Accept") String accept) throws IOException { + + public ResponseEntity testClientModel(@ApiParam(value = "client model" ,required=true ) @Valid @RequestBody Client body) { // do some magic! return delegate.testClientModel(body); } @@ -57,8 +50,7 @@ public class FakeApiController implements FakeApi { @ApiParam(value = "None") @RequestPart(value="date", required=false) LocalDate date, @ApiParam(value = "None") @RequestPart(value="dateTime", required=false) OffsetDateTime dateTime, @ApiParam(value = "None") @RequestPart(value="password", required=false) String password, - @ApiParam(value = "None") @RequestPart(value="callback", required=false) String paramCallback, - @RequestHeader("Accept") String accept) { + @ApiParam(value = "None") @RequestPart(value="callback", required=false) String paramCallback) { // do some magic! return delegate.testEndpointParameters(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, string, binary, date, dateTime, password, paramCallback); } @@ -70,8 +62,7 @@ public class FakeApiController implements FakeApi { @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) { + @ApiParam(value = "Query parameter enum test (double)", allowableValues="1.1, -1.2") @RequestPart(value="enum_query_double", required=false) Double enumQueryDouble) { // do some magic! return delegate.testEnumParameters(enumFormStringArray, enumFormString, enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble); } diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/api/PetApi.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/api/PetApi.java index d9dc4d87b2..d9b7399573 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/api/PetApi.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/api/PetApi.java @@ -15,7 +15,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.*; @@ -32,11 +31,12 @@ public interface PetApi { }, tags={ "pet", }) @ApiResponses(value = { @ApiResponse(code = 405, message = "Invalid input", response = Void.class) }) + @RequestMapping(value = "/pet", produces = { "application/xml", "application/json" }, consumes = { "application/json", "application/xml" }, method = RequestMethod.POST) - default ResponseEntity addPet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody Pet body, @RequestHeader("Accept") String accept) { + default ResponseEntity addPet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody Pet body) { // do some magic! return new ResponseEntity(HttpStatus.OK); } @@ -50,10 +50,11 @@ public interface PetApi { }, tags={ "pet", }) @ApiResponses(value = { @ApiResponse(code = 400, message = "Invalid pet value", response = Void.class) }) + @RequestMapping(value = "/pet/{petId}", produces = { "application/xml", "application/json" }, method = RequestMethod.DELETE) - default ResponseEntity deletePet(@ApiParam(value = "Pet id to delete",required=true ) @PathVariable("petId") Long petId,@ApiParam(value = "" ) @RequestHeader(value="api_key", required=false) String apiKey, @RequestHeader("Accept") String accept) { + default ResponseEntity deletePet(@ApiParam(value = "Pet id to delete",required=true ) @PathVariable("petId") Long petId,@ApiParam(value = "" ) @RequestHeader(value="api_key", required=false) String apiKey) { // do some magic! return new ResponseEntity(HttpStatus.OK); } @@ -68,10 +69,11 @@ public interface PetApi { @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Pet.class), @ApiResponse(code = 400, message = "Invalid status value", response = Pet.class) }) + @RequestMapping(value = "/pet/findByStatus", produces = { "application/xml", "application/json" }, method = RequestMethod.GET) - default ResponseEntity> findPetsByStatus( @NotNull@ApiParam(value = "Status values that need to be considered for filter", required = true, allowableValues = "available, pending, sold") @RequestParam(value = "status", required = true) List status, @RequestHeader("Accept") String accept) throws IOException { + default ResponseEntity> findPetsByStatus( @NotNull@ApiParam(value = "Status values that need to be considered for filter", required = true, allowableValues = "available, pending, sold") @RequestParam(value = "status", required = true) List status) { // do some magic! return new ResponseEntity>(HttpStatus.OK); } @@ -86,10 +88,11 @@ public interface PetApi { @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Pet.class), @ApiResponse(code = 400, message = "Invalid tag value", response = Pet.class) }) + @RequestMapping(value = "/pet/findByTags", produces = { "application/xml", "application/json" }, method = RequestMethod.GET) - default ResponseEntity> findPetsByTags( @NotNull@ApiParam(value = "Tags to filter by", required = true) @RequestParam(value = "tags", required = true) List tags, @RequestHeader("Accept") String accept) throws IOException { + default ResponseEntity> findPetsByTags( @NotNull@ApiParam(value = "Tags to filter by", required = true) @RequestParam(value = "tags", required = true) List tags) { // do some magic! return new ResponseEntity>(HttpStatus.OK); } @@ -102,10 +105,11 @@ public interface PetApi { @ApiResponse(code = 200, message = "successful operation", response = Pet.class), @ApiResponse(code = 400, message = "Invalid ID supplied", response = Pet.class), @ApiResponse(code = 404, message = "Pet not found", response = Pet.class) }) + @RequestMapping(value = "/pet/{petId}", produces = { "application/xml", "application/json" }, method = RequestMethod.GET) - default ResponseEntity getPetById(@ApiParam(value = "ID of pet to return",required=true ) @PathVariable("petId") Long petId, @RequestHeader("Accept") String accept) throws IOException { + default ResponseEntity getPetById(@ApiParam(value = "ID of pet to return",required=true ) @PathVariable("petId") Long petId) { // do some magic! return new ResponseEntity(HttpStatus.OK); } @@ -121,11 +125,12 @@ public interface PetApi { @ApiResponse(code = 400, message = "Invalid ID supplied", response = Void.class), @ApiResponse(code = 404, message = "Pet not found", response = Void.class), @ApiResponse(code = 405, message = "Validation exception", response = Void.class) }) + @RequestMapping(value = "/pet", produces = { "application/xml", "application/json" }, consumes = { "application/json", "application/xml" }, method = RequestMethod.PUT) - default ResponseEntity updatePet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody Pet body, @RequestHeader("Accept") String accept) { + default ResponseEntity updatePet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody Pet body) { // do some magic! return new ResponseEntity(HttpStatus.OK); } @@ -139,11 +144,12 @@ public interface PetApi { }, tags={ "pet", }) @ApiResponses(value = { @ApiResponse(code = 405, message = "Invalid input", response = Void.class) }) + @RequestMapping(value = "/pet/{petId}", produces = { "application/xml", "application/json" }, consumes = { "application/x-www-form-urlencoded" }, method = RequestMethod.POST) - default ResponseEntity updatePetWithForm(@ApiParam(value = "ID of pet that needs to be updated",required=true ) @PathVariable("petId") Long petId,@ApiParam(value = "Updated name of the pet") @RequestPart(value="name", required=false) String name,@ApiParam(value = "Updated status of the pet") @RequestPart(value="status", required=false) String status, @RequestHeader("Accept") String accept) { + default ResponseEntity updatePetWithForm(@ApiParam(value = "ID of pet that needs to be updated",required=true ) @PathVariable("petId") Long petId,@ApiParam(value = "Updated name of the pet") @RequestPart(value="name", required=false) String name,@ApiParam(value = "Updated status of the pet") @RequestPart(value="status", required=false) String status) { // do some magic! return new ResponseEntity(HttpStatus.OK); } @@ -157,11 +163,12 @@ public interface PetApi { }, tags={ "pet", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = ModelApiResponse.class) }) + @RequestMapping(value = "/pet/{petId}/uploadImage", produces = { "application/json" }, consumes = { "multipart/form-data" }, method = RequestMethod.POST) - default ResponseEntity uploadFile(@ApiParam(value = "ID of pet to update",required=true ) @PathVariable("petId") Long petId,@ApiParam(value = "Additional data to pass to server") @RequestPart(value="additionalMetadata", required=false) String additionalMetadata,@ApiParam(value = "file detail") @RequestPart("file") MultipartFile file, @RequestHeader("Accept") String accept) throws IOException { + default ResponseEntity uploadFile(@ApiParam(value = "ID of pet to update",required=true ) @PathVariable("petId") Long petId,@ApiParam(value = "Additional data to pass to server") @RequestPart(value="additionalMetadata", required=false) String additionalMetadata,@ApiParam(value = "file detail") @RequestPart("file") MultipartFile file) { // do some magic! return new ResponseEntity(HttpStatus.OK); } diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/api/PetApiController.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/api/PetApiController.java index 7adec37e9b..e8c28faa9b 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/api/PetApiController.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/api/PetApiController.java @@ -17,19 +17,12 @@ import org.springframework.web.bind.annotation.RequestPart; import org.springframework.web.multipart.MultipartFile; import java.util.List; -import com.fasterxml.jackson.databind.ObjectMapper; -import java.io.IOException; + import javax.validation.constraints.*; import javax.validation.Valid; @Controller public class PetApiController implements PetApi { - private final ObjectMapper objectMapper; - - public PetApiController(ObjectMapper objectMapper) { - this.objectMapper = objectMapper; - } - private final PetApiDelegate delegate; @org.springframework.beans.factory.annotation.Autowired @@ -37,55 +30,48 @@ public class PetApiController implements PetApi { this.delegate = delegate; } - public ResponseEntity addPet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody Pet body, - @RequestHeader("Accept") String accept) { + + public ResponseEntity addPet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody Pet body) { // do some magic! return delegate.addPet(body); } public ResponseEntity deletePet(@ApiParam(value = "Pet id to delete",required=true ) @PathVariable("petId") Long petId, - @ApiParam(value = "" ) @RequestHeader(value="api_key", required=false) String apiKey, - @RequestHeader("Accept") String accept) { + @ApiParam(value = "" ) @RequestHeader(value="api_key", required=false) String apiKey) { // do some magic! return delegate.deletePet(petId, apiKey); } - 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 { + 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) { // do some magic! return delegate.findPetsByStatus(status); } - 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 { + public ResponseEntity> findPetsByTags( @NotNull@ApiParam(value = "Tags to filter by", required = true) @RequestParam(value = "tags", required = true) List tags) { // do some magic! return delegate.findPetsByTags(tags); } - public ResponseEntity getPetById(@ApiParam(value = "ID of pet to return",required=true ) @PathVariable("petId") Long petId, - @RequestHeader("Accept") String accept) throws IOException { + public ResponseEntity getPetById(@ApiParam(value = "ID of pet to return",required=true ) @PathVariable("petId") Long petId) { // do some magic! return delegate.getPetById(petId); } - public ResponseEntity updatePet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody Pet body, - @RequestHeader("Accept") String accept) { + public ResponseEntity updatePet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody Pet body) { // do some magic! return delegate.updatePet(body); } public ResponseEntity updatePetWithForm(@ApiParam(value = "ID of pet that needs to be updated",required=true ) @PathVariable("petId") Long petId, @ApiParam(value = "Updated name of the pet") @RequestPart(value="name", required=false) String name, - @ApiParam(value = "Updated status of the pet") @RequestPart(value="status", required=false) String status, - @RequestHeader("Accept") String accept) { + @ApiParam(value = "Updated status of the pet") @RequestPart(value="status", required=false) String status) { // do some magic! return delegate.updatePetWithForm(petId, name, status); } public ResponseEntity uploadFile(@ApiParam(value = "ID of pet to update",required=true ) @PathVariable("petId") Long petId, @ApiParam(value = "Additional data to pass to server") @RequestPart(value="additionalMetadata", required=false) String additionalMetadata, - @ApiParam(value = "file detail") @RequestPart("file") MultipartFile file, - @RequestHeader("Accept") String accept) throws IOException { + @ApiParam(value = "file detail") @RequestPart("file") MultipartFile file) { // do some magic! return delegate.uploadFile(petId, additionalMetadata, file); } diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/api/StoreApi.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/api/StoreApi.java index c10166a33f..c3745d9ec5 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/api/StoreApi.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/api/StoreApi.java @@ -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.*; @@ -27,10 +26,11 @@ public interface StoreApi { @ApiResponses(value = { @ApiResponse(code = 400, message = "Invalid ID supplied", response = Void.class), @ApiResponse(code = 404, message = "Order not found", response = Void.class) }) + @RequestMapping(value = "/store/order/{order_id}", produces = { "application/xml", "application/json" }, method = RequestMethod.DELETE) - default ResponseEntity deleteOrder(@ApiParam(value = "ID of the order that needs to be deleted",required=true ) @PathVariable("order_id") String orderId, @RequestHeader("Accept") String accept) { + default ResponseEntity deleteOrder(@ApiParam(value = "ID of the order that needs to be deleted",required=true ) @PathVariable("order_id") String orderId) { // do some magic! return new ResponseEntity(HttpStatus.OK); } @@ -41,10 +41,11 @@ public interface StoreApi { }, tags={ "store", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Integer.class) }) + @RequestMapping(value = "/store/inventory", produces = { "application/json" }, method = RequestMethod.GET) - default ResponseEntity> getInventory( @RequestHeader("Accept") String accept) throws IOException { + default ResponseEntity> getInventory() { // do some magic! return new ResponseEntity>(HttpStatus.OK); } @@ -55,10 +56,11 @@ public interface StoreApi { @ApiResponse(code = 200, message = "successful operation", response = Order.class), @ApiResponse(code = 400, message = "Invalid ID supplied", response = Order.class), @ApiResponse(code = 404, message = "Order not found", response = Order.class) }) + @RequestMapping(value = "/store/order/{order_id}", produces = { "application/xml", "application/json" }, method = RequestMethod.GET) - default ResponseEntity getOrderById( @Min(1) @Max(5)@ApiParam(value = "ID of pet that needs to be fetched",required=true ) @PathVariable("order_id") Long orderId, @RequestHeader("Accept") String accept) throws IOException { + default ResponseEntity getOrderById( @Min(1) @Max(5)@ApiParam(value = "ID of pet that needs to be fetched",required=true ) @PathVariable("order_id") Long orderId) { // do some magic! return new ResponseEntity(HttpStatus.OK); } @@ -68,10 +70,11 @@ public interface StoreApi { @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Order.class), @ApiResponse(code = 400, message = "Invalid Order", response = Order.class) }) + @RequestMapping(value = "/store/order", produces = { "application/xml", "application/json" }, method = RequestMethod.POST) - default ResponseEntity placeOrder(@ApiParam(value = "order placed for purchasing the pet" ,required=true ) @Valid @RequestBody Order body, @RequestHeader("Accept") String accept) throws IOException { + default ResponseEntity placeOrder(@ApiParam(value = "order placed for purchasing the pet" ,required=true ) @Valid @RequestBody Order body) { // do some magic! return new ResponseEntity(HttpStatus.OK); } diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/api/StoreApiController.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/api/StoreApiController.java index 4d0ff13f99..9ca8e80b31 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/api/StoreApiController.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/api/StoreApiController.java @@ -16,19 +16,12 @@ import org.springframework.web.bind.annotation.RequestPart; import org.springframework.web.multipart.MultipartFile; import java.util.List; -import com.fasterxml.jackson.databind.ObjectMapper; -import java.io.IOException; + import javax.validation.constraints.*; import javax.validation.Valid; @Controller public class StoreApiController implements StoreApi { - private final ObjectMapper objectMapper; - - public StoreApiController(ObjectMapper objectMapper) { - this.objectMapper = objectMapper; - } - private final StoreApiDelegate delegate; @org.springframework.beans.factory.annotation.Autowired @@ -36,25 +29,23 @@ public class StoreApiController implements StoreApi { this.delegate = delegate; } - public ResponseEntity deleteOrder(@ApiParam(value = "ID of the order that needs to be deleted",required=true ) @PathVariable("order_id") String orderId, - @RequestHeader("Accept") String accept) { + + public ResponseEntity deleteOrder(@ApiParam(value = "ID of the order that needs to be deleted",required=true ) @PathVariable("order_id") String orderId) { // do some magic! return delegate.deleteOrder(orderId); } - public ResponseEntity> getInventory(@RequestHeader("Accept") String accept) throws IOException { + public ResponseEntity> getInventory() { // do some magic! return delegate.getInventory(); } - public ResponseEntity getOrderById( @Min(1) @Max(5)@ApiParam(value = "ID of pet that needs to be fetched",required=true ) @PathVariable("order_id") Long orderId, - @RequestHeader("Accept") String accept) throws IOException { + public ResponseEntity getOrderById( @Min(1) @Max(5)@ApiParam(value = "ID of pet that needs to be fetched",required=true ) @PathVariable("order_id") Long orderId) { // do some magic! return delegate.getOrderById(orderId); } - public ResponseEntity placeOrder(@ApiParam(value = "order placed for purchasing the pet" ,required=true ) @Valid @RequestBody Order body, - @RequestHeader("Accept") String accept) throws IOException { + public ResponseEntity placeOrder(@ApiParam(value = "order placed for purchasing the pet" ,required=true ) @Valid @RequestBody Order body) { // do some magic! return delegate.placeOrder(body); } diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/api/UserApi.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/api/UserApi.java index 6642dec5ec..0b8c3e3107 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/api/UserApi.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/api/UserApi.java @@ -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.*; @@ -26,10 +25,11 @@ public interface UserApi { @ApiOperation(value = "Create user", notes = "This can only be done by the logged in user.", response = Void.class, tags={ "user", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Void.class) }) + @RequestMapping(value = "/user", produces = { "application/xml", "application/json" }, method = RequestMethod.POST) - default ResponseEntity createUser(@ApiParam(value = "Created user object" ,required=true ) @Valid @RequestBody User body, @RequestHeader("Accept") String accept) { + default ResponseEntity createUser(@ApiParam(value = "Created user object" ,required=true ) @Valid @RequestBody User body) { // do some magic! return new ResponseEntity(HttpStatus.OK); } @@ -38,10 +38,11 @@ public interface UserApi { @ApiOperation(value = "Creates list of users with given input array", notes = "", response = Void.class, tags={ "user", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Void.class) }) + @RequestMapping(value = "/user/createWithArray", produces = { "application/xml", "application/json" }, method = RequestMethod.POST) - default ResponseEntity createUsersWithArrayInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody List body, @RequestHeader("Accept") String accept) { + default ResponseEntity createUsersWithArrayInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody List body) { // do some magic! return new ResponseEntity(HttpStatus.OK); } @@ -50,10 +51,11 @@ public interface UserApi { @ApiOperation(value = "Creates list of users with given input array", notes = "", response = Void.class, tags={ "user", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Void.class) }) + @RequestMapping(value = "/user/createWithList", produces = { "application/xml", "application/json" }, method = RequestMethod.POST) - default ResponseEntity createUsersWithListInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody List body, @RequestHeader("Accept") String accept) { + default ResponseEntity createUsersWithListInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody List body) { // do some magic! return new ResponseEntity(HttpStatus.OK); } @@ -63,10 +65,11 @@ public interface UserApi { @ApiResponses(value = { @ApiResponse(code = 400, message = "Invalid username supplied", response = Void.class), @ApiResponse(code = 404, message = "User not found", response = Void.class) }) + @RequestMapping(value = "/user/{username}", produces = { "application/xml", "application/json" }, method = RequestMethod.DELETE) - default ResponseEntity deleteUser(@ApiParam(value = "The name that needs to be deleted",required=true ) @PathVariable("username") String username, @RequestHeader("Accept") String accept) { + default ResponseEntity deleteUser(@ApiParam(value = "The name that needs to be deleted",required=true ) @PathVariable("username") String username) { // do some magic! return new ResponseEntity(HttpStatus.OK); } @@ -77,10 +80,11 @@ public interface UserApi { @ApiResponse(code = 200, message = "successful operation", response = User.class), @ApiResponse(code = 400, message = "Invalid username supplied", response = User.class), @ApiResponse(code = 404, message = "User not found", response = User.class) }) + @RequestMapping(value = "/user/{username}", produces = { "application/xml", "application/json" }, method = RequestMethod.GET) - default ResponseEntity getUserByName(@ApiParam(value = "The name that needs to be fetched. Use user1 for testing. ",required=true ) @PathVariable("username") String username, @RequestHeader("Accept") String accept) throws IOException { + default ResponseEntity getUserByName(@ApiParam(value = "The name that needs to be fetched. Use user1 for testing. ",required=true ) @PathVariable("username") String username) { // do some magic! return new ResponseEntity(HttpStatus.OK); } @@ -90,10 +94,11 @@ public interface UserApi { @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = String.class), @ApiResponse(code = 400, message = "Invalid username/password supplied", response = String.class) }) + @RequestMapping(value = "/user/login", produces = { "application/xml", "application/json" }, method = RequestMethod.GET) - default ResponseEntity loginUser( @NotNull@ApiParam(value = "The user name for login", required = true) @RequestParam(value = "username", required = true) String username, @NotNull@ApiParam(value = "The password for login in clear text", required = true) @RequestParam(value = "password", required = true) String password, @RequestHeader("Accept") String accept) throws IOException { + default ResponseEntity loginUser( @NotNull@ApiParam(value = "The user name for login", required = true) @RequestParam(value = "username", required = true) String username, @NotNull@ApiParam(value = "The password for login in clear text", required = true) @RequestParam(value = "password", required = true) String password) { // do some magic! return new ResponseEntity(HttpStatus.OK); } @@ -102,10 +107,11 @@ public interface UserApi { @ApiOperation(value = "Logs out current logged in user session", notes = "", response = Void.class, tags={ "user", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Void.class) }) + @RequestMapping(value = "/user/logout", produces = { "application/xml", "application/json" }, method = RequestMethod.GET) - default ResponseEntity logoutUser( @RequestHeader("Accept") String accept) { + default ResponseEntity logoutUser() { // do some magic! return new ResponseEntity(HttpStatus.OK); } @@ -115,10 +121,11 @@ public interface UserApi { @ApiResponses(value = { @ApiResponse(code = 400, message = "Invalid user supplied", response = Void.class), @ApiResponse(code = 404, message = "User not found", response = Void.class) }) + @RequestMapping(value = "/user/{username}", produces = { "application/xml", "application/json" }, method = RequestMethod.PUT) - default ResponseEntity updateUser(@ApiParam(value = "name that need to be deleted",required=true ) @PathVariable("username") String username,@ApiParam(value = "Updated user object" ,required=true ) @Valid @RequestBody User body, @RequestHeader("Accept") String accept) { + default ResponseEntity updateUser(@ApiParam(value = "name that need to be deleted",required=true ) @PathVariable("username") String username,@ApiParam(value = "Updated user object" ,required=true ) @Valid @RequestBody User body) { // do some magic! return new ResponseEntity(HttpStatus.OK); } diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/api/UserApiController.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/api/UserApiController.java index 0264f9026a..468a1cee15 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/api/UserApiController.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/api/UserApiController.java @@ -16,19 +16,12 @@ import org.springframework.web.bind.annotation.RequestPart; import org.springframework.web.multipart.MultipartFile; import java.util.List; -import com.fasterxml.jackson.databind.ObjectMapper; -import java.io.IOException; + import javax.validation.constraints.*; import javax.validation.Valid; @Controller public class UserApiController implements UserApi { - private final ObjectMapper objectMapper; - - public UserApiController(ObjectMapper objectMapper) { - this.objectMapper = objectMapper; - } - private final UserApiDelegate delegate; @org.springframework.beans.factory.annotation.Autowired @@ -36,51 +29,45 @@ public class UserApiController implements UserApi { this.delegate = delegate; } - public ResponseEntity createUser(@ApiParam(value = "Created user object" ,required=true ) @Valid @RequestBody User body, - @RequestHeader("Accept") String accept) { + + public ResponseEntity createUser(@ApiParam(value = "Created user object" ,required=true ) @Valid @RequestBody User body) { // do some magic! return delegate.createUser(body); } - public ResponseEntity createUsersWithArrayInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody List body, - @RequestHeader("Accept") String accept) { + public ResponseEntity createUsersWithArrayInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody List body) { // do some magic! return delegate.createUsersWithArrayInput(body); } - public ResponseEntity createUsersWithListInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody List body, - @RequestHeader("Accept") String accept) { + public ResponseEntity createUsersWithListInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody List body) { // do some magic! return delegate.createUsersWithListInput(body); } - public ResponseEntity deleteUser(@ApiParam(value = "The name that needs to be deleted",required=true ) @PathVariable("username") String username, - @RequestHeader("Accept") String accept) { + public ResponseEntity deleteUser(@ApiParam(value = "The name that needs to be deleted",required=true ) @PathVariable("username") String username) { // do some magic! return delegate.deleteUser(username); } - public ResponseEntity getUserByName(@ApiParam(value = "The name that needs to be fetched. Use user1 for testing. ",required=true ) @PathVariable("username") String username, - @RequestHeader("Accept") String accept) throws IOException { + public ResponseEntity getUserByName(@ApiParam(value = "The name that needs to be fetched. Use user1 for testing. ",required=true ) @PathVariable("username") String username) { // do some magic! return delegate.getUserByName(username); } 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 { + @NotNull@ApiParam(value = "The password for login in clear text", required = true) @RequestParam(value = "password", required = true) String password) { // do some magic! return delegate.loginUser(username, password); } - public ResponseEntity logoutUser(@RequestHeader("Accept") String accept) { + public ResponseEntity logoutUser() { // do some magic! return delegate.logoutUser(); } public ResponseEntity updateUser(@ApiParam(value = "name that need to be deleted",required=true ) @PathVariable("username") String username, - @ApiParam(value = "Updated user object" ,required=true ) @Valid @RequestBody User body, - @RequestHeader("Accept") String accept) { + @ApiParam(value = "Updated user object" ,required=true ) @Valid @RequestBody User body) { // do some magic! return delegate.updateUser(username, body); } diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/AdditionalPropertiesClass.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/AdditionalPropertiesClass.java index 80be4236b0..532576aad8 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/AdditionalPropertiesClass.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/AdditionalPropertiesClass.java @@ -41,7 +41,7 @@ public class AdditionalPropertiesClass { **/ @ApiModelProperty(value = "") - @Valid + public Map getMapProperty() { return mapProperty; } @@ -70,6 +70,7 @@ public class AdditionalPropertiesClass { @ApiModelProperty(value = "") @Valid + public Map> getMapOfMapProperty() { return mapOfMapProperty; } diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/Animal.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/Animal.java index bc957d1c80..a59dc766c5 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/Animal.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/Animal.java @@ -38,7 +38,7 @@ public class Animal { @ApiModelProperty(required = true, value = "") @NotNull - @Valid + public String getClassName() { return className; } @@ -58,7 +58,7 @@ public class Animal { **/ @ApiModelProperty(value = "") - @Valid + public String getColor() { return color; } diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/ArrayOfArrayOfNumberOnly.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/ArrayOfArrayOfNumberOnly.java index f9dca7d60b..ecff36e416 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/ArrayOfArrayOfNumberOnly.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/ArrayOfArrayOfNumberOnly.java @@ -39,6 +39,7 @@ public class ArrayOfArrayOfNumberOnly { @ApiModelProperty(value = "") @Valid + public List> getArrayArrayNumber() { return arrayArrayNumber; } diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/ArrayOfNumberOnly.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/ArrayOfNumberOnly.java index e9c8a313be..a08ff749ee 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/ArrayOfNumberOnly.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/ArrayOfNumberOnly.java @@ -39,6 +39,7 @@ public class ArrayOfNumberOnly { @ApiModelProperty(value = "") @Valid + public List getArrayNumber() { return arrayNumber; } diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/ArrayTest.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/ArrayTest.java index 78c35d3c63..e9022fd028 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/ArrayTest.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/ArrayTest.java @@ -44,7 +44,7 @@ public class ArrayTest { **/ @ApiModelProperty(value = "") - @Valid + public List getArrayOfString() { return arrayOfString; } @@ -73,6 +73,7 @@ public class ArrayTest { @ApiModelProperty(value = "") @Valid + public List> getArrayArrayOfInteger() { return arrayArrayOfInteger; } @@ -101,6 +102,7 @@ public class ArrayTest { @ApiModelProperty(value = "") @Valid + public List> getArrayArrayOfModel() { return arrayArrayOfModel; } diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/Capitalization.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/Capitalization.java index 93533c2882..d59005adf1 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/Capitalization.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/Capitalization.java @@ -42,7 +42,7 @@ public class Capitalization { **/ @ApiModelProperty(value = "") - @Valid + public String getSmallCamel() { return smallCamel; } @@ -62,7 +62,7 @@ public class Capitalization { **/ @ApiModelProperty(value = "") - @Valid + public String getCapitalCamel() { return capitalCamel; } @@ -82,7 +82,7 @@ public class Capitalization { **/ @ApiModelProperty(value = "") - @Valid + public String getSmallSnake() { return smallSnake; } @@ -102,7 +102,7 @@ public class Capitalization { **/ @ApiModelProperty(value = "") - @Valid + public String getCapitalSnake() { return capitalSnake; } @@ -122,7 +122,7 @@ public class Capitalization { **/ @ApiModelProperty(value = "") - @Valid + public String getScAETHFlowPoints() { return scAETHFlowPoints; } @@ -142,7 +142,7 @@ public class Capitalization { **/ @ApiModelProperty(value = "Name of the pet ") - @Valid + public String getATTNAME() { return ATT_NAME; } diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/Cat.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/Cat.java index edcbc354be..28016fa5ad 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/Cat.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/Cat.java @@ -28,7 +28,7 @@ public class Cat extends Animal { **/ @ApiModelProperty(value = "") - @Valid + public Boolean getDeclawed() { return declawed; } diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/Category.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/Category.java index 6dd9cb7a2a..e2a67cf25d 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/Category.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/Category.java @@ -30,7 +30,7 @@ public class Category { **/ @ApiModelProperty(value = "") - @Valid + public Long getId() { return id; } @@ -50,7 +50,7 @@ public class Category { **/ @ApiModelProperty(value = "") - @Valid + public String getName() { return name; } diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/ClassModel.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/ClassModel.java index 6a6379f5b6..a5ef34a233 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/ClassModel.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/ClassModel.java @@ -28,7 +28,7 @@ public class ClassModel { **/ @ApiModelProperty(value = "") - @Valid + public String getPropertyClass() { return propertyClass; } diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/Client.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/Client.java index 3b8d16cabf..aaa03c570f 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/Client.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/Client.java @@ -27,7 +27,7 @@ public class Client { **/ @ApiModelProperty(value = "") - @Valid + public String getClient() { return client; } diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/Dog.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/Dog.java index 513131a9fa..8ebd0f46a6 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/Dog.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/Dog.java @@ -28,7 +28,7 @@ public class Dog extends Animal { **/ @ApiModelProperty(value = "") - @Valid + public String getBreed() { return breed; } diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/EnumArrays.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/EnumArrays.java index bbf4a3036e..4d79aa66c5 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/EnumArrays.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/EnumArrays.java @@ -95,7 +95,7 @@ public class EnumArrays { **/ @ApiModelProperty(value = "") - @Valid + public JustSymbolEnum getJustSymbol() { return justSymbol; } @@ -123,7 +123,7 @@ public class EnumArrays { **/ @ApiModelProperty(value = "") - @Valid + public List getArrayEnum() { return arrayEnum; } diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/EnumTest.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/EnumTest.java index c7e4793cdf..a072f99267 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/EnumTest.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/EnumTest.java @@ -133,7 +133,7 @@ public class EnumTest { **/ @ApiModelProperty(value = "") - @Valid + public EnumStringEnum getEnumString() { return enumString; } @@ -153,7 +153,7 @@ public class EnumTest { **/ @ApiModelProperty(value = "") - @Valid + public EnumIntegerEnum getEnumInteger() { return enumInteger; } @@ -173,7 +173,7 @@ public class EnumTest { **/ @ApiModelProperty(value = "") - @Valid + public EnumNumberEnum getEnumNumber() { return enumNumber; } @@ -194,6 +194,7 @@ public class EnumTest { @ApiModelProperty(value = "") @Valid + public OuterEnum getOuterEnum() { return outerEnum; } diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/FormatTest.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/FormatTest.java index f63a8de2c1..b5d0c2e250 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/FormatTest.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/FormatTest.java @@ -68,8 +68,8 @@ public class FormatTest { * @return integer **/ @ApiModelProperty(value = "") + @Min(10) @Max(100) - @Valid public Integer getInteger() { return integer; } @@ -90,8 +90,8 @@ public class FormatTest { * @return int32 **/ @ApiModelProperty(value = "") + @Min(20) @Max(200) - @Valid public Integer getInt32() { return int32; } @@ -111,7 +111,7 @@ public class FormatTest { **/ @ApiModelProperty(value = "") - @Valid + public Long getInt64() { return int64; } @@ -133,8 +133,9 @@ public class FormatTest { **/ @ApiModelProperty(required = true, value = "") @NotNull - @DecimalMin("32.1") @DecimalMax("543.2") + @Valid + @DecimalMin("32.1") @DecimalMax("543.2") public BigDecimal getNumber() { return number; } @@ -155,8 +156,8 @@ public class FormatTest { * @return _float **/ @ApiModelProperty(value = "") + @DecimalMin("54.3") @DecimalMax("987.6") - @Valid public Float getFloat() { return _float; } @@ -177,8 +178,8 @@ public class FormatTest { * @return _double **/ @ApiModelProperty(value = "") + @DecimalMin("67.8") @DecimalMax("123.4") - @Valid public Double getDouble() { return _double; } @@ -197,8 +198,8 @@ public class FormatTest { * @return string **/ @ApiModelProperty(value = "") + @Pattern(regexp="/[a-z]/i") - @Valid public String getString() { return string; } @@ -219,7 +220,7 @@ public class FormatTest { @ApiModelProperty(required = true, value = "") @NotNull - @Valid + public byte[] getByte() { return _byte; } @@ -239,7 +240,7 @@ public class FormatTest { **/ @ApiModelProperty(value = "") - @Valid + public byte[] getBinary() { return binary; } @@ -261,6 +262,7 @@ public class FormatTest { @NotNull @Valid + public LocalDate getDate() { return date; } @@ -281,6 +283,7 @@ public class FormatTest { @ApiModelProperty(value = "") @Valid + public OffsetDateTime getDateTime() { return dateTime; } @@ -301,6 +304,7 @@ public class FormatTest { @ApiModelProperty(value = "") @Valid + public UUID getUuid() { return uuid; } @@ -320,8 +324,8 @@ public class FormatTest { **/ @ApiModelProperty(required = true, value = "") @NotNull + @Size(min=10,max=64) - @Valid public String getPassword() { return password; } diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/HasOnlyReadOnly.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/HasOnlyReadOnly.java index 0f8b608e26..dc59cf9c78 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/HasOnlyReadOnly.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/HasOnlyReadOnly.java @@ -30,7 +30,7 @@ public class HasOnlyReadOnly { **/ @ApiModelProperty(readOnly = true, value = "") - @Valid + public String getBar() { return bar; } @@ -50,7 +50,7 @@ public class HasOnlyReadOnly { **/ @ApiModelProperty(readOnly = true, value = "") - @Valid + public String getFoo() { return foo; } diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/MapTest.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/MapTest.java index 1530a53f53..f179e8e423 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/MapTest.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/MapTest.java @@ -74,6 +74,7 @@ public class MapTest { @ApiModelProperty(value = "") @Valid + public Map> getMapMapOfString() { return mapMapOfString; } @@ -101,7 +102,7 @@ public class MapTest { **/ @ApiModelProperty(value = "") - @Valid + public Map getMapOfEnumString() { return mapOfEnumString; } diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/MixedPropertiesAndAdditionalPropertiesClass.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/MixedPropertiesAndAdditionalPropertiesClass.java index eafbcb4ecb..8848aaab32 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/MixedPropertiesAndAdditionalPropertiesClass.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/MixedPropertiesAndAdditionalPropertiesClass.java @@ -40,6 +40,7 @@ public class MixedPropertiesAndAdditionalPropertiesClass { @ApiModelProperty(value = "") @Valid + public UUID getUuid() { return uuid; } @@ -60,6 +61,7 @@ public class MixedPropertiesAndAdditionalPropertiesClass { @ApiModelProperty(value = "") @Valid + public OffsetDateTime getDateTime() { return dateTime; } @@ -88,6 +90,7 @@ public class MixedPropertiesAndAdditionalPropertiesClass { @ApiModelProperty(value = "") @Valid + public Map getMap() { return map; } diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/Model200Response.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/Model200Response.java index 97349fef05..c00e48ea6c 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/Model200Response.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/Model200Response.java @@ -31,7 +31,7 @@ public class Model200Response { **/ @ApiModelProperty(value = "") - @Valid + public Integer getName() { return name; } @@ -51,7 +51,7 @@ public class Model200Response { **/ @ApiModelProperty(value = "") - @Valid + public String getPropertyClass() { return propertyClass; } diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/ModelApiResponse.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/ModelApiResponse.java index c8882b3b1e..1df487b353 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/ModelApiResponse.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/ModelApiResponse.java @@ -33,7 +33,7 @@ public class ModelApiResponse { **/ @ApiModelProperty(value = "") - @Valid + public Integer getCode() { return code; } @@ -53,7 +53,7 @@ public class ModelApiResponse { **/ @ApiModelProperty(value = "") - @Valid + public String getType() { return type; } @@ -73,7 +73,7 @@ public class ModelApiResponse { **/ @ApiModelProperty(value = "") - @Valid + public String getMessage() { return message; } diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/ModelReturn.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/ModelReturn.java index 7018d7de09..3b05293b83 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/ModelReturn.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/ModelReturn.java @@ -28,7 +28,7 @@ public class ModelReturn { **/ @ApiModelProperty(value = "") - @Valid + public Integer getReturn() { return _return; } diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/Name.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/Name.java index 46069fdd14..a9835f910a 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/Name.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/Name.java @@ -38,7 +38,7 @@ public class Name { @ApiModelProperty(required = true, value = "") @NotNull - @Valid + public Integer getName() { return name; } @@ -58,7 +58,7 @@ public class Name { **/ @ApiModelProperty(readOnly = true, value = "") - @Valid + public Integer getSnakeCase() { return snakeCase; } @@ -78,7 +78,7 @@ public class Name { **/ @ApiModelProperty(value = "") - @Valid + public String getProperty() { return property; } @@ -98,7 +98,7 @@ public class Name { **/ @ApiModelProperty(readOnly = true, value = "") - @Valid + public Integer get123Number() { return _123Number; } diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/NumberOnly.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/NumberOnly.java index e243ecb429..a990653f20 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/NumberOnly.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/NumberOnly.java @@ -29,6 +29,7 @@ public class NumberOnly { @ApiModelProperty(value = "") @Valid + public BigDecimal getJustNumber() { return justNumber; } diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/Order.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/Order.java index e1a5d94cc8..1b5522ac6a 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/Order.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/Order.java @@ -77,7 +77,7 @@ public class Order { **/ @ApiModelProperty(value = "") - @Valid + public Long getId() { return id; } @@ -97,7 +97,7 @@ public class Order { **/ @ApiModelProperty(value = "") - @Valid + public Long getPetId() { return petId; } @@ -117,7 +117,7 @@ public class Order { **/ @ApiModelProperty(value = "") - @Valid + public Integer getQuantity() { return quantity; } @@ -138,6 +138,7 @@ public class Order { @ApiModelProperty(value = "") @Valid + public OffsetDateTime getShipDate() { return shipDate; } @@ -157,7 +158,7 @@ public class Order { **/ @ApiModelProperty(value = "Order Status") - @Valid + public StatusEnum getStatus() { return status; } @@ -177,7 +178,7 @@ public class Order { **/ @ApiModelProperty(value = "") - @Valid + public Boolean getComplete() { return complete; } diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/Pet.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/Pet.java index c84687b699..38d92a5b91 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/Pet.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/Pet.java @@ -80,7 +80,7 @@ public class Pet { **/ @ApiModelProperty(value = "") - @Valid + public Long getId() { return id; } @@ -101,6 +101,7 @@ public class Pet { @ApiModelProperty(value = "") @Valid + public Category getCategory() { return category; } @@ -121,7 +122,7 @@ public class Pet { @ApiModelProperty(example = "doggie", required = true, value = "") @NotNull - @Valid + public String getName() { return name; } @@ -147,7 +148,7 @@ public class Pet { @ApiModelProperty(required = true, value = "") @NotNull - @Valid + public List getPhotoUrls() { return photoUrls; } @@ -176,6 +177,7 @@ public class Pet { @ApiModelProperty(value = "") @Valid + public List getTags() { return tags; } @@ -195,7 +197,7 @@ public class Pet { **/ @ApiModelProperty(value = "pet status in the store") - @Valid + public StatusEnum getStatus() { return status; } diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/ReadOnlyFirst.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/ReadOnlyFirst.java index 8e79be0008..1ff292f185 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/ReadOnlyFirst.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/ReadOnlyFirst.java @@ -30,7 +30,7 @@ public class ReadOnlyFirst { **/ @ApiModelProperty(readOnly = true, value = "") - @Valid + public String getBar() { return bar; } @@ -50,7 +50,7 @@ public class ReadOnlyFirst { **/ @ApiModelProperty(value = "") - @Valid + public String getBaz() { return baz; } diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/SpecialModelName.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/SpecialModelName.java index 3cb7b04353..9eabbe3eca 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/SpecialModelName.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/SpecialModelName.java @@ -27,7 +27,7 @@ public class SpecialModelName { **/ @ApiModelProperty(value = "") - @Valid + public Long getSpecialPropertyName() { return specialPropertyName; } diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/Tag.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/Tag.java index 9f8f3a2523..b3d49a2dc6 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/Tag.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/Tag.java @@ -30,7 +30,7 @@ public class Tag { **/ @ApiModelProperty(value = "") - @Valid + public Long getId() { return id; } @@ -50,7 +50,7 @@ public class Tag { **/ @ApiModelProperty(value = "") - @Valid + public String getName() { return name; } diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/User.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/User.java index 501c556de2..ef3270b7af 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/User.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/User.java @@ -48,7 +48,7 @@ public class User { **/ @ApiModelProperty(value = "") - @Valid + public Long getId() { return id; } @@ -68,7 +68,7 @@ public class User { **/ @ApiModelProperty(value = "") - @Valid + public String getUsername() { return username; } @@ -88,7 +88,7 @@ public class User { **/ @ApiModelProperty(value = "") - @Valid + public String getFirstName() { return firstName; } @@ -108,7 +108,7 @@ public class User { **/ @ApiModelProperty(value = "") - @Valid + public String getLastName() { return lastName; } @@ -128,7 +128,7 @@ public class User { **/ @ApiModelProperty(value = "") - @Valid + public String getEmail() { return email; } @@ -148,7 +148,7 @@ public class User { **/ @ApiModelProperty(value = "") - @Valid + public String getPassword() { return password; } @@ -168,7 +168,7 @@ public class User { **/ @ApiModelProperty(value = "") - @Valid + public String getPhone() { return phone; } @@ -188,7 +188,7 @@ public class User { **/ @ApiModelProperty(value = "User Status") - @Valid + public Integer getUserStatus() { return userStatus; } diff --git a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/api/FakeApi.java b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/api/FakeApi.java index 8eefd6ed50..1e0e970766 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/api/FakeApi.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/api/FakeApi.java @@ -15,7 +15,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.*; @@ -27,11 +26,12 @@ public interface FakeApi { @ApiOperation(value = "To test \"client\" model", notes = "To test \"client\" model", response = Client.class, tags={ "fake", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Client.class) }) + @RequestMapping(value = "/fake", produces = { "application/json" }, consumes = { "application/json" }, method = RequestMethod.PATCH) - ResponseEntity testClientModel(@ApiParam(value = "client model" ,required=true ) @Valid @RequestBody Client body, @RequestHeader("Accept") String accept) throws IOException; + ResponseEntity testClientModel(@ApiParam(value = "client model" ,required=true ) @Valid @RequestBody Client body); @ApiOperation(value = "Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 ", notes = "Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 ", response = Void.class, authorizations = { @@ -40,21 +40,23 @@ public interface FakeApi { @ApiResponses(value = { @ApiResponse(code = 400, message = "Invalid username supplied", response = Void.class), @ApiResponse(code = 404, message = "User not found", response = Void.class) }) + @RequestMapping(value = "/fake", produces = { "application/xml; charset=utf-8", "application/json; charset=utf-8" }, consumes = { "application/xml; charset=utf-8", "application/json; charset=utf-8" }, method = RequestMethod.POST) - ResponseEntity testEndpointParameters(@ApiParam(value = "None", required=true) @RequestPart(value="number", required=true) BigDecimal number,@ApiParam(value = "None", required=true) @RequestPart(value="double", required=true) Double _double,@ApiParam(value = "None", required=true) @RequestPart(value="pattern_without_delimiter", required=true) String patternWithoutDelimiter,@ApiParam(value = "None", required=true) @RequestPart(value="byte", required=true) byte[] _byte,@ApiParam(value = "None") @RequestPart(value="integer", required=false) Integer integer,@ApiParam(value = "None") @RequestPart(value="int32", required=false) Integer int32,@ApiParam(value = "None") @RequestPart(value="int64", required=false) Long int64,@ApiParam(value = "None") @RequestPart(value="float", required=false) Float _float,@ApiParam(value = "None") @RequestPart(value="string", required=false) String string,@ApiParam(value = "None") @RequestPart(value="binary", required=false) byte[] binary,@ApiParam(value = "None") @RequestPart(value="date", required=false) LocalDate date,@ApiParam(value = "None") @RequestPart(value="dateTime", required=false) DateTime dateTime,@ApiParam(value = "None") @RequestPart(value="password", required=false) String password,@ApiParam(value = "None") @RequestPart(value="callback", required=false) String paramCallback, @RequestHeader("Accept") String accept); + ResponseEntity testEndpointParameters(@ApiParam(value = "None", required=true) @RequestPart(value="number", required=true) BigDecimal number,@ApiParam(value = "None", required=true) @RequestPart(value="double", required=true) Double _double,@ApiParam(value = "None", required=true) @RequestPart(value="pattern_without_delimiter", required=true) String patternWithoutDelimiter,@ApiParam(value = "None", required=true) @RequestPart(value="byte", required=true) byte[] _byte,@ApiParam(value = "None") @RequestPart(value="integer", required=false) Integer integer,@ApiParam(value = "None") @RequestPart(value="int32", required=false) Integer int32,@ApiParam(value = "None") @RequestPart(value="int64", required=false) Long int64,@ApiParam(value = "None") @RequestPart(value="float", required=false) Float _float,@ApiParam(value = "None") @RequestPart(value="string", required=false) String string,@ApiParam(value = "None") @RequestPart(value="binary", required=false) byte[] binary,@ApiParam(value = "None") @RequestPart(value="date", required=false) LocalDate date,@ApiParam(value = "None") @RequestPart(value="dateTime", required=false) DateTime dateTime,@ApiParam(value = "None") @RequestPart(value="password", required=false) String password,@ApiParam(value = "None") @RequestPart(value="callback", required=false) String paramCallback); @ApiOperation(value = "To test enum parameters", notes = "To test enum parameters", response = Void.class, tags={ "fake", }) @ApiResponses(value = { @ApiResponse(code = 400, message = "Invalid request", response = Void.class), @ApiResponse(code = 404, message = "Not found", response = Void.class) }) + @RequestMapping(value = "/fake", produces = { "*/*" }, consumes = { "*/*" }, method = RequestMethod.GET) - ResponseEntity testEnumParameters(@ApiParam(value = "Form parameter enum test (string array)", allowableValues=">, $") @RequestPart(value="enum_form_string_array", required=false) List enumFormStringArray,@ApiParam(value = "Form parameter enum test (string)", allowableValues="_abc, -efg, (xyz)", defaultValue="-efg") @RequestPart(value="enum_form_string", required=false) String enumFormString,@ApiParam(value = "Header parameter enum test (string array)" , allowableValues=">, $") @RequestHeader(value="enum_header_string_array", required=false) List enumHeaderStringArray,@ApiParam(value = "Header parameter enum test (string)" , allowableValues="_abc, -efg, (xyz)", defaultValue="-efg") @RequestHeader(value="enum_header_string", required=false) String enumHeaderString,@ApiParam(value = "Query parameter enum test (string array)", allowableValues = ">, $") @RequestParam(value = "enum_query_string_array", required = false) List enumQueryStringArray,@ApiParam(value = "Query parameter enum test (string)", allowableValues = "_abc, -efg, (xyz)", defaultValue = "-efg") @RequestParam(value = "enum_query_string", required = false, defaultValue="-efg") String enumQueryString,@ApiParam(value = "Query parameter enum test (double)", allowableValues = "1, -2") @RequestParam(value = "enum_query_integer", required = false) Integer enumQueryInteger,@ApiParam(value = "Query parameter enum test (double)", allowableValues="1.1, -1.2") @RequestPart(value="enum_query_double", required=false) Double enumQueryDouble, @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); } diff --git a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/api/FakeApiController.java b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/api/FakeApiController.java index 855d0b198c..29d67bb25e 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/api/FakeApiController.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/api/FakeApiController.java @@ -18,19 +18,12 @@ import org.springframework.web.bind.annotation.RequestPart; import org.springframework.web.multipart.MultipartFile; import java.util.List; -import com.fasterxml.jackson.databind.ObjectMapper; -import java.io.IOException; + import javax.validation.constraints.*; import javax.validation.Valid; @Controller public class FakeApiController implements FakeApi { - private final ObjectMapper objectMapper; - - public FakeApiController(ObjectMapper objectMapper) { - this.objectMapper = objectMapper; - } - private final FakeApiDelegate delegate; @org.springframework.beans.factory.annotation.Autowired @@ -38,8 +31,8 @@ public class FakeApiController implements FakeApi { this.delegate = delegate; } - public ResponseEntity testClientModel(@ApiParam(value = "client model" ,required=true ) @Valid @RequestBody Client body, - @RequestHeader("Accept") String accept) throws IOException { + + public ResponseEntity testClientModel(@ApiParam(value = "client model" ,required=true ) @Valid @RequestBody Client body) { // do some magic! return delegate.testClientModel(body); } @@ -57,8 +50,7 @@ public class FakeApiController implements FakeApi { @ApiParam(value = "None") @RequestPart(value="date", required=false) LocalDate date, @ApiParam(value = "None") @RequestPart(value="dateTime", required=false) DateTime dateTime, @ApiParam(value = "None") @RequestPart(value="password", required=false) String password, - @ApiParam(value = "None") @RequestPart(value="callback", required=false) String paramCallback, - @RequestHeader("Accept") String accept) { + @ApiParam(value = "None") @RequestPart(value="callback", required=false) String paramCallback) { // do some magic! return delegate.testEndpointParameters(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, string, binary, date, dateTime, password, paramCallback); } @@ -70,8 +62,7 @@ public class FakeApiController implements FakeApi { @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) { + @ApiParam(value = "Query parameter enum test (double)", allowableValues="1.1, -1.2") @RequestPart(value="enum_query_double", required=false) Double enumQueryDouble) { // do some magic! return delegate.testEnumParameters(enumFormStringArray, enumFormString, enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble); } diff --git a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/api/PetApi.java b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/api/PetApi.java index 1227aedbbd..9e5bad2b5a 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/api/PetApi.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/api/PetApi.java @@ -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.*; @@ -31,11 +30,12 @@ public interface PetApi { }, tags={ "pet", }) @ApiResponses(value = { @ApiResponse(code = 405, message = "Invalid input", response = Void.class) }) + @RequestMapping(value = "/pet", produces = { "application/xml", "application/json" }, consumes = { "application/json", "application/xml" }, method = RequestMethod.POST) - ResponseEntity addPet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody Pet body, @RequestHeader("Accept") String accept); + ResponseEntity addPet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody Pet body); @ApiOperation(value = "Deletes a pet", notes = "", response = Void.class, authorizations = { @@ -46,10 +46,11 @@ public interface PetApi { }, tags={ "pet", }) @ApiResponses(value = { @ApiResponse(code = 400, message = "Invalid pet value", response = Void.class) }) + @RequestMapping(value = "/pet/{petId}", produces = { "application/xml", "application/json" }, method = RequestMethod.DELETE) - ResponseEntity deletePet(@ApiParam(value = "Pet id to delete",required=true ) @PathVariable("petId") Long petId,@ApiParam(value = "" ) @RequestHeader(value="api_key", required=false) String apiKey, @RequestHeader("Accept") String accept); + ResponseEntity deletePet(@ApiParam(value = "Pet id to delete",required=true ) @PathVariable("petId") Long petId,@ApiParam(value = "" ) @RequestHeader(value="api_key", required=false) String apiKey); @ApiOperation(value = "Finds Pets by status", notes = "Multiple status values can be provided with comma separated strings", response = Pet.class, responseContainer = "List", authorizations = { @@ -61,10 +62,11 @@ public interface PetApi { @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Pet.class), @ApiResponse(code = 400, message = "Invalid status value", response = Pet.class) }) + @RequestMapping(value = "/pet/findByStatus", produces = { "application/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); @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 = { @@ -76,10 +78,11 @@ public interface PetApi { @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Pet.class), @ApiResponse(code = 400, message = "Invalid tag value", response = Pet.class) }) + @RequestMapping(value = "/pet/findByTags", produces = { "application/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); @ApiOperation(value = "Find pet by ID", notes = "Returns a single pet", response = Pet.class, authorizations = { @@ -89,10 +92,11 @@ public interface PetApi { @ApiResponse(code = 200, message = "successful operation", response = Pet.class), @ApiResponse(code = 400, message = "Invalid ID supplied", response = Pet.class), @ApiResponse(code = 404, message = "Pet not found", response = Pet.class) }) + @RequestMapping(value = "/pet/{petId}", produces = { "application/xml", "application/json" }, method = RequestMethod.GET) - ResponseEntity getPetById(@ApiParam(value = "ID of pet to return",required=true ) @PathVariable("petId") Long petId, @RequestHeader("Accept") String accept) throws IOException; + ResponseEntity getPetById(@ApiParam(value = "ID of pet to return",required=true ) @PathVariable("petId") Long petId); @ApiOperation(value = "Update an existing pet", notes = "", response = Void.class, authorizations = { @@ -105,11 +109,12 @@ public interface PetApi { @ApiResponse(code = 400, message = "Invalid ID supplied", response = Void.class), @ApiResponse(code = 404, message = "Pet not found", response = Void.class), @ApiResponse(code = 405, message = "Validation exception", response = Void.class) }) + @RequestMapping(value = "/pet", produces = { "application/xml", "application/json" }, consumes = { "application/json", "application/xml" }, method = RequestMethod.PUT) - ResponseEntity updatePet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody Pet body, @RequestHeader("Accept") String accept); + ResponseEntity updatePet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody Pet body); @ApiOperation(value = "Updates a pet in the store with form data", notes = "", response = Void.class, authorizations = { @@ -120,11 +125,12 @@ public interface PetApi { }, tags={ "pet", }) @ApiResponses(value = { @ApiResponse(code = 405, message = "Invalid input", response = Void.class) }) + @RequestMapping(value = "/pet/{petId}", produces = { "application/xml", "application/json" }, consumes = { "application/x-www-form-urlencoded" }, method = RequestMethod.POST) - ResponseEntity updatePetWithForm(@ApiParam(value = "ID of pet that needs to be updated",required=true ) @PathVariable("petId") Long petId,@ApiParam(value = "Updated name of the pet") @RequestPart(value="name", required=false) String name,@ApiParam(value = "Updated status of the pet") @RequestPart(value="status", required=false) String status, @RequestHeader("Accept") String accept); + ResponseEntity updatePetWithForm(@ApiParam(value = "ID of pet that needs to be updated",required=true ) @PathVariable("petId") Long petId,@ApiParam(value = "Updated name of the pet") @RequestPart(value="name", required=false) String name,@ApiParam(value = "Updated status of the pet") @RequestPart(value="status", required=false) String status); @ApiOperation(value = "uploads an image", notes = "", response = ModelApiResponse.class, authorizations = { @@ -135,10 +141,11 @@ public interface PetApi { }, tags={ "pet", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = ModelApiResponse.class) }) + @RequestMapping(value = "/pet/{petId}/uploadImage", produces = { "application/json" }, consumes = { "multipart/form-data" }, method = RequestMethod.POST) - ResponseEntity uploadFile(@ApiParam(value = "ID of pet to update",required=true ) @PathVariable("petId") Long petId,@ApiParam(value = "Additional data to pass to server") @RequestPart(value="additionalMetadata", required=false) String additionalMetadata,@ApiParam(value = "file detail") @RequestPart("file") MultipartFile file, @RequestHeader("Accept") String accept) throws IOException; + ResponseEntity uploadFile(@ApiParam(value = "ID of pet to update",required=true ) @PathVariable("petId") Long petId,@ApiParam(value = "Additional data to pass to server") @RequestPart(value="additionalMetadata", required=false) String additionalMetadata,@ApiParam(value = "file detail") @RequestPart("file") MultipartFile file); } diff --git a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/api/PetApiController.java b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/api/PetApiController.java index 7adec37e9b..e8c28faa9b 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/api/PetApiController.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/api/PetApiController.java @@ -17,19 +17,12 @@ import org.springframework.web.bind.annotation.RequestPart; import org.springframework.web.multipart.MultipartFile; import java.util.List; -import com.fasterxml.jackson.databind.ObjectMapper; -import java.io.IOException; + import javax.validation.constraints.*; import javax.validation.Valid; @Controller public class PetApiController implements PetApi { - private final ObjectMapper objectMapper; - - public PetApiController(ObjectMapper objectMapper) { - this.objectMapper = objectMapper; - } - private final PetApiDelegate delegate; @org.springframework.beans.factory.annotation.Autowired @@ -37,55 +30,48 @@ public class PetApiController implements PetApi { this.delegate = delegate; } - public ResponseEntity addPet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody Pet body, - @RequestHeader("Accept") String accept) { + + public ResponseEntity addPet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody Pet body) { // do some magic! return delegate.addPet(body); } public ResponseEntity deletePet(@ApiParam(value = "Pet id to delete",required=true ) @PathVariable("petId") Long petId, - @ApiParam(value = "" ) @RequestHeader(value="api_key", required=false) String apiKey, - @RequestHeader("Accept") String accept) { + @ApiParam(value = "" ) @RequestHeader(value="api_key", required=false) String apiKey) { // do some magic! return delegate.deletePet(petId, apiKey); } - 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 { + 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) { // do some magic! return delegate.findPetsByStatus(status); } - 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 { + public ResponseEntity> findPetsByTags( @NotNull@ApiParam(value = "Tags to filter by", required = true) @RequestParam(value = "tags", required = true) List tags) { // do some magic! return delegate.findPetsByTags(tags); } - public ResponseEntity getPetById(@ApiParam(value = "ID of pet to return",required=true ) @PathVariable("petId") Long petId, - @RequestHeader("Accept") String accept) throws IOException { + public ResponseEntity getPetById(@ApiParam(value = "ID of pet to return",required=true ) @PathVariable("petId") Long petId) { // do some magic! return delegate.getPetById(petId); } - public ResponseEntity updatePet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody Pet body, - @RequestHeader("Accept") String accept) { + public ResponseEntity updatePet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody Pet body) { // do some magic! return delegate.updatePet(body); } public ResponseEntity updatePetWithForm(@ApiParam(value = "ID of pet that needs to be updated",required=true ) @PathVariable("petId") Long petId, @ApiParam(value = "Updated name of the pet") @RequestPart(value="name", required=false) String name, - @ApiParam(value = "Updated status of the pet") @RequestPart(value="status", required=false) String status, - @RequestHeader("Accept") String accept) { + @ApiParam(value = "Updated status of the pet") @RequestPart(value="status", required=false) String status) { // do some magic! return delegate.updatePetWithForm(petId, name, status); } public ResponseEntity uploadFile(@ApiParam(value = "ID of pet to update",required=true ) @PathVariable("petId") Long petId, @ApiParam(value = "Additional data to pass to server") @RequestPart(value="additionalMetadata", required=false) String additionalMetadata, - @ApiParam(value = "file detail") @RequestPart("file") MultipartFile file, - @RequestHeader("Accept") String accept) throws IOException { + @ApiParam(value = "file detail") @RequestPart("file") MultipartFile file) { // do some magic! return delegate.uploadFile(petId, additionalMetadata, file); } diff --git a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/api/StoreApi.java b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/api/StoreApi.java index fb8f3d706f..8b080a440d 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/api/StoreApi.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/api/StoreApi.java @@ -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.*; @@ -26,10 +25,11 @@ public interface StoreApi { @ApiResponses(value = { @ApiResponse(code = 400, message = "Invalid ID supplied", response = Void.class), @ApiResponse(code = 404, message = "Order not found", response = Void.class) }) + @RequestMapping(value = "/store/order/{order_id}", produces = { "application/xml", "application/json" }, method = RequestMethod.DELETE) - ResponseEntity deleteOrder(@ApiParam(value = "ID of the order that needs to be deleted",required=true ) @PathVariable("order_id") String orderId, @RequestHeader("Accept") String accept); + ResponseEntity deleteOrder(@ApiParam(value = "ID of the order that needs to be deleted",required=true ) @PathVariable("order_id") String orderId); @ApiOperation(value = "Returns pet inventories by status", notes = "Returns a map of status codes to quantities", response = Integer.class, responseContainer = "Map", authorizations = { @@ -37,10 +37,11 @@ public interface StoreApi { }, tags={ "store", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Integer.class) }) + @RequestMapping(value = "/store/inventory", produces = { "application/json" }, method = RequestMethod.GET) - ResponseEntity> getInventory( @RequestHeader("Accept") String accept) throws IOException; + ResponseEntity> getInventory(); @ApiOperation(value = "Find purchase order by ID", notes = "For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions", response = Order.class, tags={ "store", }) @@ -48,19 +49,21 @@ public interface StoreApi { @ApiResponse(code = 200, message = "successful operation", response = Order.class), @ApiResponse(code = 400, message = "Invalid ID supplied", response = Order.class), @ApiResponse(code = 404, message = "Order not found", response = Order.class) }) + @RequestMapping(value = "/store/order/{order_id}", produces = { "application/xml", "application/json" }, method = RequestMethod.GET) - ResponseEntity getOrderById( @Min(1) @Max(5)@ApiParam(value = "ID of pet that needs to be fetched",required=true ) @PathVariable("order_id") Long orderId, @RequestHeader("Accept") String accept) throws IOException; + ResponseEntity getOrderById( @Min(1) @Max(5)@ApiParam(value = "ID of pet that needs to be fetched",required=true ) @PathVariable("order_id") Long orderId); @ApiOperation(value = "Place an order for a pet", notes = "", response = Order.class, tags={ "store", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Order.class), @ApiResponse(code = 400, message = "Invalid Order", response = Order.class) }) + @RequestMapping(value = "/store/order", produces = { "application/xml", "application/json" }, method = RequestMethod.POST) - ResponseEntity placeOrder(@ApiParam(value = "order placed for purchasing the pet" ,required=true ) @Valid @RequestBody Order body, @RequestHeader("Accept") String accept) throws IOException; + ResponseEntity placeOrder(@ApiParam(value = "order placed for purchasing the pet" ,required=true ) @Valid @RequestBody Order body); } diff --git a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/api/StoreApiController.java b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/api/StoreApiController.java index 4d0ff13f99..9ca8e80b31 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/api/StoreApiController.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/api/StoreApiController.java @@ -16,19 +16,12 @@ import org.springframework.web.bind.annotation.RequestPart; import org.springframework.web.multipart.MultipartFile; import java.util.List; -import com.fasterxml.jackson.databind.ObjectMapper; -import java.io.IOException; + import javax.validation.constraints.*; import javax.validation.Valid; @Controller public class StoreApiController implements StoreApi { - private final ObjectMapper objectMapper; - - public StoreApiController(ObjectMapper objectMapper) { - this.objectMapper = objectMapper; - } - private final StoreApiDelegate delegate; @org.springframework.beans.factory.annotation.Autowired @@ -36,25 +29,23 @@ public class StoreApiController implements StoreApi { this.delegate = delegate; } - public ResponseEntity deleteOrder(@ApiParam(value = "ID of the order that needs to be deleted",required=true ) @PathVariable("order_id") String orderId, - @RequestHeader("Accept") String accept) { + + public ResponseEntity deleteOrder(@ApiParam(value = "ID of the order that needs to be deleted",required=true ) @PathVariable("order_id") String orderId) { // do some magic! return delegate.deleteOrder(orderId); } - public ResponseEntity> getInventory(@RequestHeader("Accept") String accept) throws IOException { + public ResponseEntity> getInventory() { // do some magic! return delegate.getInventory(); } - public ResponseEntity getOrderById( @Min(1) @Max(5)@ApiParam(value = "ID of pet that needs to be fetched",required=true ) @PathVariable("order_id") Long orderId, - @RequestHeader("Accept") String accept) throws IOException { + public ResponseEntity getOrderById( @Min(1) @Max(5)@ApiParam(value = "ID of pet that needs to be fetched",required=true ) @PathVariable("order_id") Long orderId) { // do some magic! return delegate.getOrderById(orderId); } - public ResponseEntity placeOrder(@ApiParam(value = "order placed for purchasing the pet" ,required=true ) @Valid @RequestBody Order body, - @RequestHeader("Accept") String accept) throws IOException { + public ResponseEntity placeOrder(@ApiParam(value = "order placed for purchasing the pet" ,required=true ) @Valid @RequestBody Order body) { // do some magic! return delegate.placeOrder(body); } diff --git a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/api/UserApi.java b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/api/UserApi.java index adc0d21d30..55fe9faf68 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/api/UserApi.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/api/UserApi.java @@ -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.*; @@ -25,38 +24,42 @@ public interface UserApi { @ApiOperation(value = "Create user", notes = "This can only be done by the logged in user.", response = Void.class, tags={ "user", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Void.class) }) + @RequestMapping(value = "/user", produces = { "application/xml", "application/json" }, method = RequestMethod.POST) - ResponseEntity createUser(@ApiParam(value = "Created user object" ,required=true ) @Valid @RequestBody User body, @RequestHeader("Accept") String accept); + ResponseEntity createUser(@ApiParam(value = "Created user object" ,required=true ) @Valid @RequestBody User body); @ApiOperation(value = "Creates list of users with given input array", notes = "", response = Void.class, tags={ "user", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Void.class) }) + @RequestMapping(value = "/user/createWithArray", produces = { "application/xml", "application/json" }, method = RequestMethod.POST) - ResponseEntity createUsersWithArrayInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody List body, @RequestHeader("Accept") String accept); + ResponseEntity createUsersWithArrayInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody List body); @ApiOperation(value = "Creates list of users with given input array", notes = "", response = Void.class, tags={ "user", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Void.class) }) + @RequestMapping(value = "/user/createWithList", produces = { "application/xml", "application/json" }, method = RequestMethod.POST) - ResponseEntity createUsersWithListInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody List body, @RequestHeader("Accept") String accept); + ResponseEntity createUsersWithListInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody List body); @ApiOperation(value = "Delete user", notes = "This can only be done by the logged in user.", response = Void.class, tags={ "user", }) @ApiResponses(value = { @ApiResponse(code = 400, message = "Invalid username supplied", response = Void.class), @ApiResponse(code = 404, message = "User not found", response = Void.class) }) + @RequestMapping(value = "/user/{username}", produces = { "application/xml", "application/json" }, method = RequestMethod.DELETE) - ResponseEntity deleteUser(@ApiParam(value = "The name that needs to be deleted",required=true ) @PathVariable("username") String username, @RequestHeader("Accept") String accept); + ResponseEntity deleteUser(@ApiParam(value = "The name that needs to be deleted",required=true ) @PathVariable("username") String username); @ApiOperation(value = "Get user by user name", notes = "", response = User.class, tags={ "user", }) @@ -64,38 +67,42 @@ public interface UserApi { @ApiResponse(code = 200, message = "successful operation", response = User.class), @ApiResponse(code = 400, message = "Invalid username supplied", response = User.class), @ApiResponse(code = 404, message = "User not found", response = User.class) }) + @RequestMapping(value = "/user/{username}", produces = { "application/xml", "application/json" }, method = RequestMethod.GET) - ResponseEntity getUserByName(@ApiParam(value = "The name that needs to be fetched. Use user1 for testing. ",required=true ) @PathVariable("username") String username, @RequestHeader("Accept") String accept) throws IOException; + ResponseEntity getUserByName(@ApiParam(value = "The name that needs to be fetched. Use user1 for testing. ",required=true ) @PathVariable("username") String username); @ApiOperation(value = "Logs user into the system", notes = "", response = String.class, tags={ "user", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = String.class), @ApiResponse(code = 400, message = "Invalid username/password supplied", response = String.class) }) + @RequestMapping(value = "/user/login", produces = { "application/xml", "application/json" }, method = RequestMethod.GET) - ResponseEntity loginUser( @NotNull@ApiParam(value = "The user name for login", required = true) @RequestParam(value = "username", required = true) String username, @NotNull@ApiParam(value = "The password for login in clear text", required = true) @RequestParam(value = "password", required = true) String password, @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); @ApiOperation(value = "Logs out current logged in user session", notes = "", response = Void.class, tags={ "user", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Void.class) }) + @RequestMapping(value = "/user/logout", produces = { "application/xml", "application/json" }, method = RequestMethod.GET) - ResponseEntity logoutUser( @RequestHeader("Accept") String accept); + ResponseEntity logoutUser(); @ApiOperation(value = "Updated user", notes = "This can only be done by the logged in user.", response = Void.class, tags={ "user", }) @ApiResponses(value = { @ApiResponse(code = 400, message = "Invalid user supplied", response = Void.class), @ApiResponse(code = 404, message = "User not found", response = Void.class) }) + @RequestMapping(value = "/user/{username}", produces = { "application/xml", "application/json" }, method = RequestMethod.PUT) - ResponseEntity updateUser(@ApiParam(value = "name that need to be deleted",required=true ) @PathVariable("username") String username,@ApiParam(value = "Updated user object" ,required=true ) @Valid @RequestBody User body, @RequestHeader("Accept") String accept); + ResponseEntity updateUser(@ApiParam(value = "name that need to be deleted",required=true ) @PathVariable("username") String username,@ApiParam(value = "Updated user object" ,required=true ) @Valid @RequestBody User body); } diff --git a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/api/UserApiController.java b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/api/UserApiController.java index 0264f9026a..468a1cee15 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/api/UserApiController.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/api/UserApiController.java @@ -16,19 +16,12 @@ import org.springframework.web.bind.annotation.RequestPart; import org.springframework.web.multipart.MultipartFile; import java.util.List; -import com.fasterxml.jackson.databind.ObjectMapper; -import java.io.IOException; + import javax.validation.constraints.*; import javax.validation.Valid; @Controller public class UserApiController implements UserApi { - private final ObjectMapper objectMapper; - - public UserApiController(ObjectMapper objectMapper) { - this.objectMapper = objectMapper; - } - private final UserApiDelegate delegate; @org.springframework.beans.factory.annotation.Autowired @@ -36,51 +29,45 @@ public class UserApiController implements UserApi { this.delegate = delegate; } - public ResponseEntity createUser(@ApiParam(value = "Created user object" ,required=true ) @Valid @RequestBody User body, - @RequestHeader("Accept") String accept) { + + public ResponseEntity createUser(@ApiParam(value = "Created user object" ,required=true ) @Valid @RequestBody User body) { // do some magic! return delegate.createUser(body); } - public ResponseEntity createUsersWithArrayInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody List body, - @RequestHeader("Accept") String accept) { + public ResponseEntity createUsersWithArrayInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody List body) { // do some magic! return delegate.createUsersWithArrayInput(body); } - public ResponseEntity createUsersWithListInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody List body, - @RequestHeader("Accept") String accept) { + public ResponseEntity createUsersWithListInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody List body) { // do some magic! return delegate.createUsersWithListInput(body); } - public ResponseEntity deleteUser(@ApiParam(value = "The name that needs to be deleted",required=true ) @PathVariable("username") String username, - @RequestHeader("Accept") String accept) { + public ResponseEntity deleteUser(@ApiParam(value = "The name that needs to be deleted",required=true ) @PathVariable("username") String username) { // do some magic! return delegate.deleteUser(username); } - public ResponseEntity getUserByName(@ApiParam(value = "The name that needs to be fetched. Use user1 for testing. ",required=true ) @PathVariable("username") String username, - @RequestHeader("Accept") String accept) throws IOException { + public ResponseEntity getUserByName(@ApiParam(value = "The name that needs to be fetched. Use user1 for testing. ",required=true ) @PathVariable("username") String username) { // do some magic! return delegate.getUserByName(username); } 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 { + @NotNull@ApiParam(value = "The password for login in clear text", required = true) @RequestParam(value = "password", required = true) String password) { // do some magic! return delegate.loginUser(username, password); } - public ResponseEntity logoutUser(@RequestHeader("Accept") String accept) { + public ResponseEntity logoutUser() { // do some magic! return delegate.logoutUser(); } public ResponseEntity updateUser(@ApiParam(value = "name that need to be deleted",required=true ) @PathVariable("username") String username, - @ApiParam(value = "Updated user object" ,required=true ) @Valid @RequestBody User body, - @RequestHeader("Accept") String accept) { + @ApiParam(value = "Updated user object" ,required=true ) @Valid @RequestBody User body) { // do some magic! return delegate.updateUser(username, body); } diff --git a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/AdditionalPropertiesClass.java b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/AdditionalPropertiesClass.java index 80be4236b0..532576aad8 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/AdditionalPropertiesClass.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/AdditionalPropertiesClass.java @@ -41,7 +41,7 @@ public class AdditionalPropertiesClass { **/ @ApiModelProperty(value = "") - @Valid + public Map getMapProperty() { return mapProperty; } @@ -70,6 +70,7 @@ public class AdditionalPropertiesClass { @ApiModelProperty(value = "") @Valid + public Map> getMapOfMapProperty() { return mapOfMapProperty; } diff --git a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/Animal.java b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/Animal.java index bc957d1c80..a59dc766c5 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/Animal.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/Animal.java @@ -38,7 +38,7 @@ public class Animal { @ApiModelProperty(required = true, value = "") @NotNull - @Valid + public String getClassName() { return className; } @@ -58,7 +58,7 @@ public class Animal { **/ @ApiModelProperty(value = "") - @Valid + public String getColor() { return color; } diff --git a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/ArrayOfArrayOfNumberOnly.java b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/ArrayOfArrayOfNumberOnly.java index f9dca7d60b..ecff36e416 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/ArrayOfArrayOfNumberOnly.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/ArrayOfArrayOfNumberOnly.java @@ -39,6 +39,7 @@ public class ArrayOfArrayOfNumberOnly { @ApiModelProperty(value = "") @Valid + public List> getArrayArrayNumber() { return arrayArrayNumber; } diff --git a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/ArrayOfNumberOnly.java b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/ArrayOfNumberOnly.java index e9c8a313be..a08ff749ee 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/ArrayOfNumberOnly.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/ArrayOfNumberOnly.java @@ -39,6 +39,7 @@ public class ArrayOfNumberOnly { @ApiModelProperty(value = "") @Valid + public List getArrayNumber() { return arrayNumber; } diff --git a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/ArrayTest.java b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/ArrayTest.java index 78c35d3c63..e9022fd028 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/ArrayTest.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/ArrayTest.java @@ -44,7 +44,7 @@ public class ArrayTest { **/ @ApiModelProperty(value = "") - @Valid + public List getArrayOfString() { return arrayOfString; } @@ -73,6 +73,7 @@ public class ArrayTest { @ApiModelProperty(value = "") @Valid + public List> getArrayArrayOfInteger() { return arrayArrayOfInteger; } @@ -101,6 +102,7 @@ public class ArrayTest { @ApiModelProperty(value = "") @Valid + public List> getArrayArrayOfModel() { return arrayArrayOfModel; } diff --git a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/Capitalization.java b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/Capitalization.java index 93533c2882..d59005adf1 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/Capitalization.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/Capitalization.java @@ -42,7 +42,7 @@ public class Capitalization { **/ @ApiModelProperty(value = "") - @Valid + public String getSmallCamel() { return smallCamel; } @@ -62,7 +62,7 @@ public class Capitalization { **/ @ApiModelProperty(value = "") - @Valid + public String getCapitalCamel() { return capitalCamel; } @@ -82,7 +82,7 @@ public class Capitalization { **/ @ApiModelProperty(value = "") - @Valid + public String getSmallSnake() { return smallSnake; } @@ -102,7 +102,7 @@ public class Capitalization { **/ @ApiModelProperty(value = "") - @Valid + public String getCapitalSnake() { return capitalSnake; } @@ -122,7 +122,7 @@ public class Capitalization { **/ @ApiModelProperty(value = "") - @Valid + public String getScAETHFlowPoints() { return scAETHFlowPoints; } @@ -142,7 +142,7 @@ public class Capitalization { **/ @ApiModelProperty(value = "Name of the pet ") - @Valid + public String getATTNAME() { return ATT_NAME; } diff --git a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/Cat.java b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/Cat.java index edcbc354be..28016fa5ad 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/Cat.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/Cat.java @@ -28,7 +28,7 @@ public class Cat extends Animal { **/ @ApiModelProperty(value = "") - @Valid + public Boolean getDeclawed() { return declawed; } diff --git a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/Category.java b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/Category.java index 6dd9cb7a2a..e2a67cf25d 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/Category.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/Category.java @@ -30,7 +30,7 @@ public class Category { **/ @ApiModelProperty(value = "") - @Valid + public Long getId() { return id; } @@ -50,7 +50,7 @@ public class Category { **/ @ApiModelProperty(value = "") - @Valid + public String getName() { return name; } diff --git a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/ClassModel.java b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/ClassModel.java index 6a6379f5b6..a5ef34a233 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/ClassModel.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/ClassModel.java @@ -28,7 +28,7 @@ public class ClassModel { **/ @ApiModelProperty(value = "") - @Valid + public String getPropertyClass() { return propertyClass; } diff --git a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/Client.java b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/Client.java index 3b8d16cabf..aaa03c570f 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/Client.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/Client.java @@ -27,7 +27,7 @@ public class Client { **/ @ApiModelProperty(value = "") - @Valid + public String getClient() { return client; } diff --git a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/Dog.java b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/Dog.java index 513131a9fa..8ebd0f46a6 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/Dog.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/Dog.java @@ -28,7 +28,7 @@ public class Dog extends Animal { **/ @ApiModelProperty(value = "") - @Valid + public String getBreed() { return breed; } diff --git a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/EnumArrays.java b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/EnumArrays.java index bbf4a3036e..4d79aa66c5 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/EnumArrays.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/EnumArrays.java @@ -95,7 +95,7 @@ public class EnumArrays { **/ @ApiModelProperty(value = "") - @Valid + public JustSymbolEnum getJustSymbol() { return justSymbol; } @@ -123,7 +123,7 @@ public class EnumArrays { **/ @ApiModelProperty(value = "") - @Valid + public List getArrayEnum() { return arrayEnum; } diff --git a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/EnumTest.java b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/EnumTest.java index c7e4793cdf..a072f99267 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/EnumTest.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/EnumTest.java @@ -133,7 +133,7 @@ public class EnumTest { **/ @ApiModelProperty(value = "") - @Valid + public EnumStringEnum getEnumString() { return enumString; } @@ -153,7 +153,7 @@ public class EnumTest { **/ @ApiModelProperty(value = "") - @Valid + public EnumIntegerEnum getEnumInteger() { return enumInteger; } @@ -173,7 +173,7 @@ public class EnumTest { **/ @ApiModelProperty(value = "") - @Valid + public EnumNumberEnum getEnumNumber() { return enumNumber; } @@ -194,6 +194,7 @@ public class EnumTest { @ApiModelProperty(value = "") @Valid + public OuterEnum getOuterEnum() { return outerEnum; } diff --git a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/FormatTest.java b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/FormatTest.java index 9d6cf5cd4b..5ef3ec9215 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/FormatTest.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/FormatTest.java @@ -68,8 +68,8 @@ public class FormatTest { * @return integer **/ @ApiModelProperty(value = "") + @Min(10) @Max(100) - @Valid public Integer getInteger() { return integer; } @@ -90,8 +90,8 @@ public class FormatTest { * @return int32 **/ @ApiModelProperty(value = "") + @Min(20) @Max(200) - @Valid public Integer getInt32() { return int32; } @@ -111,7 +111,7 @@ public class FormatTest { **/ @ApiModelProperty(value = "") - @Valid + public Long getInt64() { return int64; } @@ -133,8 +133,9 @@ public class FormatTest { **/ @ApiModelProperty(required = true, value = "") @NotNull - @DecimalMin("32.1") @DecimalMax("543.2") + @Valid + @DecimalMin("32.1") @DecimalMax("543.2") public BigDecimal getNumber() { return number; } @@ -155,8 +156,8 @@ public class FormatTest { * @return _float **/ @ApiModelProperty(value = "") + @DecimalMin("54.3") @DecimalMax("987.6") - @Valid public Float getFloat() { return _float; } @@ -177,8 +178,8 @@ public class FormatTest { * @return _double **/ @ApiModelProperty(value = "") + @DecimalMin("67.8") @DecimalMax("123.4") - @Valid public Double getDouble() { return _double; } @@ -197,8 +198,8 @@ public class FormatTest { * @return string **/ @ApiModelProperty(value = "") + @Pattern(regexp="/[a-z]/i") - @Valid public String getString() { return string; } @@ -219,7 +220,7 @@ public class FormatTest { @ApiModelProperty(required = true, value = "") @NotNull - @Valid + public byte[] getByte() { return _byte; } @@ -239,7 +240,7 @@ public class FormatTest { **/ @ApiModelProperty(value = "") - @Valid + public byte[] getBinary() { return binary; } @@ -261,6 +262,7 @@ public class FormatTest { @NotNull @Valid + public LocalDate getDate() { return date; } @@ -281,6 +283,7 @@ public class FormatTest { @ApiModelProperty(value = "") @Valid + public DateTime getDateTime() { return dateTime; } @@ -301,6 +304,7 @@ public class FormatTest { @ApiModelProperty(value = "") @Valid + public UUID getUuid() { return uuid; } @@ -320,8 +324,8 @@ public class FormatTest { **/ @ApiModelProperty(required = true, value = "") @NotNull + @Size(min=10,max=64) - @Valid public String getPassword() { return password; } diff --git a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/HasOnlyReadOnly.java b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/HasOnlyReadOnly.java index 0f8b608e26..dc59cf9c78 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/HasOnlyReadOnly.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/HasOnlyReadOnly.java @@ -30,7 +30,7 @@ public class HasOnlyReadOnly { **/ @ApiModelProperty(readOnly = true, value = "") - @Valid + public String getBar() { return bar; } @@ -50,7 +50,7 @@ public class HasOnlyReadOnly { **/ @ApiModelProperty(readOnly = true, value = "") - @Valid + public String getFoo() { return foo; } diff --git a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/MapTest.java b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/MapTest.java index 1530a53f53..f179e8e423 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/MapTest.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/MapTest.java @@ -74,6 +74,7 @@ public class MapTest { @ApiModelProperty(value = "") @Valid + public Map> getMapMapOfString() { return mapMapOfString; } @@ -101,7 +102,7 @@ public class MapTest { **/ @ApiModelProperty(value = "") - @Valid + public Map getMapOfEnumString() { return mapOfEnumString; } diff --git a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/MixedPropertiesAndAdditionalPropertiesClass.java b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/MixedPropertiesAndAdditionalPropertiesClass.java index d4cd89cef3..d25bba89a9 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/MixedPropertiesAndAdditionalPropertiesClass.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/MixedPropertiesAndAdditionalPropertiesClass.java @@ -40,6 +40,7 @@ public class MixedPropertiesAndAdditionalPropertiesClass { @ApiModelProperty(value = "") @Valid + public UUID getUuid() { return uuid; } @@ -60,6 +61,7 @@ public class MixedPropertiesAndAdditionalPropertiesClass { @ApiModelProperty(value = "") @Valid + public DateTime getDateTime() { return dateTime; } @@ -88,6 +90,7 @@ public class MixedPropertiesAndAdditionalPropertiesClass { @ApiModelProperty(value = "") @Valid + public Map getMap() { return map; } diff --git a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/Model200Response.java b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/Model200Response.java index 97349fef05..c00e48ea6c 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/Model200Response.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/Model200Response.java @@ -31,7 +31,7 @@ public class Model200Response { **/ @ApiModelProperty(value = "") - @Valid + public Integer getName() { return name; } @@ -51,7 +51,7 @@ public class Model200Response { **/ @ApiModelProperty(value = "") - @Valid + public String getPropertyClass() { return propertyClass; } diff --git a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/ModelApiResponse.java b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/ModelApiResponse.java index c8882b3b1e..1df487b353 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/ModelApiResponse.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/ModelApiResponse.java @@ -33,7 +33,7 @@ public class ModelApiResponse { **/ @ApiModelProperty(value = "") - @Valid + public Integer getCode() { return code; } @@ -53,7 +53,7 @@ public class ModelApiResponse { **/ @ApiModelProperty(value = "") - @Valid + public String getType() { return type; } @@ -73,7 +73,7 @@ public class ModelApiResponse { **/ @ApiModelProperty(value = "") - @Valid + public String getMessage() { return message; } diff --git a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/ModelReturn.java b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/ModelReturn.java index 7018d7de09..3b05293b83 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/ModelReturn.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/ModelReturn.java @@ -28,7 +28,7 @@ public class ModelReturn { **/ @ApiModelProperty(value = "") - @Valid + public Integer getReturn() { return _return; } diff --git a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/Name.java b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/Name.java index 46069fdd14..a9835f910a 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/Name.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/Name.java @@ -38,7 +38,7 @@ public class Name { @ApiModelProperty(required = true, value = "") @NotNull - @Valid + public Integer getName() { return name; } @@ -58,7 +58,7 @@ public class Name { **/ @ApiModelProperty(readOnly = true, value = "") - @Valid + public Integer getSnakeCase() { return snakeCase; } @@ -78,7 +78,7 @@ public class Name { **/ @ApiModelProperty(value = "") - @Valid + public String getProperty() { return property; } @@ -98,7 +98,7 @@ public class Name { **/ @ApiModelProperty(readOnly = true, value = "") - @Valid + public Integer get123Number() { return _123Number; } diff --git a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/NumberOnly.java b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/NumberOnly.java index e243ecb429..a990653f20 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/NumberOnly.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/NumberOnly.java @@ -29,6 +29,7 @@ public class NumberOnly { @ApiModelProperty(value = "") @Valid + public BigDecimal getJustNumber() { return justNumber; } diff --git a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/Order.java b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/Order.java index 4106ac3619..5bfcf28b3e 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/Order.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/Order.java @@ -77,7 +77,7 @@ public class Order { **/ @ApiModelProperty(value = "") - @Valid + public Long getId() { return id; } @@ -97,7 +97,7 @@ public class Order { **/ @ApiModelProperty(value = "") - @Valid + public Long getPetId() { return petId; } @@ -117,7 +117,7 @@ public class Order { **/ @ApiModelProperty(value = "") - @Valid + public Integer getQuantity() { return quantity; } @@ -138,6 +138,7 @@ public class Order { @ApiModelProperty(value = "") @Valid + public DateTime getShipDate() { return shipDate; } @@ -157,7 +158,7 @@ public class Order { **/ @ApiModelProperty(value = "Order Status") - @Valid + public StatusEnum getStatus() { return status; } @@ -177,7 +178,7 @@ public class Order { **/ @ApiModelProperty(value = "") - @Valid + public Boolean getComplete() { return complete; } diff --git a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/Pet.java b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/Pet.java index c84687b699..38d92a5b91 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/Pet.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/Pet.java @@ -80,7 +80,7 @@ public class Pet { **/ @ApiModelProperty(value = "") - @Valid + public Long getId() { return id; } @@ -101,6 +101,7 @@ public class Pet { @ApiModelProperty(value = "") @Valid + public Category getCategory() { return category; } @@ -121,7 +122,7 @@ public class Pet { @ApiModelProperty(example = "doggie", required = true, value = "") @NotNull - @Valid + public String getName() { return name; } @@ -147,7 +148,7 @@ public class Pet { @ApiModelProperty(required = true, value = "") @NotNull - @Valid + public List getPhotoUrls() { return photoUrls; } @@ -176,6 +177,7 @@ public class Pet { @ApiModelProperty(value = "") @Valid + public List getTags() { return tags; } @@ -195,7 +197,7 @@ public class Pet { **/ @ApiModelProperty(value = "pet status in the store") - @Valid + public StatusEnum getStatus() { return status; } diff --git a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/ReadOnlyFirst.java b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/ReadOnlyFirst.java index 8e79be0008..1ff292f185 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/ReadOnlyFirst.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/ReadOnlyFirst.java @@ -30,7 +30,7 @@ public class ReadOnlyFirst { **/ @ApiModelProperty(readOnly = true, value = "") - @Valid + public String getBar() { return bar; } @@ -50,7 +50,7 @@ public class ReadOnlyFirst { **/ @ApiModelProperty(value = "") - @Valid + public String getBaz() { return baz; } diff --git a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/SpecialModelName.java b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/SpecialModelName.java index 3cb7b04353..9eabbe3eca 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/SpecialModelName.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/SpecialModelName.java @@ -27,7 +27,7 @@ public class SpecialModelName { **/ @ApiModelProperty(value = "") - @Valid + public Long getSpecialPropertyName() { return specialPropertyName; } diff --git a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/Tag.java b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/Tag.java index 9f8f3a2523..b3d49a2dc6 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/Tag.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/Tag.java @@ -30,7 +30,7 @@ public class Tag { **/ @ApiModelProperty(value = "") - @Valid + public Long getId() { return id; } @@ -50,7 +50,7 @@ public class Tag { **/ @ApiModelProperty(value = "") - @Valid + public String getName() { return name; } diff --git a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/User.java b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/User.java index 501c556de2..ef3270b7af 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/User.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/User.java @@ -48,7 +48,7 @@ public class User { **/ @ApiModelProperty(value = "") - @Valid + public Long getId() { return id; } @@ -68,7 +68,7 @@ public class User { **/ @ApiModelProperty(value = "") - @Valid + public String getUsername() { return username; } @@ -88,7 +88,7 @@ public class User { **/ @ApiModelProperty(value = "") - @Valid + public String getFirstName() { return firstName; } @@ -108,7 +108,7 @@ public class User { **/ @ApiModelProperty(value = "") - @Valid + public String getLastName() { return lastName; } @@ -128,7 +128,7 @@ public class User { **/ @ApiModelProperty(value = "") - @Valid + public String getEmail() { return email; } @@ -148,7 +148,7 @@ public class User { **/ @ApiModelProperty(value = "") - @Valid + public String getPassword() { return password; } @@ -168,7 +168,7 @@ public class User { **/ @ApiModelProperty(value = "") - @Valid + public String getPhone() { return phone; } @@ -188,7 +188,7 @@ public class User { **/ @ApiModelProperty(value = "User Status") - @Valid + public Integer getUserStatus() { return userStatus; } diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/api/FakeApi.java b/samples/server/petstore/springboot/src/main/java/io/swagger/api/FakeApi.java index 8eefd6ed50..1e0e970766 100644 --- a/samples/server/petstore/springboot/src/main/java/io/swagger/api/FakeApi.java +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/api/FakeApi.java @@ -15,7 +15,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.*; @@ -27,11 +26,12 @@ public interface FakeApi { @ApiOperation(value = "To test \"client\" model", notes = "To test \"client\" model", response = Client.class, tags={ "fake", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Client.class) }) + @RequestMapping(value = "/fake", produces = { "application/json" }, consumes = { "application/json" }, method = RequestMethod.PATCH) - ResponseEntity testClientModel(@ApiParam(value = "client model" ,required=true ) @Valid @RequestBody Client body, @RequestHeader("Accept") String accept) throws IOException; + ResponseEntity testClientModel(@ApiParam(value = "client model" ,required=true ) @Valid @RequestBody Client body); @ApiOperation(value = "Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 ", notes = "Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 ", response = Void.class, authorizations = { @@ -40,21 +40,23 @@ public interface FakeApi { @ApiResponses(value = { @ApiResponse(code = 400, message = "Invalid username supplied", response = Void.class), @ApiResponse(code = 404, message = "User not found", response = Void.class) }) + @RequestMapping(value = "/fake", produces = { "application/xml; charset=utf-8", "application/json; charset=utf-8" }, consumes = { "application/xml; charset=utf-8", "application/json; charset=utf-8" }, method = RequestMethod.POST) - ResponseEntity testEndpointParameters(@ApiParam(value = "None", required=true) @RequestPart(value="number", required=true) BigDecimal number,@ApiParam(value = "None", required=true) @RequestPart(value="double", required=true) Double _double,@ApiParam(value = "None", required=true) @RequestPart(value="pattern_without_delimiter", required=true) String patternWithoutDelimiter,@ApiParam(value = "None", required=true) @RequestPart(value="byte", required=true) byte[] _byte,@ApiParam(value = "None") @RequestPart(value="integer", required=false) Integer integer,@ApiParam(value = "None") @RequestPart(value="int32", required=false) Integer int32,@ApiParam(value = "None") @RequestPart(value="int64", required=false) Long int64,@ApiParam(value = "None") @RequestPart(value="float", required=false) Float _float,@ApiParam(value = "None") @RequestPart(value="string", required=false) String string,@ApiParam(value = "None") @RequestPart(value="binary", required=false) byte[] binary,@ApiParam(value = "None") @RequestPart(value="date", required=false) LocalDate date,@ApiParam(value = "None") @RequestPart(value="dateTime", required=false) DateTime dateTime,@ApiParam(value = "None") @RequestPart(value="password", required=false) String password,@ApiParam(value = "None") @RequestPart(value="callback", required=false) String paramCallback, @RequestHeader("Accept") String accept); + ResponseEntity testEndpointParameters(@ApiParam(value = "None", required=true) @RequestPart(value="number", required=true) BigDecimal number,@ApiParam(value = "None", required=true) @RequestPart(value="double", required=true) Double _double,@ApiParam(value = "None", required=true) @RequestPart(value="pattern_without_delimiter", required=true) String patternWithoutDelimiter,@ApiParam(value = "None", required=true) @RequestPart(value="byte", required=true) byte[] _byte,@ApiParam(value = "None") @RequestPart(value="integer", required=false) Integer integer,@ApiParam(value = "None") @RequestPart(value="int32", required=false) Integer int32,@ApiParam(value = "None") @RequestPart(value="int64", required=false) Long int64,@ApiParam(value = "None") @RequestPart(value="float", required=false) Float _float,@ApiParam(value = "None") @RequestPart(value="string", required=false) String string,@ApiParam(value = "None") @RequestPart(value="binary", required=false) byte[] binary,@ApiParam(value = "None") @RequestPart(value="date", required=false) LocalDate date,@ApiParam(value = "None") @RequestPart(value="dateTime", required=false) DateTime dateTime,@ApiParam(value = "None") @RequestPart(value="password", required=false) String password,@ApiParam(value = "None") @RequestPart(value="callback", required=false) String paramCallback); @ApiOperation(value = "To test enum parameters", notes = "To test enum parameters", response = Void.class, tags={ "fake", }) @ApiResponses(value = { @ApiResponse(code = 400, message = "Invalid request", response = Void.class), @ApiResponse(code = 404, message = "Not found", response = Void.class) }) + @RequestMapping(value = "/fake", produces = { "*/*" }, consumes = { "*/*" }, method = RequestMethod.GET) - ResponseEntity testEnumParameters(@ApiParam(value = "Form parameter enum test (string array)", allowableValues=">, $") @RequestPart(value="enum_form_string_array", required=false) List enumFormStringArray,@ApiParam(value = "Form parameter enum test (string)", allowableValues="_abc, -efg, (xyz)", defaultValue="-efg") @RequestPart(value="enum_form_string", required=false) String enumFormString,@ApiParam(value = "Header parameter enum test (string array)" , allowableValues=">, $") @RequestHeader(value="enum_header_string_array", required=false) List enumHeaderStringArray,@ApiParam(value = "Header parameter enum test (string)" , allowableValues="_abc, -efg, (xyz)", defaultValue="-efg") @RequestHeader(value="enum_header_string", required=false) String enumHeaderString,@ApiParam(value = "Query parameter enum test (string array)", allowableValues = ">, $") @RequestParam(value = "enum_query_string_array", required = false) List enumQueryStringArray,@ApiParam(value = "Query parameter enum test (string)", allowableValues = "_abc, -efg, (xyz)", defaultValue = "-efg") @RequestParam(value = "enum_query_string", required = false, defaultValue="-efg") String enumQueryString,@ApiParam(value = "Query parameter enum test (double)", allowableValues = "1, -2") @RequestParam(value = "enum_query_integer", required = false) Integer enumQueryInteger,@ApiParam(value = "Query parameter enum test (double)", allowableValues="1.1, -1.2") @RequestPart(value="enum_query_double", required=false) Double enumQueryDouble, @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); } diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/api/FakeApiController.java b/samples/server/petstore/springboot/src/main/java/io/swagger/api/FakeApiController.java index bc079bf629..9edc15a4fc 100644 --- a/samples/server/petstore/springboot/src/main/java/io/swagger/api/FakeApiController.java +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/api/FakeApiController.java @@ -18,27 +18,17 @@ import org.springframework.web.bind.annotation.RequestPart; import org.springframework.web.multipart.MultipartFile; import java.util.List; -import com.fasterxml.jackson.databind.ObjectMapper; -import java.io.IOException; + import javax.validation.constraints.*; import javax.validation.Valid; @Controller public class FakeApiController implements FakeApi { - private final ObjectMapper objectMapper; - public FakeApiController(ObjectMapper objectMapper) { - this.objectMapper = objectMapper; - } - public ResponseEntity testClientModel(@ApiParam(value = "client model" ,required=true ) @Valid @RequestBody Client body, - @RequestHeader("Accept") String accept) throws IOException { + + public ResponseEntity testClientModel(@ApiParam(value = "client model" ,required=true ) @Valid @RequestBody Client body) { // do some magic! - - if (accept != null && accept.contains("application/json")) { - return new ResponseEntity(objectMapper.readValue("{ \"client\" : \"aeiou\"}", Client.class), HttpStatus.OK); - } - return new ResponseEntity(HttpStatus.OK); } @@ -55,8 +45,7 @@ public class FakeApiController implements FakeApi { @ApiParam(value = "None") @RequestPart(value="date", required=false) LocalDate date, @ApiParam(value = "None") @RequestPart(value="dateTime", required=false) DateTime dateTime, @ApiParam(value = "None") @RequestPart(value="password", required=false) String password, - @ApiParam(value = "None") @RequestPart(value="callback", required=false) String paramCallback, - @RequestHeader("Accept") String accept) { + @ApiParam(value = "None") @RequestPart(value="callback", required=false) String paramCallback) { // do some magic! return new ResponseEntity(HttpStatus.OK); } @@ -68,8 +57,7 @@ public class FakeApiController implements FakeApi { @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) { + @ApiParam(value = "Query parameter enum test (double)", allowableValues="1.1, -1.2") @RequestPart(value="enum_query_double", required=false) Double enumQueryDouble) { // do some magic! return new ResponseEntity(HttpStatus.OK); } diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/api/PetApi.java b/samples/server/petstore/springboot/src/main/java/io/swagger/api/PetApi.java index 1227aedbbd..9e5bad2b5a 100644 --- a/samples/server/petstore/springboot/src/main/java/io/swagger/api/PetApi.java +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/api/PetApi.java @@ -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.*; @@ -31,11 +30,12 @@ public interface PetApi { }, tags={ "pet", }) @ApiResponses(value = { @ApiResponse(code = 405, message = "Invalid input", response = Void.class) }) + @RequestMapping(value = "/pet", produces = { "application/xml", "application/json" }, consumes = { "application/json", "application/xml" }, method = RequestMethod.POST) - ResponseEntity addPet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody Pet body, @RequestHeader("Accept") String accept); + ResponseEntity addPet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody Pet body); @ApiOperation(value = "Deletes a pet", notes = "", response = Void.class, authorizations = { @@ -46,10 +46,11 @@ public interface PetApi { }, tags={ "pet", }) @ApiResponses(value = { @ApiResponse(code = 400, message = "Invalid pet value", response = Void.class) }) + @RequestMapping(value = "/pet/{petId}", produces = { "application/xml", "application/json" }, method = RequestMethod.DELETE) - ResponseEntity deletePet(@ApiParam(value = "Pet id to delete",required=true ) @PathVariable("petId") Long petId,@ApiParam(value = "" ) @RequestHeader(value="api_key", required=false) String apiKey, @RequestHeader("Accept") String accept); + ResponseEntity deletePet(@ApiParam(value = "Pet id to delete",required=true ) @PathVariable("petId") Long petId,@ApiParam(value = "" ) @RequestHeader(value="api_key", required=false) String apiKey); @ApiOperation(value = "Finds Pets by status", notes = "Multiple status values can be provided with comma separated strings", response = Pet.class, responseContainer = "List", authorizations = { @@ -61,10 +62,11 @@ public interface PetApi { @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Pet.class), @ApiResponse(code = 400, message = "Invalid status value", response = Pet.class) }) + @RequestMapping(value = "/pet/findByStatus", produces = { "application/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); @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 = { @@ -76,10 +78,11 @@ public interface PetApi { @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Pet.class), @ApiResponse(code = 400, message = "Invalid tag value", response = Pet.class) }) + @RequestMapping(value = "/pet/findByTags", produces = { "application/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); @ApiOperation(value = "Find pet by ID", notes = "Returns a single pet", response = Pet.class, authorizations = { @@ -89,10 +92,11 @@ public interface PetApi { @ApiResponse(code = 200, message = "successful operation", response = Pet.class), @ApiResponse(code = 400, message = "Invalid ID supplied", response = Pet.class), @ApiResponse(code = 404, message = "Pet not found", response = Pet.class) }) + @RequestMapping(value = "/pet/{petId}", produces = { "application/xml", "application/json" }, method = RequestMethod.GET) - ResponseEntity getPetById(@ApiParam(value = "ID of pet to return",required=true ) @PathVariable("petId") Long petId, @RequestHeader("Accept") String accept) throws IOException; + ResponseEntity getPetById(@ApiParam(value = "ID of pet to return",required=true ) @PathVariable("petId") Long petId); @ApiOperation(value = "Update an existing pet", notes = "", response = Void.class, authorizations = { @@ -105,11 +109,12 @@ public interface PetApi { @ApiResponse(code = 400, message = "Invalid ID supplied", response = Void.class), @ApiResponse(code = 404, message = "Pet not found", response = Void.class), @ApiResponse(code = 405, message = "Validation exception", response = Void.class) }) + @RequestMapping(value = "/pet", produces = { "application/xml", "application/json" }, consumes = { "application/json", "application/xml" }, method = RequestMethod.PUT) - ResponseEntity updatePet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody Pet body, @RequestHeader("Accept") String accept); + ResponseEntity updatePet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody Pet body); @ApiOperation(value = "Updates a pet in the store with form data", notes = "", response = Void.class, authorizations = { @@ -120,11 +125,12 @@ public interface PetApi { }, tags={ "pet", }) @ApiResponses(value = { @ApiResponse(code = 405, message = "Invalid input", response = Void.class) }) + @RequestMapping(value = "/pet/{petId}", produces = { "application/xml", "application/json" }, consumes = { "application/x-www-form-urlencoded" }, method = RequestMethod.POST) - ResponseEntity updatePetWithForm(@ApiParam(value = "ID of pet that needs to be updated",required=true ) @PathVariable("petId") Long petId,@ApiParam(value = "Updated name of the pet") @RequestPart(value="name", required=false) String name,@ApiParam(value = "Updated status of the pet") @RequestPart(value="status", required=false) String status, @RequestHeader("Accept") String accept); + ResponseEntity updatePetWithForm(@ApiParam(value = "ID of pet that needs to be updated",required=true ) @PathVariable("petId") Long petId,@ApiParam(value = "Updated name of the pet") @RequestPart(value="name", required=false) String name,@ApiParam(value = "Updated status of the pet") @RequestPart(value="status", required=false) String status); @ApiOperation(value = "uploads an image", notes = "", response = ModelApiResponse.class, authorizations = { @@ -135,10 +141,11 @@ public interface PetApi { }, tags={ "pet", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = ModelApiResponse.class) }) + @RequestMapping(value = "/pet/{petId}/uploadImage", produces = { "application/json" }, consumes = { "multipart/form-data" }, method = RequestMethod.POST) - ResponseEntity uploadFile(@ApiParam(value = "ID of pet to update",required=true ) @PathVariable("petId") Long petId,@ApiParam(value = "Additional data to pass to server") @RequestPart(value="additionalMetadata", required=false) String additionalMetadata,@ApiParam(value = "file detail") @RequestPart("file") MultipartFile file, @RequestHeader("Accept") String accept) throws IOException; + ResponseEntity uploadFile(@ApiParam(value = "ID of pet to update",required=true ) @PathVariable("petId") Long petId,@ApiParam(value = "Additional data to pass to server") @RequestPart(value="additionalMetadata", required=false) String additionalMetadata,@ApiParam(value = "file detail") @RequestPart("file") MultipartFile file); } diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/api/PetApiController.java b/samples/server/petstore/springboot/src/main/java/io/swagger/api/PetApiController.java index 66e1dbda18..6ad4390e16 100644 --- a/samples/server/petstore/springboot/src/main/java/io/swagger/api/PetApiController.java +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/api/PetApiController.java @@ -17,104 +17,57 @@ import org.springframework.web.bind.annotation.RequestPart; import org.springframework.web.multipart.MultipartFile; import java.util.List; -import com.fasterxml.jackson.databind.ObjectMapper; -import java.io.IOException; + import javax.validation.constraints.*; import javax.validation.Valid; @Controller public class PetApiController implements PetApi { - private final ObjectMapper objectMapper; - public PetApiController(ObjectMapper objectMapper) { - this.objectMapper = objectMapper; - } - public ResponseEntity addPet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody Pet body, - @RequestHeader("Accept") String accept) { + + public ResponseEntity addPet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody Pet body) { // do some magic! return new ResponseEntity(HttpStatus.OK); } public ResponseEntity deletePet(@ApiParam(value = "Pet id to delete",required=true ) @PathVariable("petId") Long petId, - @ApiParam(value = "" ) @RequestHeader(value="api_key", required=false) String apiKey, - @RequestHeader("Accept") String accept) { + @ApiParam(value = "" ) @RequestHeader(value="api_key", required=false) String apiKey) { // do some magic! 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, - @RequestHeader("Accept") String accept) throws IOException { + public ResponseEntity> findPetsByStatus( @NotNull@ApiParam(value = "Status values that need to be considered for filter", required = true, allowableValues = "available, pending, sold") @RequestParam(value = "status", required = true) List status) { // do some magic! - - if (accept != null && accept.contains("application/xml")) { - return new ResponseEntity>(objectMapper.readValue(" 123456789 doggie aeiou aeiou", List.class), HttpStatus.OK); - } - - - if (accept != null && accept.contains("application/json")) { - return new ResponseEntity>(objectMapper.readValue("[ { \"photoUrls\" : [ \"aeiou\" ], \"name\" : \"doggie\", \"id\" : 0, \"category\" : { \"name\" : \"aeiou\", \"id\" : 6 }, \"tags\" : [ { \"name\" : \"aeiou\", \"id\" : 1 } ], \"status\" : \"available\"} ]", List.class), HttpStatus.OK); - } - return new ResponseEntity>(HttpStatus.OK); } - 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 { + public ResponseEntity> findPetsByTags( @NotNull@ApiParam(value = "Tags to filter by", required = true) @RequestParam(value = "tags", required = true) List tags) { // do some magic! - - if (accept != null && accept.contains("application/xml")) { - return new ResponseEntity>(objectMapper.readValue(" 123456789 doggie aeiou aeiou", List.class), HttpStatus.OK); - } - - - if (accept != null && accept.contains("application/json")) { - return new ResponseEntity>(objectMapper.readValue("[ { \"photoUrls\" : [ \"aeiou\" ], \"name\" : \"doggie\", \"id\" : 0, \"category\" : { \"name\" : \"aeiou\", \"id\" : 6 }, \"tags\" : [ { \"name\" : \"aeiou\", \"id\" : 1 } ], \"status\" : \"available\"} ]", List.class), HttpStatus.OK); - } - return new ResponseEntity>(HttpStatus.OK); } - public ResponseEntity getPetById(@ApiParam(value = "ID of pet to return",required=true ) @PathVariable("petId") Long petId, - @RequestHeader("Accept") String accept) throws IOException { + public ResponseEntity getPetById(@ApiParam(value = "ID of pet to return",required=true ) @PathVariable("petId") Long petId) { // do some magic! - - if (accept != null && accept.contains("application/xml")) { - return new ResponseEntity(objectMapper.readValue(" 123456789 doggie aeiou aeiou", Pet.class), HttpStatus.OK); - } - - - if (accept != null && accept.contains("application/json")) { - return new ResponseEntity(objectMapper.readValue("{ \"photoUrls\" : [ \"aeiou\" ], \"name\" : \"doggie\", \"id\" : 0, \"category\" : { \"name\" : \"aeiou\", \"id\" : 6 }, \"tags\" : [ { \"name\" : \"aeiou\", \"id\" : 1 } ], \"status\" : \"available\"}", Pet.class), HttpStatus.OK); - } - return new ResponseEntity(HttpStatus.OK); } - public ResponseEntity updatePet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody Pet body, - @RequestHeader("Accept") String accept) { + public ResponseEntity updatePet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody Pet body) { // do some magic! return new ResponseEntity(HttpStatus.OK); } public ResponseEntity updatePetWithForm(@ApiParam(value = "ID of pet that needs to be updated",required=true ) @PathVariable("petId") Long petId, @ApiParam(value = "Updated name of the pet") @RequestPart(value="name", required=false) String name, - @ApiParam(value = "Updated status of the pet") @RequestPart(value="status", required=false) String status, - @RequestHeader("Accept") String accept) { + @ApiParam(value = "Updated status of the pet") @RequestPart(value="status", required=false) String status) { // do some magic! return new ResponseEntity(HttpStatus.OK); } public ResponseEntity uploadFile(@ApiParam(value = "ID of pet to update",required=true ) @PathVariable("petId") Long petId, @ApiParam(value = "Additional data to pass to server") @RequestPart(value="additionalMetadata", required=false) String additionalMetadata, - @ApiParam(value = "file detail") @RequestPart("file") MultipartFile file, - @RequestHeader("Accept") String accept) throws IOException { + @ApiParam(value = "file detail") @RequestPart("file") MultipartFile file) { // do some magic! - - if (accept != null && accept.contains("application/json")) { - return new ResponseEntity(objectMapper.readValue("{ \"code\" : 0, \"type\" : \"aeiou\", \"message\" : \"aeiou\"}", ModelApiResponse.class), HttpStatus.OK); - } - return new ResponseEntity(HttpStatus.OK); } diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/api/StoreApi.java b/samples/server/petstore/springboot/src/main/java/io/swagger/api/StoreApi.java index fb8f3d706f..8b080a440d 100644 --- a/samples/server/petstore/springboot/src/main/java/io/swagger/api/StoreApi.java +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/api/StoreApi.java @@ -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.*; @@ -26,10 +25,11 @@ public interface StoreApi { @ApiResponses(value = { @ApiResponse(code = 400, message = "Invalid ID supplied", response = Void.class), @ApiResponse(code = 404, message = "Order not found", response = Void.class) }) + @RequestMapping(value = "/store/order/{order_id}", produces = { "application/xml", "application/json" }, method = RequestMethod.DELETE) - ResponseEntity deleteOrder(@ApiParam(value = "ID of the order that needs to be deleted",required=true ) @PathVariable("order_id") String orderId, @RequestHeader("Accept") String accept); + ResponseEntity deleteOrder(@ApiParam(value = "ID of the order that needs to be deleted",required=true ) @PathVariable("order_id") String orderId); @ApiOperation(value = "Returns pet inventories by status", notes = "Returns a map of status codes to quantities", response = Integer.class, responseContainer = "Map", authorizations = { @@ -37,10 +37,11 @@ public interface StoreApi { }, tags={ "store", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Integer.class) }) + @RequestMapping(value = "/store/inventory", produces = { "application/json" }, method = RequestMethod.GET) - ResponseEntity> getInventory( @RequestHeader("Accept") String accept) throws IOException; + ResponseEntity> getInventory(); @ApiOperation(value = "Find purchase order by ID", notes = "For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions", response = Order.class, tags={ "store", }) @@ -48,19 +49,21 @@ public interface StoreApi { @ApiResponse(code = 200, message = "successful operation", response = Order.class), @ApiResponse(code = 400, message = "Invalid ID supplied", response = Order.class), @ApiResponse(code = 404, message = "Order not found", response = Order.class) }) + @RequestMapping(value = "/store/order/{order_id}", produces = { "application/xml", "application/json" }, method = RequestMethod.GET) - ResponseEntity getOrderById( @Min(1) @Max(5)@ApiParam(value = "ID of pet that needs to be fetched",required=true ) @PathVariable("order_id") Long orderId, @RequestHeader("Accept") String accept) throws IOException; + ResponseEntity getOrderById( @Min(1) @Max(5)@ApiParam(value = "ID of pet that needs to be fetched",required=true ) @PathVariable("order_id") Long orderId); @ApiOperation(value = "Place an order for a pet", notes = "", response = Order.class, tags={ "store", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Order.class), @ApiResponse(code = 400, message = "Invalid Order", response = Order.class) }) + @RequestMapping(value = "/store/order", produces = { "application/xml", "application/json" }, method = RequestMethod.POST) - ResponseEntity placeOrder(@ApiParam(value = "order placed for purchasing the pet" ,required=true ) @Valid @RequestBody Order body, @RequestHeader("Accept") String accept) throws IOException; + ResponseEntity placeOrder(@ApiParam(value = "order placed for purchasing the pet" ,required=true ) @Valid @RequestBody Order body); } diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/api/StoreApiController.java b/samples/server/petstore/springboot/src/main/java/io/swagger/api/StoreApiController.java index 6154d9c263..472bda2ada 100644 --- a/samples/server/petstore/springboot/src/main/java/io/swagger/api/StoreApiController.java +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/api/StoreApiController.java @@ -16,64 +16,32 @@ import org.springframework.web.bind.annotation.RequestPart; import org.springframework.web.multipart.MultipartFile; import java.util.List; -import com.fasterxml.jackson.databind.ObjectMapper; -import java.io.IOException; + import javax.validation.constraints.*; import javax.validation.Valid; @Controller public class StoreApiController implements StoreApi { - private final ObjectMapper objectMapper; - public StoreApiController(ObjectMapper objectMapper) { - this.objectMapper = objectMapper; - } - public ResponseEntity deleteOrder(@ApiParam(value = "ID of the order that needs to be deleted",required=true ) @PathVariable("order_id") String orderId, - @RequestHeader("Accept") String accept) { + + public ResponseEntity deleteOrder(@ApiParam(value = "ID of the order that needs to be deleted",required=true ) @PathVariable("order_id") String orderId) { // do some magic! return new ResponseEntity(HttpStatus.OK); } - public ResponseEntity> getInventory(@RequestHeader("Accept") String accept) throws IOException { + public ResponseEntity> getInventory() { // do some magic! - - if (accept != null && accept.contains("application/json")) { - return new ResponseEntity>(objectMapper.readValue("{ \"key\" : 0}", Map.class), HttpStatus.OK); - } - return new ResponseEntity>(HttpStatus.OK); } - public ResponseEntity getOrderById( @Min(1) @Max(5)@ApiParam(value = "ID of pet that needs to be fetched",required=true ) @PathVariable("order_id") Long orderId, - @RequestHeader("Accept") String accept) throws IOException { + public ResponseEntity getOrderById( @Min(1) @Max(5)@ApiParam(value = "ID of pet that needs to be fetched",required=true ) @PathVariable("order_id") Long orderId) { // do some magic! - - if (accept != null && accept.contains("application/xml")) { - return new ResponseEntity(objectMapper.readValue(" 123456789 123456789 123 2000-01-23T04:56:07.000Z aeiou true", Order.class), HttpStatus.OK); - } - - - if (accept != null && accept.contains("application/json")) { - return new ResponseEntity(objectMapper.readValue("{ \"petId\" : 6, \"quantity\" : 1, \"id\" : 0, \"shipDate\" : \"2000-01-23T04:56:07.000+00:00\", \"complete\" : false, \"status\" : \"placed\"}", Order.class), HttpStatus.OK); - } - return new ResponseEntity(HttpStatus.OK); } - public ResponseEntity placeOrder(@ApiParam(value = "order placed for purchasing the pet" ,required=true ) @Valid @RequestBody Order body, - @RequestHeader("Accept") String accept) throws IOException { + public ResponseEntity placeOrder(@ApiParam(value = "order placed for purchasing the pet" ,required=true ) @Valid @RequestBody Order body) { // do some magic! - - if (accept != null && accept.contains("application/xml")) { - return new ResponseEntity(objectMapper.readValue(" 123456789 123456789 123 2000-01-23T04:56:07.000Z aeiou true", Order.class), HttpStatus.OK); - } - - - if (accept != null && accept.contains("application/json")) { - return new ResponseEntity(objectMapper.readValue("{ \"petId\" : 6, \"quantity\" : 1, \"id\" : 0, \"shipDate\" : \"2000-01-23T04:56:07.000+00:00\", \"complete\" : false, \"status\" : \"placed\"}", Order.class), HttpStatus.OK); - } - return new ResponseEntity(HttpStatus.OK); } diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/api/UserApi.java b/samples/server/petstore/springboot/src/main/java/io/swagger/api/UserApi.java index adc0d21d30..55fe9faf68 100644 --- a/samples/server/petstore/springboot/src/main/java/io/swagger/api/UserApi.java +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/api/UserApi.java @@ -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.*; @@ -25,38 +24,42 @@ public interface UserApi { @ApiOperation(value = "Create user", notes = "This can only be done by the logged in user.", response = Void.class, tags={ "user", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Void.class) }) + @RequestMapping(value = "/user", produces = { "application/xml", "application/json" }, method = RequestMethod.POST) - ResponseEntity createUser(@ApiParam(value = "Created user object" ,required=true ) @Valid @RequestBody User body, @RequestHeader("Accept") String accept); + ResponseEntity createUser(@ApiParam(value = "Created user object" ,required=true ) @Valid @RequestBody User body); @ApiOperation(value = "Creates list of users with given input array", notes = "", response = Void.class, tags={ "user", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Void.class) }) + @RequestMapping(value = "/user/createWithArray", produces = { "application/xml", "application/json" }, method = RequestMethod.POST) - ResponseEntity createUsersWithArrayInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody List body, @RequestHeader("Accept") String accept); + ResponseEntity createUsersWithArrayInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody List body); @ApiOperation(value = "Creates list of users with given input array", notes = "", response = Void.class, tags={ "user", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Void.class) }) + @RequestMapping(value = "/user/createWithList", produces = { "application/xml", "application/json" }, method = RequestMethod.POST) - ResponseEntity createUsersWithListInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody List body, @RequestHeader("Accept") String accept); + ResponseEntity createUsersWithListInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody List body); @ApiOperation(value = "Delete user", notes = "This can only be done by the logged in user.", response = Void.class, tags={ "user", }) @ApiResponses(value = { @ApiResponse(code = 400, message = "Invalid username supplied", response = Void.class), @ApiResponse(code = 404, message = "User not found", response = Void.class) }) + @RequestMapping(value = "/user/{username}", produces = { "application/xml", "application/json" }, method = RequestMethod.DELETE) - ResponseEntity deleteUser(@ApiParam(value = "The name that needs to be deleted",required=true ) @PathVariable("username") String username, @RequestHeader("Accept") String accept); + ResponseEntity deleteUser(@ApiParam(value = "The name that needs to be deleted",required=true ) @PathVariable("username") String username); @ApiOperation(value = "Get user by user name", notes = "", response = User.class, tags={ "user", }) @@ -64,38 +67,42 @@ public interface UserApi { @ApiResponse(code = 200, message = "successful operation", response = User.class), @ApiResponse(code = 400, message = "Invalid username supplied", response = User.class), @ApiResponse(code = 404, message = "User not found", response = User.class) }) + @RequestMapping(value = "/user/{username}", produces = { "application/xml", "application/json" }, method = RequestMethod.GET) - ResponseEntity getUserByName(@ApiParam(value = "The name that needs to be fetched. Use user1 for testing. ",required=true ) @PathVariable("username") String username, @RequestHeader("Accept") String accept) throws IOException; + ResponseEntity getUserByName(@ApiParam(value = "The name that needs to be fetched. Use user1 for testing. ",required=true ) @PathVariable("username") String username); @ApiOperation(value = "Logs user into the system", notes = "", response = String.class, tags={ "user", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = String.class), @ApiResponse(code = 400, message = "Invalid username/password supplied", response = String.class) }) + @RequestMapping(value = "/user/login", produces = { "application/xml", "application/json" }, method = RequestMethod.GET) - ResponseEntity loginUser( @NotNull@ApiParam(value = "The user name for login", required = true) @RequestParam(value = "username", required = true) String username, @NotNull@ApiParam(value = "The password for login in clear text", required = true) @RequestParam(value = "password", required = true) String password, @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); @ApiOperation(value = "Logs out current logged in user session", notes = "", response = Void.class, tags={ "user", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Void.class) }) + @RequestMapping(value = "/user/logout", produces = { "application/xml", "application/json" }, method = RequestMethod.GET) - ResponseEntity logoutUser( @RequestHeader("Accept") String accept); + ResponseEntity logoutUser(); @ApiOperation(value = "Updated user", notes = "This can only be done by the logged in user.", response = Void.class, tags={ "user", }) @ApiResponses(value = { @ApiResponse(code = 400, message = "Invalid user supplied", response = Void.class), @ApiResponse(code = 404, message = "User not found", response = Void.class) }) + @RequestMapping(value = "/user/{username}", produces = { "application/xml", "application/json" }, method = RequestMethod.PUT) - ResponseEntity updateUser(@ApiParam(value = "name that need to be deleted",required=true ) @PathVariable("username") String username,@ApiParam(value = "Updated user object" ,required=true ) @Valid @RequestBody User body, @RequestHeader("Accept") String accept); + ResponseEntity updateUser(@ApiParam(value = "name that need to be deleted",required=true ) @PathVariable("username") String username,@ApiParam(value = "Updated user object" ,required=true ) @Valid @RequestBody User body); } diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/api/UserApiController.java b/samples/server/petstore/springboot/src/main/java/io/swagger/api/UserApiController.java index 24b7e18b99..e751209da2 100644 --- a/samples/server/petstore/springboot/src/main/java/io/swagger/api/UserApiController.java +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/api/UserApiController.java @@ -16,84 +16,53 @@ import org.springframework.web.bind.annotation.RequestPart; import org.springframework.web.multipart.MultipartFile; import java.util.List; -import com.fasterxml.jackson.databind.ObjectMapper; -import java.io.IOException; + import javax.validation.constraints.*; import javax.validation.Valid; @Controller public class UserApiController implements UserApi { - private final ObjectMapper objectMapper; - public UserApiController(ObjectMapper objectMapper) { - this.objectMapper = objectMapper; - } - public ResponseEntity createUser(@ApiParam(value = "Created user object" ,required=true ) @Valid @RequestBody User body, - @RequestHeader("Accept") String accept) { + + public ResponseEntity createUser(@ApiParam(value = "Created user object" ,required=true ) @Valid @RequestBody User body) { // do some magic! return new ResponseEntity(HttpStatus.OK); } - public ResponseEntity createUsersWithArrayInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody List body, - @RequestHeader("Accept") String accept) { + public ResponseEntity createUsersWithArrayInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody List body) { // do some magic! return new ResponseEntity(HttpStatus.OK); } - public ResponseEntity createUsersWithListInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody List body, - @RequestHeader("Accept") String accept) { + public ResponseEntity createUsersWithListInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody List body) { // do some magic! return new ResponseEntity(HttpStatus.OK); } - public ResponseEntity deleteUser(@ApiParam(value = "The name that needs to be deleted",required=true ) @PathVariable("username") String username, - @RequestHeader("Accept") String accept) { + public ResponseEntity deleteUser(@ApiParam(value = "The name that needs to be deleted",required=true ) @PathVariable("username") String username) { // do some magic! return new ResponseEntity(HttpStatus.OK); } - public ResponseEntity getUserByName(@ApiParam(value = "The name that needs to be fetched. Use user1 for testing. ",required=true ) @PathVariable("username") String username, - @RequestHeader("Accept") String accept) throws IOException { + public ResponseEntity getUserByName(@ApiParam(value = "The name that needs to be fetched. Use user1 for testing. ",required=true ) @PathVariable("username") String username) { // do some magic! - - if (accept != null && accept.contains("application/xml")) { - return new ResponseEntity(objectMapper.readValue(" 123456789 aeiou aeiou aeiou aeiou aeiou aeiou 123", User.class), HttpStatus.OK); - } - - - if (accept != null && accept.contains("application/json")) { - return new ResponseEntity(objectMapper.readValue("{ \"firstName\" : \"aeiou\", \"lastName\" : \"aeiou\", \"password\" : \"aeiou\", \"userStatus\" : 6, \"phone\" : \"aeiou\", \"id\" : 0, \"email\" : \"aeiou\", \"username\" : \"aeiou\"}", User.class), HttpStatus.OK); - } - 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, - @RequestHeader("Accept") String accept) throws IOException { + @NotNull@ApiParam(value = "The password for login in clear text", required = true) @RequestParam(value = "password", required = true) String password) { // do some magic! - - if (accept != null && accept.contains("application/xml")) { - return new ResponseEntity(objectMapper.readValue("aeiou", String.class), HttpStatus.OK); - } - - - if (accept != null && accept.contains("application/json")) { - return new ResponseEntity(objectMapper.readValue("\"aeiou\"", String.class), HttpStatus.OK); - } - return new ResponseEntity(HttpStatus.OK); } - public ResponseEntity logoutUser(@RequestHeader("Accept") String accept) { + public ResponseEntity logoutUser() { // do some magic! return new ResponseEntity(HttpStatus.OK); } public ResponseEntity updateUser(@ApiParam(value = "name that need to be deleted",required=true ) @PathVariable("username") String username, - @ApiParam(value = "Updated user object" ,required=true ) @Valid @RequestBody User body, - @RequestHeader("Accept") String accept) { + @ApiParam(value = "Updated user object" ,required=true ) @Valid @RequestBody User body) { // do some magic! return new ResponseEntity(HttpStatus.OK); } diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/model/AdditionalPropertiesClass.java b/samples/server/petstore/springboot/src/main/java/io/swagger/model/AdditionalPropertiesClass.java index 80be4236b0..532576aad8 100644 --- a/samples/server/petstore/springboot/src/main/java/io/swagger/model/AdditionalPropertiesClass.java +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/model/AdditionalPropertiesClass.java @@ -41,7 +41,7 @@ public class AdditionalPropertiesClass { **/ @ApiModelProperty(value = "") - @Valid + public Map getMapProperty() { return mapProperty; } @@ -70,6 +70,7 @@ public class AdditionalPropertiesClass { @ApiModelProperty(value = "") @Valid + public Map> getMapOfMapProperty() { return mapOfMapProperty; } diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/model/Animal.java b/samples/server/petstore/springboot/src/main/java/io/swagger/model/Animal.java index bc957d1c80..a59dc766c5 100644 --- a/samples/server/petstore/springboot/src/main/java/io/swagger/model/Animal.java +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/model/Animal.java @@ -38,7 +38,7 @@ public class Animal { @ApiModelProperty(required = true, value = "") @NotNull - @Valid + public String getClassName() { return className; } @@ -58,7 +58,7 @@ public class Animal { **/ @ApiModelProperty(value = "") - @Valid + public String getColor() { return color; } diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/model/ArrayOfArrayOfNumberOnly.java b/samples/server/petstore/springboot/src/main/java/io/swagger/model/ArrayOfArrayOfNumberOnly.java index f9dca7d60b..ecff36e416 100644 --- a/samples/server/petstore/springboot/src/main/java/io/swagger/model/ArrayOfArrayOfNumberOnly.java +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/model/ArrayOfArrayOfNumberOnly.java @@ -39,6 +39,7 @@ public class ArrayOfArrayOfNumberOnly { @ApiModelProperty(value = "") @Valid + public List> getArrayArrayNumber() { return arrayArrayNumber; } diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/model/ArrayOfNumberOnly.java b/samples/server/petstore/springboot/src/main/java/io/swagger/model/ArrayOfNumberOnly.java index e9c8a313be..a08ff749ee 100644 --- a/samples/server/petstore/springboot/src/main/java/io/swagger/model/ArrayOfNumberOnly.java +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/model/ArrayOfNumberOnly.java @@ -39,6 +39,7 @@ public class ArrayOfNumberOnly { @ApiModelProperty(value = "") @Valid + public List getArrayNumber() { return arrayNumber; } diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/model/ArrayTest.java b/samples/server/petstore/springboot/src/main/java/io/swagger/model/ArrayTest.java index 78c35d3c63..e9022fd028 100644 --- a/samples/server/petstore/springboot/src/main/java/io/swagger/model/ArrayTest.java +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/model/ArrayTest.java @@ -44,7 +44,7 @@ public class ArrayTest { **/ @ApiModelProperty(value = "") - @Valid + public List getArrayOfString() { return arrayOfString; } @@ -73,6 +73,7 @@ public class ArrayTest { @ApiModelProperty(value = "") @Valid + public List> getArrayArrayOfInteger() { return arrayArrayOfInteger; } @@ -101,6 +102,7 @@ public class ArrayTest { @ApiModelProperty(value = "") @Valid + public List> getArrayArrayOfModel() { return arrayArrayOfModel; } diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/model/Capitalization.java b/samples/server/petstore/springboot/src/main/java/io/swagger/model/Capitalization.java index 93533c2882..d59005adf1 100644 --- a/samples/server/petstore/springboot/src/main/java/io/swagger/model/Capitalization.java +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/model/Capitalization.java @@ -42,7 +42,7 @@ public class Capitalization { **/ @ApiModelProperty(value = "") - @Valid + public String getSmallCamel() { return smallCamel; } @@ -62,7 +62,7 @@ public class Capitalization { **/ @ApiModelProperty(value = "") - @Valid + public String getCapitalCamel() { return capitalCamel; } @@ -82,7 +82,7 @@ public class Capitalization { **/ @ApiModelProperty(value = "") - @Valid + public String getSmallSnake() { return smallSnake; } @@ -102,7 +102,7 @@ public class Capitalization { **/ @ApiModelProperty(value = "") - @Valid + public String getCapitalSnake() { return capitalSnake; } @@ -122,7 +122,7 @@ public class Capitalization { **/ @ApiModelProperty(value = "") - @Valid + public String getScAETHFlowPoints() { return scAETHFlowPoints; } @@ -142,7 +142,7 @@ public class Capitalization { **/ @ApiModelProperty(value = "Name of the pet ") - @Valid + public String getATTNAME() { return ATT_NAME; } diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/model/Cat.java b/samples/server/petstore/springboot/src/main/java/io/swagger/model/Cat.java index edcbc354be..28016fa5ad 100644 --- a/samples/server/petstore/springboot/src/main/java/io/swagger/model/Cat.java +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/model/Cat.java @@ -28,7 +28,7 @@ public class Cat extends Animal { **/ @ApiModelProperty(value = "") - @Valid + public Boolean getDeclawed() { return declawed; } diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/model/Category.java b/samples/server/petstore/springboot/src/main/java/io/swagger/model/Category.java index 6dd9cb7a2a..e2a67cf25d 100644 --- a/samples/server/petstore/springboot/src/main/java/io/swagger/model/Category.java +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/model/Category.java @@ -30,7 +30,7 @@ public class Category { **/ @ApiModelProperty(value = "") - @Valid + public Long getId() { return id; } @@ -50,7 +50,7 @@ public class Category { **/ @ApiModelProperty(value = "") - @Valid + public String getName() { return name; } diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/model/ClassModel.java b/samples/server/petstore/springboot/src/main/java/io/swagger/model/ClassModel.java index 6a6379f5b6..a5ef34a233 100644 --- a/samples/server/petstore/springboot/src/main/java/io/swagger/model/ClassModel.java +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/model/ClassModel.java @@ -28,7 +28,7 @@ public class ClassModel { **/ @ApiModelProperty(value = "") - @Valid + public String getPropertyClass() { return propertyClass; } diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/model/Client.java b/samples/server/petstore/springboot/src/main/java/io/swagger/model/Client.java index 3b8d16cabf..aaa03c570f 100644 --- a/samples/server/petstore/springboot/src/main/java/io/swagger/model/Client.java +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/model/Client.java @@ -27,7 +27,7 @@ public class Client { **/ @ApiModelProperty(value = "") - @Valid + public String getClient() { return client; } diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/model/Dog.java b/samples/server/petstore/springboot/src/main/java/io/swagger/model/Dog.java index 513131a9fa..8ebd0f46a6 100644 --- a/samples/server/petstore/springboot/src/main/java/io/swagger/model/Dog.java +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/model/Dog.java @@ -28,7 +28,7 @@ public class Dog extends Animal { **/ @ApiModelProperty(value = "") - @Valid + public String getBreed() { return breed; } diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/model/EnumArrays.java b/samples/server/petstore/springboot/src/main/java/io/swagger/model/EnumArrays.java index bbf4a3036e..4d79aa66c5 100644 --- a/samples/server/petstore/springboot/src/main/java/io/swagger/model/EnumArrays.java +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/model/EnumArrays.java @@ -95,7 +95,7 @@ public class EnumArrays { **/ @ApiModelProperty(value = "") - @Valid + public JustSymbolEnum getJustSymbol() { return justSymbol; } @@ -123,7 +123,7 @@ public class EnumArrays { **/ @ApiModelProperty(value = "") - @Valid + public List getArrayEnum() { return arrayEnum; } diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/model/EnumTest.java b/samples/server/petstore/springboot/src/main/java/io/swagger/model/EnumTest.java index c7e4793cdf..a072f99267 100644 --- a/samples/server/petstore/springboot/src/main/java/io/swagger/model/EnumTest.java +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/model/EnumTest.java @@ -133,7 +133,7 @@ public class EnumTest { **/ @ApiModelProperty(value = "") - @Valid + public EnumStringEnum getEnumString() { return enumString; } @@ -153,7 +153,7 @@ public class EnumTest { **/ @ApiModelProperty(value = "") - @Valid + public EnumIntegerEnum getEnumInteger() { return enumInteger; } @@ -173,7 +173,7 @@ public class EnumTest { **/ @ApiModelProperty(value = "") - @Valid + public EnumNumberEnum getEnumNumber() { return enumNumber; } @@ -194,6 +194,7 @@ public class EnumTest { @ApiModelProperty(value = "") @Valid + public OuterEnum getOuterEnum() { return outerEnum; } diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/model/FormatTest.java b/samples/server/petstore/springboot/src/main/java/io/swagger/model/FormatTest.java index 9d6cf5cd4b..5ef3ec9215 100644 --- a/samples/server/petstore/springboot/src/main/java/io/swagger/model/FormatTest.java +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/model/FormatTest.java @@ -68,8 +68,8 @@ public class FormatTest { * @return integer **/ @ApiModelProperty(value = "") + @Min(10) @Max(100) - @Valid public Integer getInteger() { return integer; } @@ -90,8 +90,8 @@ public class FormatTest { * @return int32 **/ @ApiModelProperty(value = "") + @Min(20) @Max(200) - @Valid public Integer getInt32() { return int32; } @@ -111,7 +111,7 @@ public class FormatTest { **/ @ApiModelProperty(value = "") - @Valid + public Long getInt64() { return int64; } @@ -133,8 +133,9 @@ public class FormatTest { **/ @ApiModelProperty(required = true, value = "") @NotNull - @DecimalMin("32.1") @DecimalMax("543.2") + @Valid + @DecimalMin("32.1") @DecimalMax("543.2") public BigDecimal getNumber() { return number; } @@ -155,8 +156,8 @@ public class FormatTest { * @return _float **/ @ApiModelProperty(value = "") + @DecimalMin("54.3") @DecimalMax("987.6") - @Valid public Float getFloat() { return _float; } @@ -177,8 +178,8 @@ public class FormatTest { * @return _double **/ @ApiModelProperty(value = "") + @DecimalMin("67.8") @DecimalMax("123.4") - @Valid public Double getDouble() { return _double; } @@ -197,8 +198,8 @@ public class FormatTest { * @return string **/ @ApiModelProperty(value = "") + @Pattern(regexp="/[a-z]/i") - @Valid public String getString() { return string; } @@ -219,7 +220,7 @@ public class FormatTest { @ApiModelProperty(required = true, value = "") @NotNull - @Valid + public byte[] getByte() { return _byte; } @@ -239,7 +240,7 @@ public class FormatTest { **/ @ApiModelProperty(value = "") - @Valid + public byte[] getBinary() { return binary; } @@ -261,6 +262,7 @@ public class FormatTest { @NotNull @Valid + public LocalDate getDate() { return date; } @@ -281,6 +283,7 @@ public class FormatTest { @ApiModelProperty(value = "") @Valid + public DateTime getDateTime() { return dateTime; } @@ -301,6 +304,7 @@ public class FormatTest { @ApiModelProperty(value = "") @Valid + public UUID getUuid() { return uuid; } @@ -320,8 +324,8 @@ public class FormatTest { **/ @ApiModelProperty(required = true, value = "") @NotNull + @Size(min=10,max=64) - @Valid public String getPassword() { return password; } diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/model/HasOnlyReadOnly.java b/samples/server/petstore/springboot/src/main/java/io/swagger/model/HasOnlyReadOnly.java index 0f8b608e26..dc59cf9c78 100644 --- a/samples/server/petstore/springboot/src/main/java/io/swagger/model/HasOnlyReadOnly.java +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/model/HasOnlyReadOnly.java @@ -30,7 +30,7 @@ public class HasOnlyReadOnly { **/ @ApiModelProperty(readOnly = true, value = "") - @Valid + public String getBar() { return bar; } @@ -50,7 +50,7 @@ public class HasOnlyReadOnly { **/ @ApiModelProperty(readOnly = true, value = "") - @Valid + public String getFoo() { return foo; } diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/model/MapTest.java b/samples/server/petstore/springboot/src/main/java/io/swagger/model/MapTest.java index 1530a53f53..f179e8e423 100644 --- a/samples/server/petstore/springboot/src/main/java/io/swagger/model/MapTest.java +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/model/MapTest.java @@ -74,6 +74,7 @@ public class MapTest { @ApiModelProperty(value = "") @Valid + public Map> getMapMapOfString() { return mapMapOfString; } @@ -101,7 +102,7 @@ public class MapTest { **/ @ApiModelProperty(value = "") - @Valid + public Map getMapOfEnumString() { return mapOfEnumString; } diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/model/MixedPropertiesAndAdditionalPropertiesClass.java b/samples/server/petstore/springboot/src/main/java/io/swagger/model/MixedPropertiesAndAdditionalPropertiesClass.java index d4cd89cef3..d25bba89a9 100644 --- a/samples/server/petstore/springboot/src/main/java/io/swagger/model/MixedPropertiesAndAdditionalPropertiesClass.java +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/model/MixedPropertiesAndAdditionalPropertiesClass.java @@ -40,6 +40,7 @@ public class MixedPropertiesAndAdditionalPropertiesClass { @ApiModelProperty(value = "") @Valid + public UUID getUuid() { return uuid; } @@ -60,6 +61,7 @@ public class MixedPropertiesAndAdditionalPropertiesClass { @ApiModelProperty(value = "") @Valid + public DateTime getDateTime() { return dateTime; } @@ -88,6 +90,7 @@ public class MixedPropertiesAndAdditionalPropertiesClass { @ApiModelProperty(value = "") @Valid + public Map getMap() { return map; } diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/model/Model200Response.java b/samples/server/petstore/springboot/src/main/java/io/swagger/model/Model200Response.java index 97349fef05..c00e48ea6c 100644 --- a/samples/server/petstore/springboot/src/main/java/io/swagger/model/Model200Response.java +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/model/Model200Response.java @@ -31,7 +31,7 @@ public class Model200Response { **/ @ApiModelProperty(value = "") - @Valid + public Integer getName() { return name; } @@ -51,7 +51,7 @@ public class Model200Response { **/ @ApiModelProperty(value = "") - @Valid + public String getPropertyClass() { return propertyClass; } diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/model/ModelApiResponse.java b/samples/server/petstore/springboot/src/main/java/io/swagger/model/ModelApiResponse.java index c8882b3b1e..1df487b353 100644 --- a/samples/server/petstore/springboot/src/main/java/io/swagger/model/ModelApiResponse.java +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/model/ModelApiResponse.java @@ -33,7 +33,7 @@ public class ModelApiResponse { **/ @ApiModelProperty(value = "") - @Valid + public Integer getCode() { return code; } @@ -53,7 +53,7 @@ public class ModelApiResponse { **/ @ApiModelProperty(value = "") - @Valid + public String getType() { return type; } @@ -73,7 +73,7 @@ public class ModelApiResponse { **/ @ApiModelProperty(value = "") - @Valid + public String getMessage() { return message; } diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/model/ModelReturn.java b/samples/server/petstore/springboot/src/main/java/io/swagger/model/ModelReturn.java index 7018d7de09..3b05293b83 100644 --- a/samples/server/petstore/springboot/src/main/java/io/swagger/model/ModelReturn.java +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/model/ModelReturn.java @@ -28,7 +28,7 @@ public class ModelReturn { **/ @ApiModelProperty(value = "") - @Valid + public Integer getReturn() { return _return; } diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/model/Name.java b/samples/server/petstore/springboot/src/main/java/io/swagger/model/Name.java index 46069fdd14..a9835f910a 100644 --- a/samples/server/petstore/springboot/src/main/java/io/swagger/model/Name.java +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/model/Name.java @@ -38,7 +38,7 @@ public class Name { @ApiModelProperty(required = true, value = "") @NotNull - @Valid + public Integer getName() { return name; } @@ -58,7 +58,7 @@ public class Name { **/ @ApiModelProperty(readOnly = true, value = "") - @Valid + public Integer getSnakeCase() { return snakeCase; } @@ -78,7 +78,7 @@ public class Name { **/ @ApiModelProperty(value = "") - @Valid + public String getProperty() { return property; } @@ -98,7 +98,7 @@ public class Name { **/ @ApiModelProperty(readOnly = true, value = "") - @Valid + public Integer get123Number() { return _123Number; } diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/model/NumberOnly.java b/samples/server/petstore/springboot/src/main/java/io/swagger/model/NumberOnly.java index e243ecb429..a990653f20 100644 --- a/samples/server/petstore/springboot/src/main/java/io/swagger/model/NumberOnly.java +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/model/NumberOnly.java @@ -29,6 +29,7 @@ public class NumberOnly { @ApiModelProperty(value = "") @Valid + public BigDecimal getJustNumber() { return justNumber; } diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/model/Order.java b/samples/server/petstore/springboot/src/main/java/io/swagger/model/Order.java index 4106ac3619..5bfcf28b3e 100644 --- a/samples/server/petstore/springboot/src/main/java/io/swagger/model/Order.java +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/model/Order.java @@ -77,7 +77,7 @@ public class Order { **/ @ApiModelProperty(value = "") - @Valid + public Long getId() { return id; } @@ -97,7 +97,7 @@ public class Order { **/ @ApiModelProperty(value = "") - @Valid + public Long getPetId() { return petId; } @@ -117,7 +117,7 @@ public class Order { **/ @ApiModelProperty(value = "") - @Valid + public Integer getQuantity() { return quantity; } @@ -138,6 +138,7 @@ public class Order { @ApiModelProperty(value = "") @Valid + public DateTime getShipDate() { return shipDate; } @@ -157,7 +158,7 @@ public class Order { **/ @ApiModelProperty(value = "Order Status") - @Valid + public StatusEnum getStatus() { return status; } @@ -177,7 +178,7 @@ public class Order { **/ @ApiModelProperty(value = "") - @Valid + public Boolean getComplete() { return complete; } diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/model/Pet.java b/samples/server/petstore/springboot/src/main/java/io/swagger/model/Pet.java index c84687b699..38d92a5b91 100644 --- a/samples/server/petstore/springboot/src/main/java/io/swagger/model/Pet.java +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/model/Pet.java @@ -80,7 +80,7 @@ public class Pet { **/ @ApiModelProperty(value = "") - @Valid + public Long getId() { return id; } @@ -101,6 +101,7 @@ public class Pet { @ApiModelProperty(value = "") @Valid + public Category getCategory() { return category; } @@ -121,7 +122,7 @@ public class Pet { @ApiModelProperty(example = "doggie", required = true, value = "") @NotNull - @Valid + public String getName() { return name; } @@ -147,7 +148,7 @@ public class Pet { @ApiModelProperty(required = true, value = "") @NotNull - @Valid + public List getPhotoUrls() { return photoUrls; } @@ -176,6 +177,7 @@ public class Pet { @ApiModelProperty(value = "") @Valid + public List getTags() { return tags; } @@ -195,7 +197,7 @@ public class Pet { **/ @ApiModelProperty(value = "pet status in the store") - @Valid + public StatusEnum getStatus() { return status; } diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/model/ReadOnlyFirst.java b/samples/server/petstore/springboot/src/main/java/io/swagger/model/ReadOnlyFirst.java index 8e79be0008..1ff292f185 100644 --- a/samples/server/petstore/springboot/src/main/java/io/swagger/model/ReadOnlyFirst.java +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/model/ReadOnlyFirst.java @@ -30,7 +30,7 @@ public class ReadOnlyFirst { **/ @ApiModelProperty(readOnly = true, value = "") - @Valid + public String getBar() { return bar; } @@ -50,7 +50,7 @@ public class ReadOnlyFirst { **/ @ApiModelProperty(value = "") - @Valid + public String getBaz() { return baz; } diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/model/SpecialModelName.java b/samples/server/petstore/springboot/src/main/java/io/swagger/model/SpecialModelName.java index 3cb7b04353..9eabbe3eca 100644 --- a/samples/server/petstore/springboot/src/main/java/io/swagger/model/SpecialModelName.java +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/model/SpecialModelName.java @@ -27,7 +27,7 @@ public class SpecialModelName { **/ @ApiModelProperty(value = "") - @Valid + public Long getSpecialPropertyName() { return specialPropertyName; } diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/model/Tag.java b/samples/server/petstore/springboot/src/main/java/io/swagger/model/Tag.java index 9f8f3a2523..b3d49a2dc6 100644 --- a/samples/server/petstore/springboot/src/main/java/io/swagger/model/Tag.java +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/model/Tag.java @@ -30,7 +30,7 @@ public class Tag { **/ @ApiModelProperty(value = "") - @Valid + public Long getId() { return id; } @@ -50,7 +50,7 @@ public class Tag { **/ @ApiModelProperty(value = "") - @Valid + public String getName() { return name; } diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/model/User.java b/samples/server/petstore/springboot/src/main/java/io/swagger/model/User.java index 501c556de2..ef3270b7af 100644 --- a/samples/server/petstore/springboot/src/main/java/io/swagger/model/User.java +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/model/User.java @@ -48,7 +48,7 @@ public class User { **/ @ApiModelProperty(value = "") - @Valid + public Long getId() { return id; } @@ -68,7 +68,7 @@ public class User { **/ @ApiModelProperty(value = "") - @Valid + public String getUsername() { return username; } @@ -88,7 +88,7 @@ public class User { **/ @ApiModelProperty(value = "") - @Valid + public String getFirstName() { return firstName; } @@ -108,7 +108,7 @@ public class User { **/ @ApiModelProperty(value = "") - @Valid + public String getLastName() { return lastName; } @@ -128,7 +128,7 @@ public class User { **/ @ApiModelProperty(value = "") - @Valid + public String getEmail() { return email; } @@ -148,7 +148,7 @@ public class User { **/ @ApiModelProperty(value = "") - @Valid + public String getPassword() { return password; } @@ -168,7 +168,7 @@ public class User { **/ @ApiModelProperty(value = "") - @Valid + public String getPhone() { return phone; } @@ -188,7 +188,7 @@ public class User { **/ @ApiModelProperty(value = "User Status") - @Valid + public Integer getUserStatus() { return userStatus; }