diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/SpringCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/SpringCodegen.java index a564a499137..11f166c68c5 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/SpringCodegen.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/SpringCodegen.java @@ -134,7 +134,7 @@ public void processOpts() { (sourceFolder + File.separator + configPackage).replace(".", java.io.File.separator), "WebMvcConfiguration.java")); supportingFiles.add(new SupportingFile("swaggerUiConfiguration.mustache", (sourceFolder + File.separator + configPackage).replace(".", java.io.File.separator), "SwaggerUiConfiguration.java")); - supportingFiles.add(new SupportingFile("application.properties", + supportingFiles.add(new SupportingFile("swagger.mustache", ("src.main.resources").replace(".", java.io.File.separator), "swagger.properties")); } if (library.equals(SPRING_CLOUD_LIBRARY)) { diff --git a/modules/swagger-codegen/src/main/resources/JavaSpring/api.mustache b/modules/swagger-codegen/src/main/resources/JavaSpring/api.mustache index 2dc415f4b44..27f0f15e13d 100644 --- a/modules/swagger-codegen/src/main/resources/JavaSpring/api.mustache +++ b/modules/swagger-codegen/src/main/resources/JavaSpring/api.mustache @@ -7,6 +7,8 @@ import io.swagger.annotations.*; {{#java8}} import org.springframework.http.HttpStatus; {{/java8}} +import org.springframework.data.domain.Pageable; +import springfox.documentation.annotations.ApiIgnore; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestBody; @@ -34,8 +36,19 @@ public interface {{classname}} { {{/hasMore}}{{/scopes}} }{{/isOAuth}}){{#hasMore}}, {{/hasMore}}{{/authMethods}} - }{{/hasAuthMethods}}, tags={ {{#vendorExtensions.x-tags}}"{{tag}}",{{/vendorExtensions.x-tags}} }) - @ApiResponses(value = { {{#responses}} + }{{/hasAuthMethods}}, tags={ {{#vendorExtensions.x-tags}}"{{tag}}"{{#hasMore}}, {{/hasMore}}{{/vendorExtensions.x-tags}} }) + {{#vendorExtensions.x-spring-paginated}} + @ApiImplicitParams({ + @ApiImplicitParam(name = "page", dataType = "integer", paramType = "query", + value = "Results page you want to retrieve (0..N)"), + @ApiImplicitParam(name = "size", dataType = "integer", paramType = "query", + value = "Number of records per page."), + @ApiImplicitParam(name = "sort", allowMultiple = true, dataType = "string", paramType = "query", + value = "Sorting criteria in the format: property(,asc|desc). " + + "Default sort order is ascending. " + + "Multiple sort criteria are supported.") + }){{/vendorExtensions.x-spring-paginated}} + @ApiResponses(value = { {{#responses}} @ApiResponse(code = {{{code}}}, message = "{{{message}}}", response = {{{returnType}}}.class){{#hasMore}},{{/hasMore}}{{/responses}} }) @RequestMapping(value = "{{{path}}}",{{#singleContentTypes}} produces = "{{{vendorExtensions.x-accepts}}}", @@ -43,7 +56,7 @@ public interface {{classname}} { produces = { {{#produces}}"{{{mediaType}}}"{{#hasMore}}, {{/hasMore}}{{/produces}} }, {{/hasProduces}}{{#hasConsumes}} consumes = { {{#consumes}}"{{{mediaType}}}"{{#hasMore}}, {{/hasMore}}{{/consumes}} },{{/hasConsumes}}{{/singleContentTypes}} method = RequestMethod.{{httpMethod}}) - {{#java8}}default {{/java8}}{{#async}}{{^java8}}Callable{{/java8}}{{#java8}}CompletableFuture<{{/java8}}{{/async}}ResponseEntity<{{>returnTypes}}>{{#async}}>{{/async}} {{operationId}}({{#allParams}}{{>queryParams}}{{>pathParams}}{{>headerParams}}{{>bodyParams}}{{>formParams}}{{#hasMore}},{{/hasMore}}{{/allParams}}){{^java8}};{{/java8}}{{#java8}} { + {{#java8}}default {{/java8}}{{#async}}{{^java8}}Callable{{/java8}}{{#java8}}CompletableFuture<{{/java8}}{{/async}}ResponseEntity<{{>returnTypes}}>{{#async}}>{{/async}} {{operationId}}({{#allParams}}{{>queryParams}}{{>pathParams}}{{>headerParams}}{{>bodyParams}}{{>formParams}}{{#hasMore}},{{/hasMore}}{{/allParams}}{{#vendorExtensions.x-spring-paginated}}, @ApiIgnore final Pageable pageable{{/vendorExtensions.x-spring-paginated}}){{^java8}};{{/java8}}{{#java8}} { // do some magic! return {{#async}}CompletableFuture.completedFuture({{/async}}new ResponseEntity<{{>returnTypes}}>(HttpStatus.OK){{#async}}){{/async}}; }{{/java8}} diff --git a/modules/swagger-codegen/src/main/resources/JavaSpring/apiController.mustache b/modules/swagger-codegen/src/main/resources/JavaSpring/apiController.mustache index 2540bb75d79..c07931b84bb 100644 --- a/modules/swagger-codegen/src/main/resources/JavaSpring/apiController.mustache +++ b/modules/swagger-codegen/src/main/resources/JavaSpring/apiController.mustache @@ -5,7 +5,8 @@ package {{package}}; {{/imports}} import io.swagger.annotations.*; - +import org.springframework.data.domain.Pageable; +import springfox.documentation.annotations.ApiIgnore; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; {{/java8}} @@ -29,7 +30,7 @@ import java.util.concurrent.Callable; public class {{classname}}Controller implements {{classname}} { {{^java8}}{{#operation}} public {{#async}}Callable<{{/async}}ResponseEntity<{{>returnTypes}}>{{#async}}>{{/async}} {{operationId}}({{#allParams}}{{>queryParams}}{{>pathParams}}{{>headerParams}}{{>bodyParams}}{{>formParams}}{{#hasMore}}, - {{/hasMore}}{{/allParams}}) { + {{/hasMore}}{{/allParams}}{{#vendorExtensions.x-spring-paginated}}, @ApiIgnore final Pageable pageable{{/vendorExtensions.x-spring-paginated}}) { // do some magic!{{^async}} return new ResponseEntity<{{>returnTypes}}>(HttpStatus.OK);{{/async}}{{#async}} return new CallablereturnTypes}}>>() { diff --git a/modules/swagger-codegen/src/main/resources/JavaSpring/application.properties b/modules/swagger-codegen/src/main/resources/JavaSpring/application.properties deleted file mode 100644 index 858a5f007b5..00000000000 --- a/modules/swagger-codegen/src/main/resources/JavaSpring/application.properties +++ /dev/null @@ -1,2 +0,0 @@ -springfox.documentation.swagger.v2.path=/api-docs -#server.port=8090 \ No newline at end of file diff --git a/modules/swagger-codegen/src/main/resources/JavaSpring/libraries/spring-boot/application.mustache b/modules/swagger-codegen/src/main/resources/JavaSpring/libraries/spring-boot/application.mustache new file mode 100644 index 00000000000..9f4105296c4 --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/JavaSpring/libraries/spring-boot/application.mustache @@ -0,0 +1,7 @@ +#SpringBoot application.properties +springfox.documentation.swagger.v2.path=/api-docs +server.contextPath={{^contextPath}}/{{/contextPath}}{{#contextPath}}{{contextPath}}{{/contextPath}} +#server.port=8090 + +#Remove this exclusion for use Jpa. But don't miss to declare datasource before... +spring.autoconfigure.exclude=org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration,org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration \ No newline at end of file diff --git a/modules/swagger-codegen/src/main/resources/JavaSpring/libraries/spring-boot/pom.mustache b/modules/swagger-codegen/src/main/resources/JavaSpring/libraries/spring-boot/pom.mustache index 3ee88cff43d..238a312efe6 100644 --- a/modules/swagger-codegen/src/main/resources/JavaSpring/libraries/spring-boot/pom.mustache +++ b/modules/swagger-codegen/src/main/resources/JavaSpring/libraries/spring-boot/pom.mustache @@ -14,7 +14,7 @@ org.springframework.boot spring-boot-starter-parent - 1.3.5.RELEASE + 1.4.0.RELEASE src/main/java @@ -44,6 +44,10 @@ spring-boot-starter-tomcat provided + + org.springframework.boot + spring-boot-starter-data-jpa + io.springfox @@ -74,4 +78,4 @@ {{/java8}} - \ No newline at end of file + diff --git a/modules/swagger-codegen/src/main/resources/JavaSpring/application.mustache b/modules/swagger-codegen/src/main/resources/JavaSpring/libraries/spring-mvc/swagger.mustache similarity index 84% rename from modules/swagger-codegen/src/main/resources/JavaSpring/application.mustache rename to modules/swagger-codegen/src/main/resources/JavaSpring/libraries/spring-mvc/swagger.mustache index a4695deef76..f49da5c6d91 100644 --- a/modules/swagger-codegen/src/main/resources/JavaSpring/application.mustache +++ b/modules/swagger-codegen/src/main/resources/JavaSpring/libraries/spring-mvc/swagger.mustache @@ -1,3 +1,4 @@ +#Spring MVC swagger.properties springfox.documentation.swagger.v2.path=/api-docs server.contextPath={{^contextPath}}/{{/contextPath}}{{#contextPath}}{{contextPath}}{{/contextPath}} #server.port=8090 \ No newline at end of file diff --git a/modules/swagger-codegen/src/test/resources/2_0/petstore.json b/modules/swagger-codegen/src/test/resources/2_0/petstore.json index 24fcf4bf768..c2838417af2 100644 --- a/modules/swagger-codegen/src/test/resources/2_0/petstore.json +++ b/modules/swagger-codegen/src/test/resources/2_0/petstore.json @@ -116,6 +116,7 @@ "summary": "Finds Pets by status", "description": "Multiple status values can be provided with comma seperated strings", "operationId": "findPetsByStatus", + "x-spring-paginated": true, "produces": [ "application/json", "application/xml" diff --git a/modules/swagger-codegen/src/test/resources/petstore.json b/modules/swagger-codegen/src/test/resources/petstore.json index 66762d74b2b..6bd75c60d35 100644 --- a/modules/swagger-codegen/src/test/resources/petstore.json +++ b/modules/swagger-codegen/src/test/resources/petstore.json @@ -119,6 +119,7 @@ "application/json", "application/xml" ], + "x-spring-pageable":true, "parameters": [ { "name": "status", diff --git a/samples/server/petstore/springboot/pom.xml b/samples/server/petstore/springboot/pom.xml index 4cf50070b8d..a41d901f092 100644 --- a/samples/server/petstore/springboot/pom.xml +++ b/samples/server/petstore/springboot/pom.xml @@ -1,9 +1,9 @@ 4.0.0 io.swagger - swagger-spring-server + swagger-spring jar - swagger-spring-server + swagger-spring 1.0.0 1.7 @@ -42,6 +42,10 @@ spring-boot-starter-tomcat provided + + org.springframework.boot + spring-boot-starter-data-jpa + io.springfox diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/api/ApiException.java b/samples/server/petstore/springboot/src/main/java/io/swagger/api/ApiException.java index 7fa61c50d24..902495fed7e 100644 --- a/samples/server/petstore/springboot/src/main/java/io/swagger/api/ApiException.java +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/api/ApiException.java @@ -1,5 +1,6 @@ package io.swagger.api; +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringCodegen", date = "2016-07-13T14:49:07.020+02:00") public class ApiException extends Exception{ private int code; diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/api/ApiOriginFilter.java b/samples/server/petstore/springboot/src/main/java/io/swagger/api/ApiOriginFilter.java index f0f62dc7206..5a5d959fb91 100644 --- a/samples/server/petstore/springboot/src/main/java/io/swagger/api/ApiOriginFilter.java +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/api/ApiOriginFilter.java @@ -5,6 +5,7 @@ import javax.servlet.*; import javax.servlet.http.HttpServletResponse; +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringCodegen", date = "2016-07-13T14:49:07.020+02:00") public class ApiOriginFilter implements javax.servlet.Filter { @Override diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/api/ApiResponseMessage.java b/samples/server/petstore/springboot/src/main/java/io/swagger/api/ApiResponseMessage.java index f03840f8e06..8aafb53ee94 100644 --- a/samples/server/petstore/springboot/src/main/java/io/swagger/api/ApiResponseMessage.java +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/api/ApiResponseMessage.java @@ -2,6 +2,7 @@ import javax.xml.bind.annotation.XmlTransient; +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringCodegen", date = "2016-07-13T14:49:07.020+02:00") @javax.xml.bind.annotation.XmlRootElement public class ApiResponseMessage { diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/api/NotFoundException.java b/samples/server/petstore/springboot/src/main/java/io/swagger/api/NotFoundException.java index 295109d7fc4..c7543870420 100644 --- a/samples/server/petstore/springboot/src/main/java/io/swagger/api/NotFoundException.java +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/api/NotFoundException.java @@ -1,5 +1,6 @@ package io.swagger.api; +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringCodegen", date = "2016-07-13T14:49:07.020+02:00") public class NotFoundException extends ApiException { private int code; 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 7f66b884f21..a9b591d7599 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 @@ -2,9 +2,10 @@ import io.swagger.model.Pet; import java.io.File; -import io.swagger.model.ModelApiResponse; import io.swagger.annotations.*; +import org.springframework.data.domain.Pageable; +import springfox.documentation.annotations.ApiIgnore; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestBody; @@ -17,6 +18,7 @@ import java.util.List; +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringCodegen", date = "2016-07-13T14:49:07.020+02:00") @Api(value = "pet", description = "the pet API") public interface PetApi { @@ -26,14 +28,15 @@ public interface PetApi { @AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), @AuthorizationScope(scope = "read:pets", description = "read your pets") }) - }, tags={ "pet", }) - @ApiResponses(value = { + }, tags={ "pet", }) + + @ApiResponses(value = { @ApiResponse(code = 405, message = "Invalid input", response = Void.class) }) @RequestMapping(value = "/pet", - produces = { "application/xml", "application/json" }, + produces = { "application/json", "application/xml" }, consumes = { "application/json", "application/xml" }, method = RequestMethod.POST) - ResponseEntity addPet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @RequestBody Pet body); + ResponseEntity addPet(@ApiParam(value = "Pet object that needs to be added to the store" ) @RequestBody Pet body); @ApiOperation(value = "Deletes a pet", notes = "", response = Void.class, authorizations = { @@ -41,56 +44,73 @@ public interface PetApi { @AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), @AuthorizationScope(scope = "read:pets", description = "read your pets") }) - }, tags={ "pet", }) - @ApiResponses(value = { + }, tags={ "pet", }) + + @ApiResponses(value = { @ApiResponse(code = 400, message = "Invalid pet value", response = Void.class) }) @RequestMapping(value = "/pet/{petId}", - produces = { "application/xml", "application/json" }, + produces = { "application/json", "application/xml" }, 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); - @ApiOperation(value = "Finds Pets by status", notes = "Multiple status values can be provided with comma separated strings", response = Pet.class, responseContainer = "List", authorizations = { + @ApiOperation(value = "Finds Pets by status", notes = "Multiple status values can be provided with comma seperated strings", response = Pet.class, responseContainer = "List", authorizations = { @Authorization(value = "petstore_auth", scopes = { @AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), @AuthorizationScope(scope = "read:pets", description = "read your pets") }) - }, tags={ "pet", }) - @ApiResponses(value = { + }, tags={ "pet", }) + @ApiImplicitParams({ + @ApiImplicitParam(name = "page", dataType = "integer", paramType = "query", + value = "Results page you want to retrieve (0..N)"), + @ApiImplicitParam(name = "size", dataType = "integer", paramType = "query", + value = "Number of records per page."), + @ApiImplicitParam(name = "sort", allowMultiple = true, dataType = "string", paramType = "query", + value = "Sorting criteria in the format: property(,asc|desc). " + + "Default sort order is ascending. " + + "Multiple sort criteria are supported.") + }) + @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" }, + produces = { "application/json", "application/xml" }, method = RequestMethod.GET) - ResponseEntity> findPetsByStatus(@ApiParam(value = "Status values that need to be considered for filter", required = true) @RequestParam(value = "status", required = true) List status); + ResponseEntity> findPetsByStatus(@ApiParam(value = "Status values that need to be considered for filter", defaultValue = "available") @RequestParam(value = "status", required = false, defaultValue="available") List status, @ApiIgnore final Pageable pageable); - @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 = { + @ApiOperation(value = "Finds Pets by tags", notes = "Muliple tags can be provided with comma seperated strings. Use tag1, tag2, tag3 for testing.", response = Pet.class, responseContainer = "List", authorizations = { @Authorization(value = "petstore_auth", scopes = { @AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), @AuthorizationScope(scope = "read:pets", description = "read your pets") }) - }, tags={ "pet", }) - @ApiResponses(value = { + }, tags={ "pet", }) + + @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" }, + produces = { "application/json", "application/xml" }, method = RequestMethod.GET) - ResponseEntity> findPetsByTags(@ApiParam(value = "Tags to filter by", required = true) @RequestParam(value = "tags", required = true) List tags); + ResponseEntity> findPetsByTags(@ApiParam(value = "Tags to filter by") @RequestParam(value = "tags", required = false) List tags); - @ApiOperation(value = "Find pet by ID", notes = "Returns a single pet", response = Pet.class, authorizations = { + @ApiOperation(value = "Find pet by ID", notes = "Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions", response = Pet.class, authorizations = { + @Authorization(value = "petstore_auth", scopes = { + @AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), + @AuthorizationScope(scope = "read:pets", description = "read your pets") + }), @Authorization(value = "api_key") - }, tags={ "pet", }) - @ApiResponses(value = { + }, tags={ "pet", }) + + @ApiResponses(value = { @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" }, + produces = { "application/json", "application/xml" }, method = RequestMethod.GET) - ResponseEntity getPetById(@ApiParam(value = "ID of pet to return",required=true ) @PathVariable("petId") Long petId); + ResponseEntity getPetById(@ApiParam(value = "ID of pet that needs to be fetched",required=true ) @PathVariable("petId") Long petId); @ApiOperation(value = "Update an existing pet", notes = "", response = Void.class, authorizations = { @@ -98,16 +118,17 @@ public interface PetApi { @AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), @AuthorizationScope(scope = "read:pets", description = "read your pets") }) - }, tags={ "pet", }) - @ApiResponses(value = { + }, tags={ "pet", }) + + @ApiResponses(value = { @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" }, + produces = { "application/json", "application/xml" }, consumes = { "application/json", "application/xml" }, method = RequestMethod.PUT) - ResponseEntity updatePet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @RequestBody Pet body); + ResponseEntity updatePet(@ApiParam(value = "Pet object that needs to be added to the store" ) @RequestBody Pet body); @ApiOperation(value = "Updates a pet in the store with form data", notes = "", response = Void.class, authorizations = { @@ -115,28 +136,30 @@ public interface PetApi { @AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), @AuthorizationScope(scope = "read:pets", description = "read your pets") }) - }, tags={ "pet", }) - @ApiResponses(value = { + }, tags={ "pet", }) + + @ApiResponses(value = { @ApiResponse(code = 405, message = "Invalid input", response = Void.class) }) @RequestMapping(value = "/pet/{petId}", - produces = { "application/xml", "application/json" }, + produces = { "application/json", "application/xml" }, consumes = { "application/x-www-form-urlencoded" }, method = RequestMethod.POST) - ResponseEntity updatePetWithForm(@ApiParam(value = "ID of pet that needs to be updated",required=true ) @PathVariable("petId") Long petId,@ApiParam(value = "Updated name of the pet" ) @RequestPart(value="name", required=false) String name,@ApiParam(value = "Updated status of the pet" ) @RequestPart(value="status", required=false) String status); + ResponseEntity updatePetWithForm(@ApiParam(value = "ID of pet that needs to be updated",required=true ) @PathVariable("petId") String 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 = { + @ApiOperation(value = "uploads an image", notes = "", response = Void.class, authorizations = { @Authorization(value = "petstore_auth", scopes = { @AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), @AuthorizationScope(scope = "read:pets", description = "read your pets") }) - }, tags={ "pet", }) - @ApiResponses(value = { - @ApiResponse(code = 200, message = "successful operation", response = ModelApiResponse.class) }) + }, tags={ "pet" }) + + @ApiResponses(value = { + @ApiResponse(code = 200, message = "successful operation", response = Void.class) }) @RequestMapping(value = "/pet/{petId}/uploadImage", - produces = { "application/json" }, + produces = { "application/json", "application/xml" }, 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); + 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 741f62712f4..4018f7a676f 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 @@ -2,10 +2,10 @@ import io.swagger.model.Pet; import java.io.File; -import io.swagger.model.ModelApiResponse; import io.swagger.annotations.*; - +import org.springframework.data.domain.Pageable; +import springfox.documentation.annotations.ApiIgnore; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.stereotype.Controller; @@ -19,11 +19,12 @@ import java.util.List; +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringCodegen", date = "2016-07-13T14:49:07.020+02:00") @Controller public class PetApiController implements PetApi { - public ResponseEntity addPet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @RequestBody Pet body) { + public ResponseEntity addPet(@ApiParam(value = "Pet object that needs to be added to the store" ) @RequestBody Pet body) { // do some magic! return new ResponseEntity(HttpStatus.OK); } @@ -34,38 +35,38 @@ public ResponseEntity deletePet(@ApiParam(value = "Pet id to delete",requi return new ResponseEntity(HttpStatus.OK); } - public ResponseEntity> findPetsByStatus(@ApiParam(value = "Status values that need to be considered for filter", required = true) @RequestParam(value = "status", required = true) List status) { + public ResponseEntity> findPetsByStatus(@ApiParam(value = "Status values that need to be considered for filter", defaultValue = "available") @RequestParam(value = "status", required = false, defaultValue="available") List status, @ApiIgnore final Pageable pageable) { // do some magic! return new ResponseEntity>(HttpStatus.OK); } - public ResponseEntity> findPetsByTags(@ApiParam(value = "Tags to filter by", required = true) @RequestParam(value = "tags", required = true) List tags) { + public ResponseEntity> findPetsByTags(@ApiParam(value = "Tags to filter by") @RequestParam(value = "tags", required = false) List tags) { // do some magic! return new ResponseEntity>(HttpStatus.OK); } - public ResponseEntity getPetById(@ApiParam(value = "ID of pet to return",required=true ) @PathVariable("petId") Long petId) { + public ResponseEntity getPetById(@ApiParam(value = "ID of pet that needs to be fetched",required=true ) @PathVariable("petId") Long petId) { // do some magic! return new ResponseEntity(HttpStatus.OK); } - public ResponseEntity updatePet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @RequestBody Pet body) { + public ResponseEntity updatePet(@ApiParam(value = "Pet object that needs to be added to the store" ) @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, + public ResponseEntity updatePetWithForm(@ApiParam(value = "ID of pet that needs to be updated",required=true ) @PathVariable("petId") String 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); } - public ResponseEntity uploadFile(@ApiParam(value = "ID of pet to update",required=true ) @PathVariable("petId") Long petId, + 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) { // do some magic! - return new ResponseEntity(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 f5526de9862..12996cab2c9 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 @@ -4,6 +4,8 @@ import io.swagger.model.Order; import io.swagger.annotations.*; +import org.springframework.data.domain.Pageable; +import springfox.documentation.annotations.ApiIgnore; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestBody; @@ -16,49 +18,54 @@ import java.util.List; +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringCodegen", date = "2016-07-13T14:49:07.020+02:00") @Api(value = "store", description = "the store API") public interface StoreApi { - @ApiOperation(value = "Delete purchase order by ID", notes = "For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors", response = Void.class, tags={ "store", }) - @ApiResponses(value = { + @ApiOperation(value = "Delete purchase order by ID", notes = "For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors", response = Void.class, tags={ "store", }) + + @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/xml", "application/json" }, + produces = { "application/json", "application/xml" }, method = RequestMethod.DELETE) 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 = { @Authorization(value = "api_key") - }, tags={ "store", }) - @ApiResponses(value = { + }, tags={ "store", }) + + @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Integer.class) }) @RequestMapping(value = "/store/inventory", - produces = { "application/json" }, + produces = { "application/json", "application/xml" }, method = RequestMethod.GET) 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", }) - @ApiResponses(value = { + @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", }) + + @ApiResponses(value = { @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/xml", "application/json" }, + produces = { "application/json", "application/xml" }, method = RequestMethod.GET) - ResponseEntity getOrderById(@ApiParam(value = "ID of pet that needs to be fetched",required=true ) @PathVariable("orderId") Long orderId); + ResponseEntity getOrderById(@ApiParam(value = "ID of pet that needs to be fetched",required=true ) @PathVariable("orderId") String orderId); - @ApiOperation(value = "Place an order for a pet", notes = "", response = Order.class, tags={ "store", }) - @ApiResponses(value = { + @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" }, + produces = { "application/json", "application/xml" }, method = RequestMethod.POST) - ResponseEntity placeOrder(@ApiParam(value = "order placed for purchasing the pet" ,required=true ) @RequestBody Order body); + ResponseEntity placeOrder(@ApiParam(value = "order placed for purchasing the pet" ) @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 bd582ae1a94..eb99de6b0d0 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 @@ -4,7 +4,8 @@ import io.swagger.model.Order; import io.swagger.annotations.*; - +import org.springframework.data.domain.Pageable; +import springfox.documentation.annotations.ApiIgnore; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.stereotype.Controller; @@ -18,6 +19,7 @@ import java.util.List; +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringCodegen", date = "2016-07-13T14:49:07.020+02:00") @Controller public class StoreApiController implements StoreApi { @@ -32,12 +34,12 @@ public ResponseEntity> getInventory() { return new ResponseEntity>(HttpStatus.OK); } - public ResponseEntity getOrderById(@ApiParam(value = "ID of pet that needs to be fetched",required=true ) @PathVariable("orderId") Long orderId) { + public ResponseEntity getOrderById(@ApiParam(value = "ID of pet that needs to be fetched",required=true ) @PathVariable("orderId") String orderId) { // do some magic! return new ResponseEntity(HttpStatus.OK); } - public ResponseEntity placeOrder(@ApiParam(value = "order placed for purchasing the pet" ,required=true ) @RequestBody Order body) { + public ResponseEntity placeOrder(@ApiParam(value = "order placed for purchasing the pet" ) @RequestBody Order body) { // do some magic! 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 14658ede06a..1180fdfae6b 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 @@ -4,6 +4,8 @@ import java.util.List; import io.swagger.annotations.*; +import org.springframework.data.domain.Pageable; +import springfox.documentation.annotations.ApiIgnore; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestBody; @@ -16,84 +18,93 @@ import java.util.List; +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringCodegen", date = "2016-07-13T14:49:07.020+02:00") @Api(value = "user", description = "the user API") 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 = { + @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" }, + produces = { "application/json", "application/xml" }, method = RequestMethod.POST) - ResponseEntity createUser(@ApiParam(value = "Created user object" ,required=true ) @RequestBody User body); + ResponseEntity createUser(@ApiParam(value = "Created user object" ) @RequestBody User body); - @ApiOperation(value = "Creates list of users with given input array", notes = "", response = Void.class, tags={ "user", }) - @ApiResponses(value = { + @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" }, + produces = { "application/json", "application/xml" }, method = RequestMethod.POST) - ResponseEntity createUsersWithArrayInput(@ApiParam(value = "List of user object" ,required=true ) @RequestBody List body); + ResponseEntity createUsersWithArrayInput(@ApiParam(value = "List of user object" ) @RequestBody List body); - @ApiOperation(value = "Creates list of users with given input array", notes = "", response = Void.class, tags={ "user", }) - @ApiResponses(value = { + @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" }, + produces = { "application/json", "application/xml" }, method = RequestMethod.POST) - ResponseEntity createUsersWithListInput(@ApiParam(value = "List of user object" ,required=true ) @RequestBody List body); + ResponseEntity createUsersWithListInput(@ApiParam(value = "List of user object" ) @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 = { + @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" }, + produces = { "application/json", "application/xml" }, method = RequestMethod.DELETE) 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", }) - @ApiResponses(value = { + @ApiOperation(value = "Get user by user name", notes = "", response = User.class, tags={ "user", }) + + @ApiResponses(value = { @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" }, + produces = { "application/json", "application/xml" }, method = RequestMethod.GET) 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 = { + @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" }, + produces = { "application/json", "application/xml" }, method = RequestMethod.GET) - ResponseEntity loginUser(@ApiParam(value = "The user name for login", required = true) @RequestParam(value = "username", required = true) String username,@ApiParam(value = "The password for login in clear text", required = true) @RequestParam(value = "password", required = true) String password); + ResponseEntity loginUser(@ApiParam(value = "The user name for login") @RequestParam(value = "username", required = false) String username,@ApiParam(value = "The password for login in clear text") @RequestParam(value = "password", required = false) String password); - @ApiOperation(value = "Logs out current logged in user session", notes = "", response = Void.class, tags={ "user", }) - @ApiResponses(value = { + @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" }, + produces = { "application/json", "application/xml" }, method = RequestMethod.GET) ResponseEntity logoutUser(); - @ApiOperation(value = "Updated user", notes = "This can only be done by the logged in user.", response = Void.class, tags={ "user", }) - @ApiResponses(value = { + @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" }, + produces = { "application/json", "application/xml" }, 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 ) @RequestBody User body); + ResponseEntity updateUser(@ApiParam(value = "name that need to be deleted",required=true ) @PathVariable("username") String username,@ApiParam(value = "Updated user object" ) @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 a5a6d4d4505..d5d791b7ef9 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 @@ -4,7 +4,8 @@ import java.util.List; import io.swagger.annotations.*; - +import org.springframework.data.domain.Pageable; +import springfox.documentation.annotations.ApiIgnore; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.stereotype.Controller; @@ -18,21 +19,22 @@ import java.util.List; +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringCodegen", date = "2016-07-13T14:49:07.020+02:00") @Controller public class UserApiController implements UserApi { - public ResponseEntity createUser(@ApiParam(value = "Created user object" ,required=true ) @RequestBody User body) { + public ResponseEntity createUser(@ApiParam(value = "Created user object" ) @RequestBody User body) { // do some magic! return new ResponseEntity(HttpStatus.OK); } - public ResponseEntity createUsersWithArrayInput(@ApiParam(value = "List of user object" ,required=true ) @RequestBody List body) { + public ResponseEntity createUsersWithArrayInput(@ApiParam(value = "List of user object" ) @RequestBody List body) { // do some magic! return new ResponseEntity(HttpStatus.OK); } - public ResponseEntity createUsersWithListInput(@ApiParam(value = "List of user object" ,required=true ) @RequestBody List body) { + public ResponseEntity createUsersWithListInput(@ApiParam(value = "List of user object" ) @RequestBody List body) { // do some magic! return new ResponseEntity(HttpStatus.OK); } @@ -47,8 +49,8 @@ public ResponseEntity getUserByName(@ApiParam(value = "The name that needs return new ResponseEntity(HttpStatus.OK); } - public ResponseEntity loginUser(@ApiParam(value = "The user name for login", required = true) @RequestParam(value = "username", required = true) String username, - @ApiParam(value = "The password for login in clear text", required = true) @RequestParam(value = "password", required = true) String password) { + public ResponseEntity loginUser(@ApiParam(value = "The user name for login") @RequestParam(value = "username", required = false) String username, + @ApiParam(value = "The password for login in clear text") @RequestParam(value = "password", required = false) String password) { // do some magic! return new ResponseEntity(HttpStatus.OK); } @@ -59,7 +61,7 @@ public ResponseEntity 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 ) @RequestBody User body) { + @ApiParam(value = "Updated user object" ) @RequestBody User body) { // do some magic! return new ResponseEntity(HttpStatus.OK); } diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/configuration/SwaggerDocumentationConfig.java b/samples/server/petstore/springboot/src/main/java/io/swagger/configuration/SwaggerDocumentationConfig.java index bd923ba0350..77db65ca3a1 100644 --- a/samples/server/petstore/springboot/src/main/java/io/swagger/configuration/SwaggerDocumentationConfig.java +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/configuration/SwaggerDocumentationConfig.java @@ -10,6 +10,7 @@ import springfox.documentation.spi.DocumentationType; import springfox.documentation.spring.web.plugins.Docket; +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringCodegen", date = "2016-07-13T14:49:07.020+02:00") @Configuration public class SwaggerDocumentationConfig { @@ -17,12 +18,12 @@ public class SwaggerDocumentationConfig { ApiInfo apiInfo() { return new ApiInfoBuilder() .title("Swagger Petstore") - .description("This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.") + .description("This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters") .license("Apache 2.0") .licenseUrl("http://www.apache.org/licenses/LICENSE-2.0.html") .termsOfServiceUrl("") .version("1.0.0") - .contact(new Contact("","", "apiteam@swagger.io")) + .contact(new Contact("","", "apiteam@wordnik.com")) .build(); } 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 67bc75b3b10..e0b5e958e98 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 @@ -9,6 +9,7 @@ +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringCodegen", date = "2016-07-13T14:49:07.020+02:00") public class Category { 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 deleted file mode 100644 index 5e3aa82bbee..00000000000 --- a/samples/server/petstore/springboot/src/main/java/io/swagger/model/ModelApiResponse.java +++ /dev/null @@ -1,113 +0,0 @@ -package io.swagger.model; - -import java.util.Objects; -import com.fasterxml.jackson.annotation.JsonProperty; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; - - - - - - -public class ModelApiResponse { - - private Integer code = null; - private String type = null; - private String message = null; - - /** - **/ - public ModelApiResponse code(Integer code) { - this.code = code; - return this; - } - - - @ApiModelProperty(value = "") - @JsonProperty("code") - public Integer getCode() { - return code; - } - public void setCode(Integer code) { - this.code = code; - } - - /** - **/ - public ModelApiResponse type(String type) { - this.type = type; - return this; - } - - - @ApiModelProperty(value = "") - @JsonProperty("type") - public String getType() { - return type; - } - public void setType(String type) { - this.type = type; - } - - /** - **/ - public ModelApiResponse message(String message) { - this.message = message; - return this; - } - - - @ApiModelProperty(value = "") - @JsonProperty("message") - public String getMessage() { - return message; - } - public void setMessage(String message) { - this.message = message; - } - - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - ModelApiResponse _apiResponse = (ModelApiResponse) o; - return Objects.equals(code, _apiResponse.code) && - Objects.equals(type, _apiResponse.type) && - Objects.equals(message, _apiResponse.message); - } - - @Override - public int hashCode() { - return Objects.hash(code, type, message); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class ModelApiResponse {\n"); - - sb.append(" code: ").append(toIndentedString(code)).append("\n"); - sb.append(" type: ").append(toIndentedString(type)).append("\n"); - sb.append(" message: ").append(toIndentedString(message)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } -} - 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 55859fc4089..c46978b7c3f 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 @@ -11,6 +11,7 @@ +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringCodegen", date = "2016-07-13T14:49:07.020+02:00") public class Order { @@ -39,7 +40,7 @@ public String toString() { } private StatusEnum status = null; - private Boolean complete = false; + private Boolean complete = null; /** **/ 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 24092cbee25..3f2e15cc365 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 @@ -14,6 +14,7 @@ +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringCodegen", date = "2016-07-13T14:49:07.020+02:00") public class Pet { 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 f26d84e74b2..3a1737e4848 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 @@ -9,6 +9,7 @@ +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringCodegen", date = "2016-07-13T14:49:07.020+02:00") public class Tag { 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 5dc291a7889..bd13f3ab796 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 @@ -9,6 +9,7 @@ +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringCodegen", date = "2016-07-13T14:49:07.020+02:00") public class User { diff --git a/samples/server/petstore/springboot/src/main/resources/application.properties b/samples/server/petstore/springboot/src/main/resources/application.properties index 22fb546ba98..67597b592c1 100644 --- a/samples/server/petstore/springboot/src/main/resources/application.properties +++ b/samples/server/petstore/springboot/src/main/resources/application.properties @@ -1,3 +1,7 @@ +#SpringBoot application.properties springfox.documentation.swagger.v2.path=/api-docs server.contextPath=/v2 -#server.port=8090 \ No newline at end of file +#server.port=8090 + +#Remove this exclusion for use Jpa. But don't miss to declare datasource before... +spring.autoconfigure.exclude=org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration,org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration \ No newline at end of file