diff --git a/bin/spring-mvc-petstore-j8-async-server.sh b/bin/spring-mvc-petstore-j8-async-server.sh
index 2f8d9fb9cd67..ddaa8f9d649f 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-mvc -o samples/server/petstore/spring-mvc-j8-async -c bin/spring-mvc-petstore-j8-async.json"
+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"
java $JAVA_OPTS -jar $executable $ags
diff --git a/bin/spring-mvc-petstore-server.sh b/bin/spring-mvc-petstore-server.sh
index 14e33f2435b3..43e3cc0f58b2 100755
--- a/bin/spring-mvc-petstore-server.sh
+++ b/bin/spring-mvc-petstore-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-mvc -o samples/server/petstore/spring-mvc"
+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 -DhideGenerationTimestamp=true"
java $JAVA_OPTS -jar $executable $ags
diff --git a/bin/springboot-petstore-server.sh b/bin/springboot-petstore-server.sh
index 7fe3ac60e534..da94a4b08e3d 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 springboot -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 --library=spring-boot -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/JavaClientCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/JavaClientCodegen.java
index be80900505b4..f3f6bad4587b 100644
--- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/JavaClientCodegen.java
+++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/JavaClientCodegen.java
@@ -40,7 +40,6 @@ public class JavaClientCodegen extends AbstractJavaCodegen {
supportedLibraries.put(RETROFIT_2, "HTTP client: OkHttp 3.2.0. JSON processing: Gson 2.6.1 (Retrofit 2.0.2). Enable the RxJava adapter using '-DuseRxJava=true'. (RxJava 1.1.3)");
CliOption library = new CliOption(CodegenConstants.LIBRARY, "library template (sub-template) to use");
- library.setDefault(DEFAULT_LIBRARY);
library.setEnum(supportedLibraries);
library.setDefault(DEFAULT_LIBRARY);
cliOptions.add(library);
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 fb54e1bc7793..2ec7cd24dd3d 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
@@ -26,13 +26,13 @@ public class SpringBootServerCodegen extends AbstractJavaCodegen {
public SpringBootServerCodegen() {
super();
- outputFolder = "generated-code/javaSpringBoot";
+ outputFolder = "generated-code/javaSpring";
apiTestTemplateFiles.clear(); // TODO: add test template
embeddedTemplateDir = templateDir = "JavaSpringBoot";
apiPackage = "io.swagger.api";
modelPackage = "io.swagger.model";
invokerPackage = "io.swagger.api";
- artifactId = "swagger-springboot-server";
+ artifactId = "swagger-spring-server";
additionalProperties.put("title", title);
additionalProperties.put(CONFIG_PACKAGE, configPackage);
@@ -45,17 +45,14 @@ public class SpringBootServerCodegen extends AbstractJavaCodegen {
cliOptions.add(CliOption.newBoolean(JAVA_8, "use java8 default interface"));
cliOptions.add(CliOption.newBoolean(ASYNC, "use async Callable controllers"));
- supportedLibraries.put(DEFAULT_LIBRARY, "Default Spring Boot server stub.");
- supportedLibraries.put("j8-async", "Use async servlet feature and Java 8's default interface. Generating interface with service " +
- "declaration is useful when using Maven plugin. Just provide a implementation with @Controller to instantiate service." +
- "(DEPRECATED: use -Djava8=true,async=true instead)");
+ supportedLibraries.put(DEFAULT_LIBRARY, "Spring-boot Server application using the SpringFox integration.");
+ supportedLibraries.put("spring-mvc", "Spring-MVC Server application using the SpringFox integration.");
CliOption library = new CliOption(CodegenConstants.LIBRARY, "library template (sub-template) to use");
library.setDefault(DEFAULT_LIBRARY);
library.setEnum(supportedLibraries);
library.setDefault(DEFAULT_LIBRARY);
cliOptions.add(library);
-
}
@Override
@@ -65,7 +62,7 @@ public class SpringBootServerCodegen extends AbstractJavaCodegen {
@Override
public String getName() {
- return "springboot";
+ return "spring";
}
@Override
@@ -122,17 +119,24 @@ public class SpringBootServerCodegen extends AbstractJavaCodegen {
(sourceFolder + File.separator + apiPackage).replace(".", java.io.File.separator), "NotFoundException.java"));
supportingFiles.add(new SupportingFile("swaggerDocumentationConfig.mustache",
(sourceFolder + File.separator + configPackage).replace(".", java.io.File.separator), "SwaggerDocumentationConfig.java"));
- supportingFiles.add(new SupportingFile("homeController.mustache",
- (sourceFolder + File.separator + configPackage).replace(".", java.io.File.separator), "HomeController.java"));
- supportingFiles.add(new SupportingFile("swagger2SpringBoot.mustache",
- (sourceFolder + File.separator + basePackage).replace(".", java.io.File.separator), "Swagger2SpringBoot.java"));
- supportingFiles.add(new SupportingFile("application.properties",
- ("src.main.resources").replace(".", java.io.File.separator), "application.properties"));
- }
-
- if ("j8-async".equals(getLibrary())) {
- setJava8(true);
- setAsync(true);
+ if (library.equals(DEFAULT_LIBRARY)) {
+ supportingFiles.add(new SupportingFile("homeController.mustache",
+ (sourceFolder + File.separator + configPackage).replace(".", java.io.File.separator), "HomeController.java"));
+ supportingFiles.add(new SupportingFile("swagger2SpringBoot.mustache",
+ (sourceFolder + File.separator + basePackage).replace(".", java.io.File.separator), "Swagger2SpringBoot.java"));
+ supportingFiles.add(new SupportingFile("application.properties",
+ ("src.main.resources").replace(".", java.io.File.separator), "application.properties"));
+ }
+ if (library.equals("mvc")) {
+ supportingFiles.add(new SupportingFile("webApplication.mustache",
+ (sourceFolder + File.separator + configPackage).replace(".", java.io.File.separator), "WebApplication.java"));
+ supportingFiles.add(new SupportingFile("webMvcConfiguration.mustache",
+ (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",
+ ("src.main.resources").replace(".", java.io.File.separator), "swagger.properties"));
+ }
}
if (this.java8) {
diff --git a/modules/swagger-codegen/src/main/resources/JavaSpringBoot/apiResponseMessage.mustache b/modules/swagger-codegen/src/main/resources/JavaSpringBoot/apiResponseMessage.mustache
index 2b9a2b1f8c5b..579e57a15246 100644
--- a/modules/swagger-codegen/src/main/resources/JavaSpringBoot/apiResponseMessage.mustache
+++ b/modules/swagger-codegen/src/main/resources/JavaSpringBoot/apiResponseMessage.mustache
@@ -2,8 +2,8 @@ package {{apiPackage}};
import javax.xml.bind.annotation.XmlTransient;
-@javax.xml.bind.annotation.XmlRootElement
{{>generatedAnnotation}}
+@javax.xml.bind.annotation.XmlRootElement
public class ApiResponseMessage {
public static final int ERROR = 1;
public static final int WARNING = 2;
diff --git a/modules/swagger-codegen/src/main/resources/JavaSpringBoot/generatedAnnotation.mustache b/modules/swagger-codegen/src/main/resources/JavaSpringBoot/generatedAnnotation.mustache
index a47b6faa85b9..ad17a426e969 100644
--- a/modules/swagger-codegen/src/main/resources/JavaSpringBoot/generatedAnnotation.mustache
+++ b/modules/swagger-codegen/src/main/resources/JavaSpringBoot/generatedAnnotation.mustache
@@ -1 +1,3 @@
-{{^hideGenerationTimestamp}}@javax.annotation.Generated(value = "{{generatorClass}}", date = "{{generatedDate}}"){{/hideGenerationTimestamp}}
\ No newline at end of file
+{{^hideGenerationTimestamp}}
+@javax.annotation.Generated(value = "{{generatorClass}}", date = "{{generatedDate}}")
+{{/hideGenerationTimestamp}}
\ No newline at end of file
diff --git a/modules/swagger-codegen/src/main/resources/JavaSpringBoot/README.mustache b/modules/swagger-codegen/src/main/resources/JavaSpringBoot/libraries/spring-boot/README.mustache
similarity index 100%
rename from modules/swagger-codegen/src/main/resources/JavaSpringBoot/README.mustache
rename to modules/swagger-codegen/src/main/resources/JavaSpringBoot/libraries/spring-boot/README.mustache
diff --git a/modules/swagger-codegen/src/main/resources/JavaSpringBoot/homeController.mustache b/modules/swagger-codegen/src/main/resources/JavaSpringBoot/libraries/spring-boot/homeController.mustache
similarity index 100%
rename from modules/swagger-codegen/src/main/resources/JavaSpringBoot/homeController.mustache
rename to modules/swagger-codegen/src/main/resources/JavaSpringBoot/libraries/spring-boot/homeController.mustache
diff --git a/modules/swagger-codegen/src/main/resources/JavaSpringBoot/pom.mustache b/modules/swagger-codegen/src/main/resources/JavaSpringBoot/libraries/spring-boot/pom.mustache
similarity index 100%
rename from modules/swagger-codegen/src/main/resources/JavaSpringBoot/pom.mustache
rename to modules/swagger-codegen/src/main/resources/JavaSpringBoot/libraries/spring-boot/pom.mustache
diff --git a/modules/swagger-codegen/src/main/resources/JavaSpringBoot/swagger2SpringBoot.mustache b/modules/swagger-codegen/src/main/resources/JavaSpringBoot/libraries/spring-boot/swagger2SpringBoot.mustache
similarity index 100%
rename from modules/swagger-codegen/src/main/resources/JavaSpringBoot/swagger2SpringBoot.mustache
rename to modules/swagger-codegen/src/main/resources/JavaSpringBoot/libraries/spring-boot/swagger2SpringBoot.mustache
diff --git a/modules/swagger-codegen/src/main/resources/JavaSpringBoot/libraries/spring-mvc/README.mustache b/modules/swagger-codegen/src/main/resources/JavaSpringBoot/libraries/spring-mvc/README.mustache
new file mode 100644
index 000000000000..1354151afbbe
--- /dev/null
+++ b/modules/swagger-codegen/src/main/resources/JavaSpringBoot/libraries/spring-mvc/README.mustache
@@ -0,0 +1,12 @@
+# Swagger generated server
+
+Spring MVC Server
+
+
+## Overview
+This server was generated by the [swagger-codegen](https://github.com/swagger-api/swagger-codegen) project. By using the [OpenAPI-Spec](https://github.com/swagger-api/swagger-core), you can easily generate a server stub. This is an example of building a swagger-enabled server in Java using the Spring MVC framework.
+
+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{{^contextPath}}/{{/contextPath}}{{#contextPath}}{{contextPath}}{{/contextPath}}/swagger-ui.html
\ No newline at end of file
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
new file mode 100644
index 000000000000..9b352e551c5b
--- /dev/null
+++ b/modules/swagger-codegen/src/main/resources/JavaSpringBoot/libraries/spring-mvc/pom.mustache
@@ -0,0 +1,130 @@
+
+ 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}
+
+
+
+
+ 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}
+
+
+
+ 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
+
+
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
new file mode 100644
index 000000000000..320ae03dbbdd
--- /dev/null
+++ b/modules/swagger-codegen/src/main/resources/JavaSpringBoot/libraries/spring-mvc/swaggerUiConfiguration.mustache
@@ -0,0 +1,50 @@
+package {{configPackage}};
+
+import org.springframework.context.annotation.Configuration;
+import org.springframework.web.servlet.config.annotation.EnableWebMvc;
+import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
+import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
+
+{{>generatedAnnotation}}
+@Configuration
+@ComponentScan(basePackages = "{{apiPackage}}")
+@EnableWebMvc
+@EnableSwagger2 //Loads the spring beans required by the framework
+@PropertySource("classpath:swagger.properties")
+@Import(SwaggerDocumentationConfig.class)
+public class SwaggerUiConfiguration extends WebMvcConfigurerAdapter {
+ private static final String[] SERVLET_RESOURCE_LOCATIONS = { "/" };
+
+ private static final String[] CLASSPATH_RESOURCE_LOCATIONS = {
+ "classpath:/META-INF/resources/", "classpath:/resources/",
+ "classpath:/static/", "classpath:/public/" };
+
+ private static final String[] RESOURCE_LOCATIONS;
+ static {
+ RESOURCE_LOCATIONS = new String[CLASSPATH_RESOURCE_LOCATIONS.length
+ + SERVLET_RESOURCE_LOCATIONS.length];
+ System.arraycopy(SERVLET_RESOURCE_LOCATIONS, 0, RESOURCE_LOCATIONS, 0,
+ SERVLET_RESOURCE_LOCATIONS.length);
+ System.arraycopy(CLASSPATH_RESOURCE_LOCATIONS, 0, RESOURCE_LOCATIONS,
+ SERVLET_RESOURCE_LOCATIONS.length, CLASSPATH_RESOURCE_LOCATIONS.length);
+ }
+
+ private static final String[] STATIC_INDEX_HTML_RESOURCES;
+ static {
+ STATIC_INDEX_HTML_RESOURCES = new String[RESOURCE_LOCATIONS.length];
+ for (int i = 0; i < STATIC_INDEX_HTML_RESOURCES.length; i++) {
+ STATIC_INDEX_HTML_RESOURCES[i] = RESOURCE_LOCATIONS[i] + "index.html";
+ }
+ }
+
+ @Override
+ public void addResourceHandlers(ResourceHandlerRegistry registry) {
+ if (!registry.hasMappingForPattern("/webjars/**")) {
+ registry.addResourceHandler("/webjars/**").addResourceLocations("classpath:/META-INF/resources/webjars/");
+ }
+ if (!registry.hasMappingForPattern("/**")) {
+ registry.addResourceHandler("/**").addResourceLocations(RESOURCE_LOCATIONS);
+ }
+ }
+
+}
diff --git a/modules/swagger-codegen/src/main/resources/JavaSpringBoot/libraries/spring-mvc/webApplication.mustache b/modules/swagger-codegen/src/main/resources/JavaSpringBoot/libraries/spring-mvc/webApplication.mustache
new file mode 100644
index 000000000000..9c31004d13e1
--- /dev/null
+++ b/modules/swagger-codegen/src/main/resources/JavaSpringBoot/libraries/spring-mvc/webApplication.mustache
@@ -0,0 +1,22 @@
+package {{configPackage}};
+
+import org.springframework.web.servlet.support.AbstractAnnotationConfigDispatcherServletInitializer;
+
+{{>generatedAnnotation}}
+public class WebApplication extends AbstractAnnotationConfigDispatcherServletInitializer {
+
+ @Override
+ protected Class>[] getRootConfigClasses() {
+ return new Class[] { SwaggerUiConfiguration.class };
+ }
+
+ @Override
+ protected Class>[] getServletConfigClasses() {
+ return new Class>[] { WebMvcConfiguration.class };
+ }
+
+ @Override
+ protected String[] getServletMappings() {
+ return new String[] { "/" };
+ }
+}
diff --git a/modules/swagger-codegen/src/main/resources/JavaSpringBoot/libraries/spring-mvc/webMvcConfiguration.mustache b/modules/swagger-codegen/src/main/resources/JavaSpringBoot/libraries/spring-mvc/webMvcConfiguration.mustache
new file mode 100644
index 000000000000..d60c126316e0
--- /dev/null
+++ b/modules/swagger-codegen/src/main/resources/JavaSpringBoot/libraries/spring-mvc/webMvcConfiguration.mustache
@@ -0,0 +1,12 @@
+package {{configPackage}};
+
+import org.springframework.web.servlet.config.annotation.DefaultServletHandlerConfigurer;
+import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;
+
+{{>generatedAnnotation}}
+public class WebMvcConfiguration extends WebMvcConfigurationSupport {
+ @Override
+ public void configureDefaultServletHandling(DefaultServletHandlerConfigurer configurer) {
+ configurer.enable();
+ }
+}
diff --git a/modules/swagger-codegen/src/main/resources/JavaSpringBoot/model.mustache b/modules/swagger-codegen/src/main/resources/JavaSpringBoot/model.mustache
index b39a599ae714..d69af3892b3f 100644
--- a/modules/swagger-codegen/src/main/resources/JavaSpringBoot/model.mustache
+++ b/modules/swagger-codegen/src/main/resources/JavaSpringBoot/model.mustache
@@ -13,8 +13,8 @@ import java.util.Objects;
/**
* {{description}}
**/{{/description}}
-@ApiModel(description = "{{{description}}}")
{{>generatedAnnotation}}
+@ApiModel(description = "{{{description}}}")
public class {{classname}} {{#parent}}extends {{{parent}}}{{/parent}} {
{{#vars}}{{#isEnum}}
public enum {{datatypeWithEnum}} {
diff --git a/modules/swagger-codegen/src/main/resources/JavaSpringBoot/swaggerDocumentationConfig.mustache b/modules/swagger-codegen/src/main/resources/JavaSpringBoot/swaggerDocumentationConfig.mustache
index fc4af3892c66..3a6503e02298 100644
--- a/modules/swagger-codegen/src/main/resources/JavaSpringBoot/swaggerDocumentationConfig.mustache
+++ b/modules/swagger-codegen/src/main/resources/JavaSpringBoot/swaggerDocumentationConfig.mustache
@@ -10,10 +10,8 @@ import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
-
-
-@Configuration
{{>generatedAnnotation}}
+@Configuration
public class SwaggerDocumentationConfig {
ApiInfo apiInfo() {
diff --git a/samples/server/petstore/spring-mvc-j8-async/.swagger-codegen-ignore b/samples/server/petstore/spring-mvc-j8-async/.swagger-codegen-ignore
new file mode 100644
index 000000000000..19d3377182e2
--- /dev/null
+++ b/samples/server/petstore/spring-mvc-j8-async/.swagger-codegen-ignore
@@ -0,0 +1,23 @@
+# Swagger Codegen Ignore
+# Generated by swagger-codegen https://github.com/swagger-api/swagger-codegen
+
+# Use this file to prevent files from being overwritten by the generator.
+# The patterns follow closely to .gitignore or .dockerignore.
+
+# As an example, the C# client generator defines ApiClient.cs.
+# You can make changes and tell Swagger Codgen to ignore just this file by uncommenting the following line:
+#ApiClient.cs
+
+# You can match any string of characters against a directory, file or extension with a single asterisk (*):
+#foo/*/qux
+# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux
+
+# You can recursively match patterns against a directory, file or extension with a double asterisk (**):
+#foo/**/qux
+# Thsi matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux
+
+# You can also negate patterns with an exclamation (!).
+# For example, you can ignore all files in a docs folder with the file extension .md:
+#docs/*.md
+# Then explicitly reverse the ignore rule for a single file:
+#!docs/README.md
diff --git a/samples/server/petstore/spring-mvc-j8-async/LICENSE b/samples/server/petstore/spring-mvc-j8-async/LICENSE
new file mode 100644
index 000000000000..8dada3edaf50
--- /dev/null
+++ b/samples/server/petstore/spring-mvc-j8-async/LICENSE
@@ -0,0 +1,201 @@
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "{}"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright {yyyy} {name of copyright owner}
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
diff --git a/samples/server/petstore/spring-mvc-j8-async/pom.xml b/samples/server/petstore/spring-mvc-j8-async/pom.xml
index 767c386463f5..2ed37fac4424 100644
--- a/samples/server/petstore/spring-mvc-j8-async/pom.xml
+++ b/samples/server/petstore/spring-mvc-j8-async/pom.xml
@@ -1,9 +1,9 @@
4.0.0io.swagger
- swagger-spring-mvc-server
+ swagger-spring-serverjar
- swagger-spring-mvc-server
+ swagger-spring-server1.0.0src/main/java
@@ -11,7 +11,7 @@
org.apache.maven.pluginsmaven-war-plugin
- 2.1.1
+ 2.6maven-failsafe-plugin
@@ -62,15 +62,6 @@
-
- org.apache.maven.plugins
- maven-compiler-plugin
- 3.3
-
- 1.8
- 1.8
-
-
@@ -84,31 +75,6 @@
slf4j-log4j12${slf4j-version}
-
- com.sun.jersey
- jersey-core
- ${jersey-version}
-
-
- com.sun.jersey
- jersey-json
- ${jersey-version}
-
-
- com.sun.jersey
- jersey-servlet
- ${jersey-version}
-
-
- com.sun.jersey.contribs
- jersey-multipart
- ${jersey-version}
-
-
- com.sun.jersey
- jersey-server
- ${jersey-version}
-
@@ -151,21 +117,14 @@
${servlet-api-version}
-
-
- jcenter-snapshots
- jcenter
- http://oss.jfrog.org/artifactory/oss-snapshot-local/
-
- 1.5.8
- 9.2.9.v20150224
+ 9.2.15.v201602101.13
- 1.6.3
- 4.8.1
+ 1.7.21
+ 4.122.52.4.04.2.5.RELEASE
-
\ No newline at end of file
+
diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/ApiException.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/ApiException.java
index 041a8a204f3a..7ad012588481 100644
--- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/ApiException.java
+++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/ApiException.java
@@ -1,6 +1,6 @@
package io.swagger.api;
-@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-05-11T18:25:35.092+08:00")
+@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-06-14T14:20:46.451+02:00")
public class ApiException extends Exception{
private int code;
public ApiException (int code, String msg) {
diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/ApiOriginFilter.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/ApiOriginFilter.java
index 1276b3cfab00..422d964f227f 100644
--- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/ApiOriginFilter.java
+++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/ApiOriginFilter.java
@@ -5,7 +5,7 @@ import java.io.IOException;
import javax.servlet.*;
import javax.servlet.http.HttpServletResponse;
-@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-05-11T18:25:35.092+08:00")
+@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-06-14T14:20:46.451+02:00")
public class ApiOriginFilter implements javax.servlet.Filter {
@Override
public void doFilter(ServletRequest request, ServletResponse response,
diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/ApiResponseMessage.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/ApiResponseMessage.java
index 4859dc5c6c4e..7878287c94ab 100644
--- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/ApiResponseMessage.java
+++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/ApiResponseMessage.java
@@ -3,7 +3,7 @@ package io.swagger.api;
import javax.xml.bind.annotation.XmlTransient;
@javax.xml.bind.annotation.XmlRootElement
-@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-05-11T18:25:35.092+08:00")
+@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-06-14T14:20:46.451+02:00")
public class ApiResponseMessage {
public static final int ERROR = 1;
public static final int WARNING = 2;
diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/NotFoundException.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/NotFoundException.java
index 67027e9eb9e7..8ee65710f2e1 100644
--- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/NotFoundException.java
+++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/NotFoundException.java
@@ -1,6 +1,6 @@
package io.swagger.api;
-@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-05-11T18:25:35.092+08:00")
+@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-06-14T14:20:46.451+02:00")
public class NotFoundException extends ApiException {
private int code;
public NotFoundException (int code, String msg) {
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 363b8deee1d0..f2c159fbfac3 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
@@ -6,12 +6,9 @@ import io.swagger.model.Pet;
import io.swagger.model.ModelApiResponse;
import java.io.File;
-import java.util.concurrent.Callable;
-
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.annotations.Authorization;
import io.swagger.annotations.AuthorizationScope;
@@ -35,8 +32,8 @@ import static org.springframework.http.MediaType.*;
@Controller
@RequestMapping(value = "/pet", produces = {APPLICATION_JSON_VALUE})
@Api(value = "/pet", description = "the pet API")
-@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-05-11T18:25:35.092+08:00")
-public interface PetApi {
+@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-06-14T14:20:46.451+02:00")
+public class PetApi {
@ApiOperation(value = "Add a new pet to the store", notes = "", response = Void.class, authorizations = {
@Authorization(value = "petstore_auth", scopes = {
@@ -44,19 +41,19 @@ public interface PetApi {
@AuthorizationScope(scope = "read:pets", description = "read your pets")
})
})
- @ApiResponses(value = {
- @ApiResponse(code = 405, message = "Invalid input") })
- @RequestMapping(value = "",
+ @io.swagger.annotations.ApiResponses(value = {
+ @io.swagger.annotations.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 Callable> addPet(
+ public ResponseEntity addPet(
@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @RequestBody Pet body
)
throws NotFoundException {
// do some magic!
- return () -> new ResponseEntity(HttpStatus.OK);
+ return new ResponseEntity(HttpStatus.OK);
}
@@ -66,13 +63,13 @@ public interface PetApi {
@AuthorizationScope(scope = "read:pets", description = "read your pets")
})
})
- @ApiResponses(value = {
- @ApiResponse(code = 400, message = "Invalid pet value") })
- @RequestMapping(value = "/{petId}",
+ @io.swagger.annotations.ApiResponses(value = {
+ @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid pet value", response = Void.class) })
+ @RequestMapping(value = "/pet/{petId}",
produces = { "application/xml", "application/json" },
method = RequestMethod.DELETE)
- default Callable> deletePet(
+ public ResponseEntity deletePet(
@ApiParam(value = "Pet id to delete",required=true ) @PathVariable("petId") Long petId
,
@@ -82,7 +79,7 @@ public interface PetApi {
)
throws NotFoundException {
// do some magic!
- return () -> new ResponseEntity(HttpStatus.OK);
+ return new ResponseEntity(HttpStatus.OK);
}
@@ -92,20 +89,20 @@ public interface PetApi {
@AuthorizationScope(scope = "read:pets", description = "read your pets")
})
})
- @ApiResponses(value = {
- @ApiResponse(code = 200, message = "successful operation"),
- @ApiResponse(code = 400, message = "Invalid status value") })
- @RequestMapping(value = "/findByStatus",
+ @io.swagger.annotations.ApiResponses(value = {
+ @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Pet.class),
+ @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid status value", response = Pet.class) })
+ @RequestMapping(value = "/pet/findByStatus",
produces = { "application/xml", "application/json" },
method = RequestMethod.GET)
- default Callable>> 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", required = true) @RequestParam(value = "status", required = true) List status
)
throws NotFoundException {
// do some magic!
- return () -> new ResponseEntity>(HttpStatus.OK);
+ return new ResponseEntity>(HttpStatus.OK);
}
@@ -115,41 +112,41 @@ public interface PetApi {
@AuthorizationScope(scope = "read:pets", description = "read your pets")
})
})
- @ApiResponses(value = {
- @ApiResponse(code = 200, message = "successful operation"),
- @ApiResponse(code = 400, message = "Invalid tag value") })
- @RequestMapping(value = "/findByTags",
+ @io.swagger.annotations.ApiResponses(value = {
+ @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Pet.class),
+ @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid tag value", response = Pet.class) })
+ @RequestMapping(value = "/pet/findByTags",
produces = { "application/xml", "application/json" },
method = RequestMethod.GET)
- default Callable>> 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", required = true) @RequestParam(value = "tags", required = true) List tags
)
throws NotFoundException {
// do some magic!
- return () -> new ResponseEntity>(HttpStatus.OK);
+ return new ResponseEntity>(HttpStatus.OK);
}
@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"),
- @ApiResponse(code = 400, message = "Invalid ID supplied"),
- @ApiResponse(code = 404, message = "Pet not found") })
- @RequestMapping(value = "/{petId}",
+ @io.swagger.annotations.ApiResponses(value = {
+ @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Pet.class),
+ @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid ID supplied", response = Pet.class),
+ @io.swagger.annotations.ApiResponse(code = 404, message = "Pet not found", response = Pet.class) })
+ @RequestMapping(value = "/pet/{petId}",
produces = { "application/xml", "application/json" },
method = RequestMethod.GET)
- default Callable> getPetById(
+ public ResponseEntity getPetById(
@ApiParam(value = "ID of pet to return",required=true ) @PathVariable("petId") Long petId
)
throws NotFoundException {
// do some magic!
- return () -> new ResponseEntity(HttpStatus.OK);
+ return new ResponseEntity(HttpStatus.OK);
}
@@ -159,21 +156,21 @@ public interface PetApi {
@AuthorizationScope(scope = "read:pets", description = "read your pets")
})
})
- @ApiResponses(value = {
- @ApiResponse(code = 400, message = "Invalid ID supplied"),
- @ApiResponse(code = 404, message = "Pet not found"),
- @ApiResponse(code = 405, message = "Validation exception") })
- @RequestMapping(value = "",
+ @io.swagger.annotations.ApiResponses(value = {
+ @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid ID supplied", response = Void.class),
+ @io.swagger.annotations.ApiResponse(code = 404, message = "Pet not found", response = Void.class),
+ @io.swagger.annotations.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 Callable> updatePet(
+ public ResponseEntity updatePet(
@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @RequestBody Pet body
)
throws NotFoundException {
// do some magic!
- return () -> new ResponseEntity(HttpStatus.OK);
+ return new ResponseEntity(HttpStatus.OK);
}
@@ -183,13 +180,13 @@ public interface PetApi {
@AuthorizationScope(scope = "read:pets", description = "read your pets")
})
})
- @ApiResponses(value = {
- @ApiResponse(code = 405, message = "Invalid input") })
- @RequestMapping(value = "/{petId}",
+ @io.swagger.annotations.ApiResponses(value = {
+ @io.swagger.annotations.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 Callable> updatePetWithForm(
+ public ResponseEntity updatePetWithForm(
@ApiParam(value = "ID of pet that needs to be updated",required=true ) @PathVariable("petId") Long petId
,
@@ -205,7 +202,7 @@ public interface PetApi {
)
throws NotFoundException {
// do some magic!
- return () -> new ResponseEntity(HttpStatus.OK);
+ return new ResponseEntity(HttpStatus.OK);
}
@@ -215,13 +212,13 @@ public interface PetApi {
@AuthorizationScope(scope = "read:pets", description = "read your pets")
})
})
- @ApiResponses(value = {
- @ApiResponse(code = 200, message = "successful operation") })
- @RequestMapping(value = "/{petId}/uploadImage",
+ @io.swagger.annotations.ApiResponses(value = {
+ @io.swagger.annotations.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 Callable> uploadFile(
+ public ResponseEntity uploadFile(
@ApiParam(value = "ID of pet to update",required=true ) @PathVariable("petId") Long petId
,
@@ -236,7 +233,7 @@ public interface PetApi {
)
throws NotFoundException {
// do some magic!
- return () -> new ResponseEntity(HttpStatus.OK);
+ return 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
new file mode 100644
index 000000000000..f2c159fbfac3
--- /dev/null
+++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/PetApiController.java
@@ -0,0 +1,239 @@
+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.Api;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
+import io.swagger.annotations.ApiResponses;
+import io.swagger.annotations.Authorization;
+import io.swagger.annotations.AuthorizationScope;
+
+import org.springframework.http.HttpStatus;
+import org.springframework.http.ResponseEntity;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestHeader;
+import org.springframework.web.bind.annotation.RequestMapping;
+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.util.List;
+
+import static org.springframework.http.MediaType.*;
+
+@Controller
+@RequestMapping(value = "/pet", produces = {APPLICATION_JSON_VALUE})
+@Api(value = "/pet", description = "the pet API")
+@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-06-14T14:20:46.451+02:00")
+public class 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")
+ })
+ })
+ @io.swagger.annotations.ApiResponses(value = {
+ @io.swagger.annotations.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)
+ public ResponseEntity addPet(
+
+@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @RequestBody Pet body
+)
+ throws NotFoundException {
+ // do some magic!
+ return new ResponseEntity(HttpStatus.OK);
+ }
+
+
+ @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")
+ })
+ })
+ @io.swagger.annotations.ApiResponses(value = {
+ @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid pet value", response = Void.class) })
+ @RequestMapping(value = "/pet/{petId}",
+ produces = { "application/xml", "application/json" },
+
+ method = RequestMethod.DELETE)
+ 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
+
+)
+ throws NotFoundException {
+ // do some magic!
+ return new ResponseEntity(HttpStatus.OK);
+ }
+
+
+ @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")
+ })
+ })
+ @io.swagger.annotations.ApiResponses(value = {
+ @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Pet.class),
+ @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid status value", response = Pet.class) })
+ @RequestMapping(value = "/pet/findByStatus",
+ produces = { "application/xml", "application/json" },
+
+ method = RequestMethod.GET)
+ public ResponseEntity> findPetsByStatus(@ApiParam(value = "Status values that need to be considered for filter", required = true) @RequestParam(value = "status", required = true) List status
+
+
+)
+ throws NotFoundException {
+ // do some magic!
+ return new ResponseEntity>(HttpStatus.OK);
+ }
+
+
+ @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")
+ })
+ })
+ @io.swagger.annotations.ApiResponses(value = {
+ @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Pet.class),
+ @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid tag value", response = Pet.class) })
+ @RequestMapping(value = "/pet/findByTags",
+ produces = { "application/xml", "application/json" },
+
+ method = RequestMethod.GET)
+ public ResponseEntity> findPetsByTags(@ApiParam(value = "Tags to filter by", required = true) @RequestParam(value = "tags", required = true) List tags
+
+
+)
+ throws NotFoundException {
+ // do some magic!
+ return new ResponseEntity>(HttpStatus.OK);
+ }
+
+
+ @ApiOperation(value = "Find pet by ID", notes = "Returns a single pet", response = Pet.class, authorizations = {
+ @Authorization(value = "api_key")
+ })
+ @io.swagger.annotations.ApiResponses(value = {
+ @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Pet.class),
+ @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid ID supplied", response = Pet.class),
+ @io.swagger.annotations.ApiResponse(code = 404, message = "Pet not found", response = Pet.class) })
+ @RequestMapping(value = "/pet/{petId}",
+ produces = { "application/xml", "application/json" },
+
+ method = RequestMethod.GET)
+ public ResponseEntity getPetById(
+@ApiParam(value = "ID of pet to return",required=true ) @PathVariable("petId") Long petId
+
+)
+ throws NotFoundException {
+ // do some magic!
+ return new ResponseEntity(HttpStatus.OK);
+ }
+
+
+ @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")
+ })
+ })
+ @io.swagger.annotations.ApiResponses(value = {
+ @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid ID supplied", response = Void.class),
+ @io.swagger.annotations.ApiResponse(code = 404, message = "Pet not found", response = Void.class),
+ @io.swagger.annotations.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)
+ public ResponseEntity updatePet(
+
+@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @RequestBody Pet body
+)
+ throws NotFoundException {
+ // do some magic!
+ return new ResponseEntity(HttpStatus.OK);
+ }
+
+
+ @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")
+ })
+ })
+ @io.swagger.annotations.ApiResponses(value = {
+ @io.swagger.annotations.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)
+ 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
+)
+ throws NotFoundException {
+ // do some magic!
+ return new ResponseEntity(HttpStatus.OK);
+ }
+
+
+ @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")
+ })
+ })
+ @io.swagger.annotations.ApiResponses(value = {
+ @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = ModelApiResponse.class) })
+ @RequestMapping(value = "/pet/{petId}/uploadImage",
+ produces = { "application/json" },
+ consumes = { "multipart/form-data" },
+ method = RequestMethod.POST)
+ 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
+)
+ throws NotFoundException {
+ // do some magic!
+ return new ResponseEntity(HttpStatus.OK);
+ }
+
+}
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 f5c454b68e17..16d98f709f44 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
@@ -5,12 +5,9 @@ import io.swagger.model.*;
import java.util.Map;
import io.swagger.model.Order;
-import java.util.concurrent.Callable;
-
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.annotations.Authorization;
import io.swagger.annotations.AuthorizationScope;
@@ -34,77 +31,77 @@ import static org.springframework.http.MediaType.*;
@Controller
@RequestMapping(value = "/store", produces = {APPLICATION_JSON_VALUE})
@Api(value = "/store", description = "the store API")
-@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-05-11T18:25:35.092+08:00")
-public interface StoreApi {
+@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-06-14T14:20:46.451+02:00")
+public class 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"),
- @ApiResponse(code = 404, message = "Order not found") })
- @RequestMapping(value = "/order/{orderId}",
+ @io.swagger.annotations.ApiResponses(value = {
+ @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid ID supplied", response = Void.class),
+ @io.swagger.annotations.ApiResponse(code = 404, message = "Order not found", response = Void.class) })
+ @RequestMapping(value = "/store/order/{orderId}",
produces = { "application/xml", "application/json" },
method = RequestMethod.DELETE)
- default Callable> deleteOrder(
+ public ResponseEntity deleteOrder(
@ApiParam(value = "ID of the order that needs to be deleted",required=true ) @PathVariable("orderId") String orderId
)
throws NotFoundException {
// do some magic!
- return () -> new ResponseEntity(HttpStatus.OK);
+ return new ResponseEntity(HttpStatus.OK);
}
@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") })
- @RequestMapping(value = "/inventory",
+ @io.swagger.annotations.ApiResponses(value = {
+ @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Integer.class) })
+ @RequestMapping(value = "/store/inventory",
produces = { "application/json" },
method = RequestMethod.GET)
- default Callable>> getInventory()
+ public ResponseEntity