diff --git a/bin/spring-mvc-petstore-j8-async-server.sh b/bin/spring-mvc-petstore-j8-async-server.sh
index ddaa8f9d649f..75ec92940e69 100755
--- a/bin/spring-mvc-petstore-j8-async-server.sh
+++ b/bin/spring-mvc-petstore-j8-async-server.sh
@@ -26,6 +26,6 @@ fi
# if you've executed sbt assembly previously it will use that instead.
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
-ags="$@ generate -t modules/swagger-codegen/src/main/resources/JavaSpringMVC -i modules/swagger-codegen/src/test/resources/2_0/petstore.yaml -l spring --library spring-mvc -o samples/server/petstore/spring-mvc-j8-async -c bin/spring-mvc-petstore-j8-async.json -DhideGenerationTimestamp=true,java8=true,async=true"
+ags="$@ generate -t modules/swagger-codegen/src/main/resources/JavaSpringBoot -i modules/swagger-codegen/src/test/resources/2_0/petstore.yaml -l spring --library spring-mvc -o samples/server/petstore/spring-mvc-j8-async -c bin/spring-mvc-petstore-j8-async.json -DhideGenerationTimestamp=true,java8=true,async=true"
java $JAVA_OPTS -jar $executable $ags
diff --git a/bin/spring-stubs.sh b/bin/spring-stubs.sh
index 3d13f2fe8b9a..3d748a5b6f50 100755
--- a/bin/spring-stubs.sh
+++ b/bin/spring-stubs.sh
@@ -26,6 +26,6 @@ fi
# if you've executed sbt assembly previously it will use that instead.
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
-ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore.yaml -l springboot -o samples/client/petstore/spring-stubs -DinterfaceOnly=true,singleContentTypes=true"
+ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore.yaml -l spring -o samples/client/petstore/spring-stubs -DinterfaceOnly=true,singleContentTypes=true,hideGenerationTimestamp=true"
java $JAVA_OPTS -jar $executable $ags
diff --git a/bin/springboot-petstore-server.sh b/bin/springboot-petstore-server.sh
index da94a4b08e3d..195bb033f0b2 100755
--- a/bin/springboot-petstore-server.sh
+++ b/bin/springboot-petstore-server.sh
@@ -26,7 +26,7 @@ fi
# if you've executed sbt assembly previously it will use that instead.
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
-ags="$@ generate -t modules/swagger-codegen/src/main/resources/JavaSpringBoot -i modules/swagger-codegen/src/test/resources/2_0/petstore.yaml -l spring --library=spring-boot -o samples/server/petstore/springboot -DhideGenerationTimestamp=true"
+ags="$@ generate -t modules/swagger-codegen/src/main/resources/JavaSpringBoot -i modules/swagger-codegen/src/test/resources/2_0/petstore.yaml -l spring -o samples/server/petstore/springboot -DhideGenerationTimestamp=true"
echo "Removing files and folders under samples/server/petstore/springboot/src/main"
rm -rf samples/server/petstore/springboot/src/main
diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/SpringBootServerCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/SpringBootServerCodegen.java
index 2ec7cd24dd3d..6c95c77c1f39 100644
--- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/SpringBootServerCodegen.java
+++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/SpringBootServerCodegen.java
@@ -47,6 +47,7 @@ public class SpringBootServerCodegen extends AbstractJavaCodegen {
supportedLibraries.put(DEFAULT_LIBRARY, "Spring-boot Server application using the SpringFox integration.");
supportedLibraries.put("spring-mvc", "Spring-MVC Server application using the SpringFox integration.");
+ setLibrary(DEFAULT_LIBRARY);
CliOption library = new CliOption(CodegenConstants.LIBRARY, "library template (sub-template) to use");
library.setDefault(DEFAULT_LIBRARY);
@@ -127,7 +128,7 @@ public class SpringBootServerCodegen extends AbstractJavaCodegen {
supportingFiles.add(new SupportingFile("application.properties",
("src.main.resources").replace(".", java.io.File.separator), "application.properties"));
}
- if (library.equals("mvc")) {
+ if (library.equals("spring-mvc")) {
supportingFiles.add(new SupportingFile("webApplication.mustache",
(sourceFolder + File.separator + configPackage).replace(".", java.io.File.separator), "WebApplication.java"));
supportingFiles.add(new SupportingFile("webMvcConfiguration.mustache",
diff --git a/modules/swagger-codegen/src/main/resources/JavaSpringBoot/libraries/spring-mvc/pom.mustache b/modules/swagger-codegen/src/main/resources/JavaSpringBoot/libraries/spring-mvc/pom.mustache
index 9b352e551c5b..6bb4bbd341b0 100644
--- a/modules/swagger-codegen/src/main/resources/JavaSpringBoot/libraries/spring-mvc/pom.mustache
+++ b/modules/swagger-codegen/src/main/resources/JavaSpringBoot/libraries/spring-mvc/pom.mustache
@@ -1,130 +1,147 @@
- 4.0.0
- {{groupId}}
- {{artifactId}}
- jar
- {{artifactId}}
- {{artifactVersion}}
-
- src/main/java
-
-
- org.apache.maven.plugins
- maven-war-plugin
- 2.6
-
-
- maven-failsafe-plugin
- 2.6
-
-
-
- integration-test
- verify
-
-
-
-
-
- org.eclipse.jetty
- jetty-maven-plugin
- ${jetty-version}
-
-
- {{^contextPath}}/{{/contextPath}}{{#contextPath}}{{contextPath}}{{/contextPath}}
-
- target/${project.artifactId}-${project.version}
- 8079
- stopit
-
- 8002
- 60000
-
-
-
-
- start-jetty
- pre-integration-test
-
- start
-
-
- 0
- true
-
-
-
- stop-jetty
- post-integration-test
-
- stop
-
-
-
-
-
-
-
-
- io.swagger
- swagger-jersey-jaxrs
- ${swagger-core-version}
-
-
- org.slf4j
- slf4j-log4j12
- ${slf4j-version}
-
+ 4.0.0
+ {{groupId}}
+ {{artifactId}}
+ jar
+ {{artifactId}}
+ {{artifactVersion}}
+
+ src/main/java
+
+
+ org.apache.maven.plugins
+ maven-war-plugin
+ 2.6
+
+
+ maven-failsafe-plugin
+ 2.6
+
+
+
+ integration-test
+ verify
+
+
+
+
+
+ org.eclipse.jetty
+ jetty-maven-plugin
+ ${jetty-version}
+
+
+ {{^contextPath}}/{{/contextPath}}{{#contextPath}}{{contextPath}}{{/contextPath}}
+
+ target/${project.artifactId}-${project.version}
+ 8079
+ stopit
+
+ 8002
+ 60000
+
+
+
+
+ start-jetty
+ pre-integration-test
+
+ start
+
+
+ 0
+ true
+
+
+
+ stop-jetty
+ post-integration-test
+
+ stop
+
+
+
+
+
+
+
+
+ org.slf4j
+ slf4j-log4j12
+ ${slf4j-version}
+
-
-
- org.springframework
- spring-core
- ${spring-version}
-
-
- org.springframework
- spring-webmvc
- ${spring-version}
-
-
- org.springframework
- spring-web
- ${spring-version}
-
+
+
+ org.springframework
+ spring-core
+ ${spring-version}
+
+
+ org.springframework
+ spring-webmvc
+ ${spring-version}
+
+
+ org.springframework
+ spring-web
+ ${spring-version}
+
-
-
- io.springfox
- springfox-swagger2
- ${springfox-version}
-
-
- io.springfox
- springfox-swagger-ui
- ${springfox-version}
-
+
+
+ io.springfox
+ springfox-swagger2
+ ${springfox-version}
+
+
+ io.springfox
+ springfox-swagger-ui
+ ${springfox-version}
+
-
- junit
- junit
- ${junit-version}
- test
-
-
- javax.servlet
- servlet-api
- ${servlet-api-version}
-
-
-
- 1.5.8
- 9.2.15.v20160210
- 1.13
- 1.7.21
- 4.12
- 2.5
- 2.4.0
- 4.2.5.RELEASE
-
+ {{#java8}}
+
+ com.fasterxml.jackson.datatype
+ jackson-datatype-jsr310
+ ${jackson-version}
+
+ {{/java8}}
+ {{^java8}}
+
+ com.fasterxml.jackson.datatype
+ jackson-datatype-joda
+ ${jackson-version}
+
+
+ joda-time
+ joda-time
+ 2.9.4
+
+ {{/java8}}
+
+
+ junit
+ junit
+ ${junit-version}
+ test
+
+
+ javax.servlet
+ servlet-api
+ ${servlet-api-version}
+
+
+
+ {{#java8}}1.8{{/java8}}{{^java8}}1.7{{/java8}}
+ ${java.version}
+ ${java.version}
+ 9.2.15.v20160210
+ 1.7.21
+ 4.12
+ 2.5
+ 2.4.0
+ 2.4.5
+ 4.2.5.RELEASE
+
diff --git a/modules/swagger-codegen/src/main/resources/JavaSpringBoot/libraries/spring-mvc/swaggerUiConfiguration.mustache b/modules/swagger-codegen/src/main/resources/JavaSpringBoot/libraries/spring-mvc/swaggerUiConfiguration.mustache
index 320ae03dbbdd..d4b4b62c7700 100644
--- a/modules/swagger-codegen/src/main/resources/JavaSpringBoot/libraries/spring-mvc/swaggerUiConfiguration.mustache
+++ b/modules/swagger-codegen/src/main/resources/JavaSpringBoot/libraries/spring-mvc/swaggerUiConfiguration.mustache
@@ -1,9 +1,13 @@
package {{configPackage}};
+import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
+import org.springframework.context.annotation.PropertySource;
+import org.springframework.context.annotation.Import;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
+import springfox.documentation.swagger2.annotations.EnableSwagger2;
{{>generatedAnnotation}}
@Configuration
diff --git a/modules/swagger-codegen/src/main/resources/JavaSpringBoot/swaggerDocumentationConfig.mustache b/modules/swagger-codegen/src/main/resources/JavaSpringBoot/swaggerDocumentationConfig.mustache
index 3a6503e02298..c9976db81499 100644
--- a/modules/swagger-codegen/src/main/resources/JavaSpringBoot/swaggerDocumentationConfig.mustache
+++ b/modules/swagger-codegen/src/main/resources/JavaSpringBoot/swaggerDocumentationConfig.mustache
@@ -31,11 +31,15 @@ public class SwaggerDocumentationConfig {
return new Docket(DocumentationType.SWAGGER_2)
.select()
.apis(RequestHandlerSelectors.basePackage("{{apiPackage}}"))
- .build(){{#java8}}
+ .build()
+ {{#java8}}
.directModelSubstitute(java.time.LocalDate.class, java.sql.Date.class)
- .directModelSubstitute(java.time.OffsetDateTime.class, java.util.Date.class){{/java8}}{{^java8}}
+ .directModelSubstitute(java.time.OffsetDateTime.class, java.util.Date.class)
+ {{/java8}}
+ {{^java8}}
.directModelSubstitute(org.joda.time.LocalDate.class, java.sql.Date.class)
- .directModelSubstitute(org.joda.time.DateTime.class, java.util.Date.class){{/java8}}
+ .directModelSubstitute(org.joda.time.DateTime.class, java.util.Date.class)
+ {{/java8}}
.apiInfo(apiInfo());
}
diff --git a/samples/client/petstore/spring-stubs/pom.xml b/samples/client/petstore/spring-stubs/pom.xml
index 975433d48c8c..48dc8da3f8a4 100644
--- a/samples/client/petstore/spring-stubs/pom.xml
+++ b/samples/client/petstore/spring-stubs/pom.xml
@@ -1,41 +1,50 @@
- 4.0.0
- io.swagger
- swagger-springboot-server
- jar
- swagger-springboot-server
- 1.0.0
-
- 2.4.0
-
-
- org.springframework.boot
- spring-boot-starter-parent
- 1.3.3.RELEASE
-
-
- src/main/java
-
-
-
- org.springframework.boot
- spring-boot-starter-web
-
-
- org.springframework.boot
- spring-boot-starter-tomcat
- provided
-
-
-
- io.springfox
- springfox-swagger2
- ${springfox-version}
-
-
- io.springfox
- springfox-swagger-ui
- ${springfox-version}
-
-
+ 4.0.0
+ io.swagger
+ swagger-spring-server
+ jar
+ swagger-spring-server
+ 1.0.0
+
+ 2.4.0
+
+
+ org.springframework.boot
+ spring-boot-starter-parent
+ 1.3.3.RELEASE
+
+
+ src/main/java
+
+
+
+ org.springframework.boot
+ spring-boot-starter-web
+
+
+ org.springframework.boot
+ spring-boot-starter-tomcat
+ provided
+
+
+
+ io.springfox
+ springfox-swagger2
+ ${springfox-version}
+
+
+ io.springfox
+ springfox-swagger-ui
+ ${springfox-version}
+
+
+
+ com.fasterxml.jackson.datatype
+ jackson-datatype-joda
+
+
+ joda-time
+ joda-time
+
+
\ No newline at end of file
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 d055f19cc23f..40c6924d1158 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
@@ -1,13 +1,10 @@
package io.swagger.api;
-import io.swagger.model.*;
-
import io.swagger.model.Pet;
import io.swagger.model.ModelApiResponse;
import java.io.File;
import io.swagger.annotations.*;
-
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
@@ -20,137 +17,135 @@ import org.springframework.web.multipart.MultipartFile;
import java.util.List;
-import static org.springframework.http.MediaType.*;
@Api(value = "pet", description = "the pet API")
-@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-06-06T14:29:44.961+02:00")
public interface PetApi {
- @ApiOperation(value = "Add a new pet to the store", 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")
- })
- })
- @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 ) @RequestBody Pet body);
+ @ApiOperation(value = "Add a new pet to the store", 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")
+ })
+ })
+ @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 ) @RequestBody Pet body);
- @ApiOperation(value = "Deletes a pet", 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")
- })
- })
- @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);
+ @ApiOperation(value = "Deletes a pet", 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")
+ })
+ })
+ @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);
- @ApiOperation(value = "Finds Pets by status", notes = "Multiple status values can be provided with comma separated 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")
- })
- })
- @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(@ApiParam(value = "Status values that need to be considered for filter", required = true) @RequestParam(value = "status", required = true) List status);
+ @ApiOperation(value = "Finds Pets by status", notes = "Multiple status values can be provided with comma separated 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")
+ })
+ })
+ @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(@ApiParam(value = "Status values that need to be considered for filter", required = true) @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 = {
- @Authorization(value = "petstore_auth", scopes = {
- @AuthorizationScope(scope = "write:pets", description = "modify pets in your account"),
- @AuthorizationScope(scope = "read:pets", description = "read your pets")
- })
- })
- @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(@ApiParam(value = "Tags to filter by", required = true) @RequestParam(value = "tags", required = true) List tags);
+ @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 = {
+ @Authorization(value = "petstore_auth", scopes = {
+ @AuthorizationScope(scope = "write:pets", description = "modify pets in your account"),
+ @AuthorizationScope(scope = "read:pets", description = "read your pets")
+ })
+ })
+ @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(@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 = {
- @Authorization(value = "api_key")
- })
- @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/json",
- consumes = "application/json",
- method = RequestMethod.GET)
- ResponseEntity getPetById(@ApiParam(value = "ID of pet to return",required=true ) @PathVariable("petId") Long petId);
+ @ApiOperation(value = "Find pet by ID", notes = "Returns a single pet", response = Pet.class, authorizations = {
+ @Authorization(value = "api_key")
+ })
+ @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/json",
+ consumes = "application/json",
+ method = RequestMethod.GET)
+ 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 = {
- @Authorization(value = "petstore_auth", scopes = {
- @AuthorizationScope(scope = "write:pets", description = "modify pets in your account"),
- @AuthorizationScope(scope = "read:pets", description = "read your pets")
- })
- })
- @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/json",
- consumes = "application/json",
- method = RequestMethod.PUT)
- ResponseEntity updatePet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @RequestBody Pet body);
+ @ApiOperation(value = "Update an existing pet", 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")
+ })
+ })
+ @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/json",
+ consumes = "application/json",
+ method = RequestMethod.PUT)
+ ResponseEntity updatePet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @RequestBody Pet body);
- @ApiOperation(value = "Updates a pet in the store with form data", 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")
- })
- })
- @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);
+ @ApiOperation(value = "Updates a pet in the store with form data", 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")
+ })
+ })
+ @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);
- @ApiOperation(value = "uploads an image", notes = "", response = ModelApiResponse.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")
- })
- })
- @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);
+ @ApiOperation(value = "uploads an image", notes = "", response = ModelApiResponse.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")
+ })
+ })
+ @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);
}
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 03c07525bb34..88c19d8540eb 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
@@ -1,12 +1,9 @@
package io.swagger.api;
-import io.swagger.model.*;
-
import java.util.Map;
import io.swagger.model.Order;
import io.swagger.annotations.*;
-
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
@@ -19,55 +16,53 @@ import org.springframework.web.multipart.MultipartFile;
import java.util.List;
-import static org.springframework.http.MediaType.*;
@Api(value = "store", description = "the store API")
-@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-06-06T14:29:44.961+02:00")
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)
- @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);
+ @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)
+ @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);
- @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")
- })
- @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