From 7cc9581f042b6a0ff0d74ce158540fecc43fd48e Mon Sep 17 00:00:00 2001 From: Dilip Krishnan Date: Sun, 12 Jul 2015 20:50:32 -0500 Subject: [PATCH] Updated the mustache template to remove the spurious import Also regenerated the spring-mvc server sample --- .../src/main/resources/JavaSpringMVC/api.mustache | 6 +++--- samples/server/petstore/spring-mvc/README.md | 3 ++- samples/server/petstore/spring-mvc/pom.xml | 4 +--- .../spring-mvc/src/main/java/io/swagger/api/PetApi.java | 2 +- .../spring-mvc/src/main/java/io/swagger/api/UserApi.java | 8 ++++---- 5 files changed, 11 insertions(+), 12 deletions(-) diff --git a/modules/swagger-codegen/src/main/resources/JavaSpringMVC/api.mustache b/modules/swagger-codegen/src/main/resources/JavaSpringMVC/api.mustache index 4f3c5489169..d6a24b69311 100644 --- a/modules/swagger-codegen/src/main/resources/JavaSpringMVC/api.mustache +++ b/modules/swagger-codegen/src/main/resources/JavaSpringMVC/api.mustache @@ -8,8 +8,8 @@ import {{modelPackage}}.*; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; +import io.swagger.annotations.ApiResponse; import io.swagger.annotations.ApiResponses; -import io.swagger.model.ApiResponse; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; @@ -35,8 +35,8 @@ public class {{classname}} { {{#operation}} @ApiOperation(value = "{{{summary}}}", notes = "{{{notes}}}", response = {{{returnType}}}.class{{#returnContainer}}, responseContainer = "{{{returnContainer}}}"{{/returnContainer}}) - @io.swagger.annotations.ApiResponses(value = { {{#responses}} - @io.swagger.annotations.ApiResponse(code = {{{code}}}, message = "{{{message}}}"){{#hasMore}},{{/hasMore}}{{/responses}} }) + @ApiResponses(value = { {{#responses}} + @ApiResponse(code = {{{code}}}, message = "{{{message}}}"){{#hasMore}},{{/hasMore}}{{/responses}} }) @RequestMapping(value = "{{path}}", {{#hasProduces}}produces = { {{#produces}}"{{mediaType}}"{{#hasMore}}, {{/hasMore}}{{/produces}} }, {{/hasProduces}} {{#hasConsumes}}consumes = { {{#consumes}}"{{mediaType}}"{{#hasMore}}, {{/hasMore}}{{/consumes}} },{{/hasConsumes}} diff --git a/samples/server/petstore/spring-mvc/README.md b/samples/server/petstore/spring-mvc/README.md index 3ec7c5d70ea..3fa87e70893 100644 --- a/samples/server/petstore/spring-mvc/README.md +++ b/samples/server/petstore/spring-mvc/README.md @@ -8,4 +8,5 @@ This server was generated by the [swagger-codegen](https://github.com/swagger-ap The underlying library integrating swagger to Spring-MVC is [springfox](https://github.com/springfox/springfox) -You can view the server in swagger-ui by pointing to http://localhost:8002/v2/sdoc.jsp \ No newline at end of file +You can view the server in swagger-ui by pointing to +http://localhost:8002/v2/swagger-ui.html \ No newline at end of file diff --git a/samples/server/petstore/spring-mvc/pom.xml b/samples/server/petstore/spring-mvc/pom.xml index 0aaf79440b4..1b49d0a4691 100644 --- a/samples/server/petstore/spring-mvc/pom.xml +++ b/samples/server/petstore/spring-mvc/pom.xml @@ -33,8 +33,7 @@ /v2 - target/${project.artifactId}-${project-version} - ${project.basedir}/conf/jetty/webdefault.xml + target/${project.artifactId}-${project.version} 8079 stopit @@ -153,7 +152,6 @@ 1.5.0 9.2.9.v20150224 - 2.1.0-M2 1.13 1.6.3 1.6.1 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 6264ec78567..52ddc63c23c 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 @@ -171,7 +171,7 @@ public class PetApi { @ApiOperation(value = "uploads an image", notes = "", response = Void.class) @ApiResponses(value = { - @ApiResponse(code = 0, message = "successful operation") }) + @ApiResponse(code = 200, message = "successful operation") }) @RequestMapping(value = "/{petId}/uploadImage", produces = { "application/json", "application/xml" }, consumes = { "multipart/form-data" }, 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 35227db7c67..dd5fbc6c279 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 @@ -35,7 +35,7 @@ public class UserApi { @ApiOperation(value = "Create user", notes = "This can only be done by the logged in user.", response = Void.class) @ApiResponses(value = { - @ApiResponse(code = 0, message = "successful operation") }) + @ApiResponse(code = 200, message = "successful operation") }) @RequestMapping(value = "", produces = { "application/json", "application/xml" }, @@ -52,7 +52,7 @@ public class UserApi { @ApiOperation(value = "Creates list of users with given input array", notes = "", response = Void.class) @ApiResponses(value = { - @ApiResponse(code = 0, message = "successful operation") }) + @ApiResponse(code = 200, message = "successful operation") }) @RequestMapping(value = "/createWithArray", produces = { "application/json", "application/xml" }, @@ -69,7 +69,7 @@ public class UserApi { @ApiOperation(value = "Creates list of users with given input array", notes = "", response = Void.class) @ApiResponses(value = { - @ApiResponse(code = 0, message = "successful operation") }) + @ApiResponse(code = 200, message = "successful operation") }) @RequestMapping(value = "/createWithList", produces = { "application/json", "application/xml" }, @@ -107,7 +107,7 @@ public class UserApi { @ApiOperation(value = "Logs out current logged in user session", notes = "", response = Void.class) @ApiResponses(value = { - @ApiResponse(code = 0, message = "successful operation") }) + @ApiResponse(code = 200, message = "successful operation") }) @RequestMapping(value = "/logout", produces = { "application/json", "application/xml" },