diff --git a/bin/spring-mvc-petstore-j8-localdatetime.json b/bin/spring-mvc-petstore-j8-localdatetime.json
new file mode 100644
index 00000000000..4fc23da84fd
--- /dev/null
+++ b/bin/spring-mvc-petstore-j8-localdatetime.json
@@ -0,0 +1,5 @@
+{
+ "library": "spring-mvc",
+ "dateLibrary": "java8-localdatetime",
+ "artifactId": "swagger-spring-mvc-j8-localdatetime"
+}
diff --git a/bin/spring-mvc-petstore-j8-localdatetime.sh b/bin/spring-mvc-petstore-j8-localdatetime.sh
new file mode 100755
index 00000000000..c5a10a28120
--- /dev/null
+++ b/bin/spring-mvc-petstore-j8-localdatetime.sh
@@ -0,0 +1,31 @@
+#!/bin/sh
+
+SCRIPT="$0"
+
+while [ -h "$SCRIPT" ] ; do
+ ls=`ls -ld "$SCRIPT"`
+ link=`expr "$ls" : '.*-> \(.*\)$'`
+ if expr "$link" : '/.*' > /dev/null; then
+ SCRIPT="$link"
+ else
+ SCRIPT=`dirname "$SCRIPT"`/"$link"
+ fi
+done
+
+if [ ! -d "${APP_DIR}" ]; then
+ APP_DIR=`dirname "$SCRIPT"`/..
+ APP_DIR=`cd "${APP_DIR}"; pwd`
+fi
+
+executable="./modules/swagger-codegen-cli/target/swagger-codegen-cli.jar"
+
+if [ ! -f "$executable" ]
+then
+ mvn clean package
+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/JavaSpring -i modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -l spring -c bin/spring-mvc-petstore-j8-localdatetime.json -o samples/server/petstore/spring-mvc-j8-localdatetime -DhideGenerationTimestamp=true"
+
+java $JAVA_OPTS -jar $executable $ags
diff --git a/pom.xml.circleci b/pom.xml.circleci
index b96cf08d3d6..4ad975f31eb 100644
--- a/pom.xml.circleci
+++ b/pom.xml.circleci
@@ -860,6 +860,8 @@
samples/server/petstore/jaxrs-resteasy/eap-java8
samples/server/petstore/jaxrs-resteasy/joda
samples/server/petstore/spring-mvc
+ samples/server/petstore/spring-mvc-j8-async
+ samples/server/petstore/spring-mvc-j8-localdatetime
samples/client/petstore/spring-cloud
samples/server/petstore/springboot
samples/server/petstore/springboot-beanvalidation
diff --git a/samples/server/petstore/spring-mvc-j8-localdatetime/.swagger-codegen-ignore b/samples/server/petstore/spring-mvc-j8-localdatetime/.swagger-codegen-ignore
new file mode 100644
index 00000000000..c5fa491b4c5
--- /dev/null
+++ b/samples/server/petstore/spring-mvc-j8-localdatetime/.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
+# This 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-localdatetime/.swagger-codegen/VERSION b/samples/server/petstore/spring-mvc-j8-localdatetime/.swagger-codegen/VERSION
new file mode 100644
index 00000000000..855ff9501eb
--- /dev/null
+++ b/samples/server/petstore/spring-mvc-j8-localdatetime/.swagger-codegen/VERSION
@@ -0,0 +1 @@
+2.4.0-SNAPSHOT
\ No newline at end of file
diff --git a/samples/server/petstore/spring-mvc-j8-localdatetime/README.md b/samples/server/petstore/spring-mvc-j8-localdatetime/README.md
new file mode 100644
index 00000000000..c98ef6ecff7
--- /dev/null
+++ b/samples/server/petstore/spring-mvc-j8-localdatetime/README.md
@@ -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/v2/swagger-ui.html
\ No newline at end of file
diff --git a/samples/server/petstore/spring-mvc-j8-localdatetime/pom.xml b/samples/server/petstore/spring-mvc-j8-localdatetime/pom.xml
new file mode 100644
index 00000000000..c001d075cb0
--- /dev/null
+++ b/samples/server/petstore/spring-mvc-j8-localdatetime/pom.xml
@@ -0,0 +1,147 @@
+
+ 4.0.0
+ io.swagger
+ swagger-spring-mvc-j8-localdatetime
+ jar
+ swagger-spring-mvc-j8-localdatetime
+ 1.0.0
+
+ src/main/java
+
+
+ org.apache.maven.plugins
+ maven-war-plugin
+ 3.1.0
+
+
+ maven-failsafe-plugin
+ 2.6
+
+
+
+ integration-test
+ verify
+
+
+
+
+
+ org.eclipse.jetty
+ jetty-maven-plugin
+ ${jetty-version}
+
+
+ /v2
+
+ 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}
+
+
+
+
+ io.springfox
+ springfox-swagger2
+ ${springfox-version}
+
+
+ com.fasterxml.jackson.core
+ jackson-annotations
+
+
+
+
+ io.springfox
+ springfox-swagger-ui
+ ${springfox-version}
+
+
+
+ com.fasterxml.jackson.datatype
+ jackson-datatype-jsr310
+ ${jackson-version}
+
+
+
+ junit
+ junit
+ ${junit-version}
+ test
+
+
+ javax.servlet
+ servlet-api
+ ${servlet-api-version}
+
+
+
+ javax.validation
+ validation-api
+ 1.1.0.Final
+ provided
+
+
+
+ 1.8
+ ${java.version}
+ ${java.version}
+ 9.2.15.v20160210
+ 1.7.21
+ 4.12
+ 2.5
+ 2.7.0
+ 2.8.9
+ 2.6.4
+ 4.3.9.RELEASE
+
+
diff --git a/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/io/swagger/api/AnotherFakeApi.java b/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/io/swagger/api/AnotherFakeApi.java
new file mode 100644
index 00000000000..f0a7a0327d7
--- /dev/null
+++ b/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/io/swagger/api/AnotherFakeApi.java
@@ -0,0 +1,72 @@
+/**
+ * NOTE: This class is auto generated by the swagger code generator program (2.4.0-SNAPSHOT).
+ * https://github.com/swagger-api/swagger-codegen
+ * Do not edit the class manually.
+ */
+package io.swagger.api;
+
+import io.swagger.model.Client;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import io.swagger.annotations.*;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.ResponseEntity;
+import org.springframework.validation.annotation.Validated;
+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 javax.servlet.http.HttpServletRequest;
+import javax.validation.Valid;
+import javax.validation.constraints.*;
+import java.io.IOException;
+import java.util.List;
+import java.util.Optional;
+
+@Api(value = "another-fake", description = "the another-fake API")
+public interface AnotherFakeApi {
+
+ Logger log = LoggerFactory.getLogger(AnotherFakeApi.class);
+
+ default Optional getObjectMapper() {
+ return Optional.empty();
+ }
+
+ default Optional getRequest() {
+ return Optional.empty();
+ }
+
+ default Optional getAcceptHeader() {
+ return getRequest().map(r -> r.getHeader("Accept"));
+ }
+
+ @ApiOperation(value = "To test special tags", nickname = "testSpecialTags", notes = "To test special tags", response = Client.class, tags={ "$another-fake?", })
+ @ApiResponses(value = {
+ @ApiResponse(code = 200, message = "successful operation", response = Client.class) })
+ @RequestMapping(value = "/another-fake/dummy",
+ produces = { "application/json" },
+ consumes = { "application/json" },
+ method = RequestMethod.PATCH)
+ default ResponseEntity testSpecialTags(@ApiParam(value = "client model" ,required=true ) @Valid @RequestBody Client body) {
+ if(getObjectMapper().isPresent() && getAcceptHeader().isPresent()) {
+ if (getAcceptHeader().get().contains("application/json")) {
+ try {
+ return new ResponseEntity<>(getObjectMapper().get().readValue("{ \"client\" : \"client\"}", Client.class), HttpStatus.NOT_IMPLEMENTED);
+ } catch (IOException e) {
+ log.error("Couldn't serialize response for content type application/json", e);
+ return new ResponseEntity<>(HttpStatus.INTERNAL_SERVER_ERROR);
+ }
+ }
+ } else {
+ log.warn("ObjectMapper or HttpServletRequest not configured in default AnotherFakeApi interface so no example is generated");
+ }
+ return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
+ }
+
+}
diff --git a/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/io/swagger/api/AnotherFakeApiController.java b/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/io/swagger/api/AnotherFakeApiController.java
new file mode 100644
index 00000000000..c57e8ee5a06
--- /dev/null
+++ b/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/io/swagger/api/AnotherFakeApiController.java
@@ -0,0 +1,31 @@
+package io.swagger.api;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+import org.springframework.stereotype.Controller;
+import javax.servlet.http.HttpServletRequest;
+import java.util.Optional;
+
+@Controller
+public class AnotherFakeApiController implements AnotherFakeApi {
+
+ private final ObjectMapper objectMapper;
+
+ private final HttpServletRequest request;
+
+ @org.springframework.beans.factory.annotation.Autowired
+ public AnotherFakeApiController(ObjectMapper objectMapper, HttpServletRequest request) {
+ this.objectMapper = objectMapper;
+ this.request = request;
+ }
+
+ @Override
+ public Optional getObjectMapper() {
+ return Optional.ofNullable(objectMapper);
+ }
+
+ @Override
+ public Optional getRequest() {
+ return Optional.ofNullable(request);
+ }
+
+}
diff --git a/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/io/swagger/api/ApiException.java b/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/io/swagger/api/ApiException.java
new file mode 100644
index 00000000000..97e535d3c21
--- /dev/null
+++ b/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/io/swagger/api/ApiException.java
@@ -0,0 +1,10 @@
+package io.swagger.api;
+
+
+public class ApiException extends Exception{
+ private int code;
+ public ApiException (int code, String msg) {
+ super(msg);
+ this.code = code;
+ }
+}
diff --git a/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/io/swagger/api/ApiOriginFilter.java b/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/io/swagger/api/ApiOriginFilter.java
new file mode 100644
index 00000000000..62646761f5a
--- /dev/null
+++ b/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/io/swagger/api/ApiOriginFilter.java
@@ -0,0 +1,27 @@
+package io.swagger.api;
+
+import java.io.IOException;
+
+import javax.servlet.*;
+import javax.servlet.http.HttpServletResponse;
+
+
+public class ApiOriginFilter implements javax.servlet.Filter {
+ @Override
+ public void doFilter(ServletRequest request, ServletResponse response,
+ FilterChain chain) throws IOException, ServletException {
+ HttpServletResponse res = (HttpServletResponse) response;
+ res.addHeader("Access-Control-Allow-Origin", "*");
+ res.addHeader("Access-Control-Allow-Methods", "GET, POST, DELETE, PUT");
+ res.addHeader("Access-Control-Allow-Headers", "Content-Type");
+ chain.doFilter(request, response);
+ }
+
+ @Override
+ public void destroy() {
+ }
+
+ @Override
+ public void init(FilterConfig filterConfig) throws ServletException {
+ }
+}
diff --git a/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/io/swagger/api/ApiResponseMessage.java b/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/io/swagger/api/ApiResponseMessage.java
new file mode 100644
index 00000000000..162678c57e3
--- /dev/null
+++ b/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/io/swagger/api/ApiResponseMessage.java
@@ -0,0 +1,69 @@
+package io.swagger.api;
+
+import javax.xml.bind.annotation.XmlTransient;
+
+
+@javax.xml.bind.annotation.XmlRootElement
+public class ApiResponseMessage {
+ public static final int ERROR = 1;
+ public static final int WARNING = 2;
+ public static final int INFO = 3;
+ public static final int OK = 4;
+ public static final int TOO_BUSY = 5;
+
+ int code;
+ String type;
+ String message;
+
+ public ApiResponseMessage(){}
+
+ public ApiResponseMessage(int code, String message){
+ this.code = code;
+ switch(code){
+ case ERROR:
+ setType("error");
+ break;
+ case WARNING:
+ setType("warning");
+ break;
+ case INFO:
+ setType("info");
+ break;
+ case OK:
+ setType("ok");
+ break;
+ case TOO_BUSY:
+ setType("too busy");
+ break;
+ default:
+ setType("unknown");
+ break;
+ }
+ this.message = message;
+ }
+
+ @XmlTransient
+ public int getCode() {
+ return code;
+ }
+
+ public void setCode(int code) {
+ this.code = code;
+ }
+
+ public String getType() {
+ return type;
+ }
+
+ public void setType(String type) {
+ this.type = type;
+ }
+
+ public String getMessage() {
+ return message;
+ }
+
+ public void setMessage(String message) {
+ this.message = message;
+ }
+}
diff --git a/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/io/swagger/api/FakeApi.java b/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/io/swagger/api/FakeApi.java
new file mode 100644
index 00000000000..d0093bed75b
--- /dev/null
+++ b/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/io/swagger/api/FakeApi.java
@@ -0,0 +1,230 @@
+/**
+ * NOTE: This class is auto generated by the swagger code generator program (2.4.0-SNAPSHOT).
+ * https://github.com/swagger-api/swagger-codegen
+ * Do not edit the class manually.
+ */
+package io.swagger.api;
+
+import java.math.BigDecimal;
+import io.swagger.model.Client;
+import java.time.LocalDate;
+import java.time.LocalDateTime;
+import io.swagger.model.OuterComposite;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import io.swagger.annotations.*;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.ResponseEntity;
+import org.springframework.validation.annotation.Validated;
+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 javax.servlet.http.HttpServletRequest;
+import javax.validation.Valid;
+import javax.validation.constraints.*;
+import java.io.IOException;
+import java.util.List;
+import java.util.Optional;
+
+@Api(value = "fake", description = "the fake API")
+public interface FakeApi {
+
+ Logger log = LoggerFactory.getLogger(FakeApi.class);
+
+ default Optional getObjectMapper() {
+ return Optional.empty();
+ }
+
+ default Optional getRequest() {
+ return Optional.empty();
+ }
+
+ default Optional getAcceptHeader() {
+ return getRequest().map(r -> r.getHeader("Accept"));
+ }
+
+ @ApiOperation(value = "", nickname = "fakeOuterBooleanSerialize", notes = "Test serialization of outer boolean types", response = Boolean.class, tags={ "fake", })
+ @ApiResponses(value = {
+ @ApiResponse(code = 200, message = "Output boolean", response = Boolean.class) })
+ @RequestMapping(value = "/fake/outer/boolean",
+ method = RequestMethod.POST)
+ default ResponseEntity fakeOuterBooleanSerialize(@ApiParam(value = "Input boolean as post body" ) @Valid @RequestBody Boolean body) {
+ if(getObjectMapper().isPresent() && getAcceptHeader().isPresent()) {
+ if (getAcceptHeader().get().contains("application/json")) {
+ try {
+ return new ResponseEntity<>(getObjectMapper().get().readValue("{ }", Boolean.class), HttpStatus.NOT_IMPLEMENTED);
+ } catch (IOException e) {
+ log.error("Couldn't serialize response for content type application/json", e);
+ return new ResponseEntity<>(HttpStatus.INTERNAL_SERVER_ERROR);
+ }
+ }
+ } else {
+ log.warn("ObjectMapper or HttpServletRequest not configured in default FakeApi interface so no example is generated");
+ }
+ return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
+ }
+
+
+ @ApiOperation(value = "", nickname = "fakeOuterCompositeSerialize", notes = "Test serialization of object with outer number type", response = OuterComposite.class, tags={ "fake", })
+ @ApiResponses(value = {
+ @ApiResponse(code = 200, message = "Output composite", response = OuterComposite.class) })
+ @RequestMapping(value = "/fake/outer/composite",
+ method = RequestMethod.POST)
+ default ResponseEntity fakeOuterCompositeSerialize(@ApiParam(value = "Input composite as post body" ) @Valid @RequestBody OuterComposite body) {
+ if(getObjectMapper().isPresent() && getAcceptHeader().isPresent()) {
+ if (getAcceptHeader().get().contains("application/json")) {
+ try {
+ return new ResponseEntity<>(getObjectMapper().get().readValue("{ \"my_string\" : { }, \"my_number\" : { }, \"my_boolean\" : { }}", OuterComposite.class), HttpStatus.NOT_IMPLEMENTED);
+ } catch (IOException e) {
+ log.error("Couldn't serialize response for content type application/json", e);
+ return new ResponseEntity<>(HttpStatus.INTERNAL_SERVER_ERROR);
+ }
+ }
+ } else {
+ log.warn("ObjectMapper or HttpServletRequest not configured in default FakeApi interface so no example is generated");
+ }
+ return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
+ }
+
+
+ @ApiOperation(value = "", nickname = "fakeOuterNumberSerialize", notes = "Test serialization of outer number types", response = BigDecimal.class, tags={ "fake", })
+ @ApiResponses(value = {
+ @ApiResponse(code = 200, message = "Output number", response = BigDecimal.class) })
+ @RequestMapping(value = "/fake/outer/number",
+ method = RequestMethod.POST)
+ default ResponseEntity fakeOuterNumberSerialize(@ApiParam(value = "Input number as post body" ) @Valid @RequestBody BigDecimal body) {
+ if(getObjectMapper().isPresent() && getAcceptHeader().isPresent()) {
+ if (getAcceptHeader().get().contains("application/json")) {
+ try {
+ return new ResponseEntity<>(getObjectMapper().get().readValue("{ }", BigDecimal.class), HttpStatus.NOT_IMPLEMENTED);
+ } catch (IOException e) {
+ log.error("Couldn't serialize response for content type application/json", e);
+ return new ResponseEntity<>(HttpStatus.INTERNAL_SERVER_ERROR);
+ }
+ }
+ } else {
+ log.warn("ObjectMapper or HttpServletRequest not configured in default FakeApi interface so no example is generated");
+ }
+ return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
+ }
+
+
+ @ApiOperation(value = "", nickname = "fakeOuterStringSerialize", notes = "Test serialization of outer string types", response = String.class, tags={ "fake", })
+ @ApiResponses(value = {
+ @ApiResponse(code = 200, message = "Output string", response = String.class) })
+ @RequestMapping(value = "/fake/outer/string",
+ method = RequestMethod.POST)
+ default ResponseEntity fakeOuterStringSerialize(@ApiParam(value = "Input string as post body" ) @Valid @RequestBody String body) {
+ if(getObjectMapper().isPresent() && getAcceptHeader().isPresent()) {
+ if (getAcceptHeader().get().contains("application/json")) {
+ try {
+ return new ResponseEntity<>(getObjectMapper().get().readValue("{ }", String.class), HttpStatus.NOT_IMPLEMENTED);
+ } catch (IOException e) {
+ log.error("Couldn't serialize response for content type application/json", e);
+ return new ResponseEntity<>(HttpStatus.INTERNAL_SERVER_ERROR);
+ }
+ }
+ } else {
+ log.warn("ObjectMapper or HttpServletRequest not configured in default FakeApi interface so no example is generated");
+ }
+ return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
+ }
+
+
+ @ApiOperation(value = "To test \"client\" model", nickname = "testClientModel", notes = "To test \"client\" model", response = Client.class, tags={ "fake", })
+ @ApiResponses(value = {
+ @ApiResponse(code = 200, message = "successful operation", response = Client.class) })
+ @RequestMapping(value = "/fake",
+ produces = { "application/json" },
+ consumes = { "application/json" },
+ method = RequestMethod.PATCH)
+ default ResponseEntity testClientModel(@ApiParam(value = "client model" ,required=true ) @Valid @RequestBody Client body) {
+ if(getObjectMapper().isPresent() && getAcceptHeader().isPresent()) {
+ if (getAcceptHeader().get().contains("application/json")) {
+ try {
+ return new ResponseEntity<>(getObjectMapper().get().readValue("{ \"client\" : \"client\"}", Client.class), HttpStatus.NOT_IMPLEMENTED);
+ } catch (IOException e) {
+ log.error("Couldn't serialize response for content type application/json", e);
+ return new ResponseEntity<>(HttpStatus.INTERNAL_SERVER_ERROR);
+ }
+ }
+ } else {
+ log.warn("ObjectMapper or HttpServletRequest not configured in default FakeApi interface so no example is generated");
+ }
+ return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
+ }
+
+
+ @ApiOperation(value = "Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 ", nickname = "testEndpointParameters", notes = "Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 ", authorizations = {
+ @Authorization(value = "http_basic_test")
+ }, tags={ "fake", })
+ @ApiResponses(value = {
+ @ApiResponse(code = 400, message = "Invalid username supplied"),
+ @ApiResponse(code = 404, message = "User not found") })
+ @RequestMapping(value = "/fake",
+ produces = { "application/xml; charset=utf-8", "application/json; charset=utf-8" },
+ consumes = { "application/xml; charset=utf-8", "application/json; charset=utf-8" },
+ method = RequestMethod.POST)
+ default ResponseEntity testEndpointParameters(@ApiParam(value = "None", required=true) @RequestParam(value="number", required=true) BigDecimal number,@ApiParam(value = "None", required=true) @RequestParam(value="double", required=true) Double _double,@ApiParam(value = "None", required=true) @RequestParam(value="pattern_without_delimiter", required=true) String patternWithoutDelimiter,@ApiParam(value = "None", required=true) @RequestParam(value="byte", required=true) byte[] _byte,@ApiParam(value = "None") @RequestParam(value="integer", required=false) Integer integer,@ApiParam(value = "None") @RequestParam(value="int32", required=false) Integer int32,@ApiParam(value = "None") @RequestParam(value="int64", required=false) Long int64,@ApiParam(value = "None") @RequestParam(value="float", required=false) Float _float,@ApiParam(value = "None") @RequestParam(value="string", required=false) String string,@ApiParam(value = "None") @RequestParam(value="binary", required=false) byte[] binary,@ApiParam(value = "None") @RequestParam(value="date", required=false) LocalDate date,@ApiParam(value = "None") @RequestParam(value="dateTime", required=false) LocalDateTime dateTime,@ApiParam(value = "None") @RequestParam(value="password", required=false) String password,@ApiParam(value = "None") @RequestParam(value="callback", required=false) String paramCallback) {
+ if(getObjectMapper().isPresent() && getAcceptHeader().isPresent()) {
+ } else {
+ log.warn("ObjectMapper or HttpServletRequest not configured in default FakeApi interface so no example is generated");
+ }
+ return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
+ }
+
+
+ @ApiOperation(value = "To test enum parameters", nickname = "testEnumParameters", notes = "To test enum parameters", tags={ "fake", })
+ @ApiResponses(value = {
+ @ApiResponse(code = 400, message = "Invalid request"),
+ @ApiResponse(code = 404, message = "Not found") })
+ @RequestMapping(value = "/fake",
+ produces = { "*/*" },
+ consumes = { "*/*" },
+ method = RequestMethod.GET)
+ default ResponseEntity testEnumParameters(@ApiParam(value = "Form parameter enum test (string array)", allowableValues=">, $") @RequestParam(value="enum_form_string_array", required=false) List enumFormStringArray,@ApiParam(value = "Form parameter enum test (string)", allowableValues="_abc, -efg, (xyz)", defaultValue="-efg") @RequestParam(value="enum_form_string", required=false) String enumFormString,@ApiParam(value = "Header parameter enum test (string array)" , allowableValues=">, $") @RequestHeader(value="enum_header_string_array", required=false) List enumHeaderStringArray,@ApiParam(value = "Header parameter enum test (string)" , allowableValues="_abc, -efg, (xyz)", defaultValue="-efg") @RequestHeader(value="enum_header_string", required=false) String enumHeaderString,@ApiParam(value = "Query parameter enum test (string array)", allowableValues = ">, $") @Valid @RequestParam(value = "enum_query_string_array", required = false) List enumQueryStringArray,@ApiParam(value = "Query parameter enum test (string)", allowableValues = "_abc, -efg, (xyz)", defaultValue = "-efg") @Valid @RequestParam(value = "enum_query_string", required = false, defaultValue="-efg") String enumQueryString,@ApiParam(value = "Query parameter enum test (double)", allowableValues = "1, -2") @Valid @RequestParam(value = "enum_query_integer", required = false) Integer enumQueryInteger,@ApiParam(value = "Query parameter enum test (double)", allowableValues="1.1, -1.2") @RequestParam(value="enum_query_double", required=false) Double enumQueryDouble) {
+ if(getObjectMapper().isPresent() && getAcceptHeader().isPresent()) {
+ } else {
+ log.warn("ObjectMapper or HttpServletRequest not configured in default FakeApi interface so no example is generated");
+ }
+ return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
+ }
+
+
+ @ApiOperation(value = "test inline additionalProperties", nickname = "testInlineAdditionalProperties", notes = "", tags={ "fake", })
+ @ApiResponses(value = {
+ @ApiResponse(code = 200, message = "successful operation") })
+ @RequestMapping(value = "/fake/inline-additionalProperties",
+ consumes = { "application/json" },
+ method = RequestMethod.POST)
+ default ResponseEntity testInlineAdditionalProperties(@ApiParam(value = "request body" ,required=true ) @Valid @RequestBody Object param) {
+ if(getObjectMapper().isPresent() && getAcceptHeader().isPresent()) {
+ } else {
+ log.warn("ObjectMapper or HttpServletRequest not configured in default FakeApi interface so no example is generated");
+ }
+ return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
+ }
+
+
+ @ApiOperation(value = "test json serialization of form data", nickname = "testJsonFormData", notes = "", tags={ "fake", })
+ @ApiResponses(value = {
+ @ApiResponse(code = 200, message = "successful operation") })
+ @RequestMapping(value = "/fake/jsonFormData",
+ consumes = { "application/json" },
+ method = RequestMethod.GET)
+ default ResponseEntity testJsonFormData(@ApiParam(value = "field1", required=true) @RequestParam(value="param", required=true) String param,@ApiParam(value = "field2", required=true) @RequestParam(value="param2", required=true) String param2) {
+ if(getObjectMapper().isPresent() && getAcceptHeader().isPresent()) {
+ } else {
+ log.warn("ObjectMapper or HttpServletRequest not configured in default FakeApi interface so no example is generated");
+ }
+ return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
+ }
+
+}
diff --git a/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/io/swagger/api/FakeApiController.java b/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/io/swagger/api/FakeApiController.java
new file mode 100644
index 00000000000..caf13795605
--- /dev/null
+++ b/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/io/swagger/api/FakeApiController.java
@@ -0,0 +1,31 @@
+package io.swagger.api;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+import org.springframework.stereotype.Controller;
+import javax.servlet.http.HttpServletRequest;
+import java.util.Optional;
+
+@Controller
+public class FakeApiController implements FakeApi {
+
+ private final ObjectMapper objectMapper;
+
+ private final HttpServletRequest request;
+
+ @org.springframework.beans.factory.annotation.Autowired
+ public FakeApiController(ObjectMapper objectMapper, HttpServletRequest request) {
+ this.objectMapper = objectMapper;
+ this.request = request;
+ }
+
+ @Override
+ public Optional getObjectMapper() {
+ return Optional.ofNullable(objectMapper);
+ }
+
+ @Override
+ public Optional getRequest() {
+ return Optional.ofNullable(request);
+ }
+
+}
diff --git a/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/io/swagger/api/FakeClassnameTestApi.java b/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/io/swagger/api/FakeClassnameTestApi.java
new file mode 100644
index 00000000000..f4c4f9d3fbe
--- /dev/null
+++ b/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/io/swagger/api/FakeClassnameTestApi.java
@@ -0,0 +1,74 @@
+/**
+ * NOTE: This class is auto generated by the swagger code generator program (2.4.0-SNAPSHOT).
+ * https://github.com/swagger-api/swagger-codegen
+ * Do not edit the class manually.
+ */
+package io.swagger.api;
+
+import io.swagger.model.Client;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import io.swagger.annotations.*;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.ResponseEntity;
+import org.springframework.validation.annotation.Validated;
+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 javax.servlet.http.HttpServletRequest;
+import javax.validation.Valid;
+import javax.validation.constraints.*;
+import java.io.IOException;
+import java.util.List;
+import java.util.Optional;
+
+@Api(value = "fake_classname_test", description = "the fake_classname_test API")
+public interface FakeClassnameTestApi {
+
+ Logger log = LoggerFactory.getLogger(FakeClassnameTestApi.class);
+
+ default Optional getObjectMapper() {
+ return Optional.empty();
+ }
+
+ default Optional getRequest() {
+ return Optional.empty();
+ }
+
+ default Optional getAcceptHeader() {
+ return getRequest().map(r -> r.getHeader("Accept"));
+ }
+
+ @ApiOperation(value = "To test class name in snake case", nickname = "testClassname", notes = "", response = Client.class, authorizations = {
+ @Authorization(value = "api_key_query")
+ }, tags={ "fake_classname_tags 123#$%^", })
+ @ApiResponses(value = {
+ @ApiResponse(code = 200, message = "successful operation", response = Client.class) })
+ @RequestMapping(value = "/fake_classname_test",
+ produces = { "application/json" },
+ consumes = { "application/json" },
+ method = RequestMethod.PATCH)
+ default ResponseEntity testClassname(@ApiParam(value = "client model" ,required=true ) @Valid @RequestBody Client body) {
+ if(getObjectMapper().isPresent() && getAcceptHeader().isPresent()) {
+ if (getAcceptHeader().get().contains("application/json")) {
+ try {
+ return new ResponseEntity<>(getObjectMapper().get().readValue("{ \"client\" : \"client\"}", Client.class), HttpStatus.NOT_IMPLEMENTED);
+ } catch (IOException e) {
+ log.error("Couldn't serialize response for content type application/json", e);
+ return new ResponseEntity<>(HttpStatus.INTERNAL_SERVER_ERROR);
+ }
+ }
+ } else {
+ log.warn("ObjectMapper or HttpServletRequest not configured in default FakeClassnameTestApi interface so no example is generated");
+ }
+ return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
+ }
+
+}
diff --git a/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/io/swagger/api/FakeClassnameTestApiController.java b/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/io/swagger/api/FakeClassnameTestApiController.java
new file mode 100644
index 00000000000..692712ad25e
--- /dev/null
+++ b/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/io/swagger/api/FakeClassnameTestApiController.java
@@ -0,0 +1,31 @@
+package io.swagger.api;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+import org.springframework.stereotype.Controller;
+import javax.servlet.http.HttpServletRequest;
+import java.util.Optional;
+
+@Controller
+public class FakeClassnameTestApiController implements FakeClassnameTestApi {
+
+ private final ObjectMapper objectMapper;
+
+ private final HttpServletRequest request;
+
+ @org.springframework.beans.factory.annotation.Autowired
+ public FakeClassnameTestApiController(ObjectMapper objectMapper, HttpServletRequest request) {
+ this.objectMapper = objectMapper;
+ this.request = request;
+ }
+
+ @Override
+ public Optional getObjectMapper() {
+ return Optional.ofNullable(objectMapper);
+ }
+
+ @Override
+ public Optional getRequest() {
+ return Optional.ofNullable(request);
+ }
+
+}
diff --git a/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/io/swagger/api/NotFoundException.java b/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/io/swagger/api/NotFoundException.java
new file mode 100644
index 00000000000..b28b67ea4b2
--- /dev/null
+++ b/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/io/swagger/api/NotFoundException.java
@@ -0,0 +1,10 @@
+package io.swagger.api;
+
+
+public class NotFoundException extends ApiException {
+ private int code;
+ public NotFoundException (int code, String msg) {
+ super(code, msg);
+ this.code = code;
+ }
+}
diff --git a/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/io/swagger/api/PetApi.java b/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/io/swagger/api/PetApi.java
new file mode 100644
index 00000000000..c1a402bb2e6
--- /dev/null
+++ b/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/io/swagger/api/PetApi.java
@@ -0,0 +1,273 @@
+/**
+ * NOTE: This class is auto generated by the swagger code generator program (2.4.0-SNAPSHOT).
+ * https://github.com/swagger-api/swagger-codegen
+ * Do not edit the class manually.
+ */
+package io.swagger.api;
+
+import io.swagger.model.ModelApiResponse;
+import io.swagger.model.Pet;
+import org.springframework.core.io.Resource;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import io.swagger.annotations.*;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.ResponseEntity;
+import org.springframework.validation.annotation.Validated;
+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 javax.servlet.http.HttpServletRequest;
+import javax.validation.Valid;
+import javax.validation.constraints.*;
+import java.io.IOException;
+import java.util.List;
+import java.util.Optional;
+
+@Api(value = "pet", description = "the pet API")
+public interface PetApi {
+
+ Logger log = LoggerFactory.getLogger(PetApi.class);
+
+ default Optional getObjectMapper() {
+ return Optional.empty();
+ }
+
+ default Optional getRequest() {
+ return Optional.empty();
+ }
+
+ default Optional getAcceptHeader() {
+ return getRequest().map(r -> r.getHeader("Accept"));
+ }
+
+ @ApiOperation(value = "Add a new pet to the store", nickname = "addPet", notes = "", authorizations = {
+ @Authorization(value = "petstore_auth", scopes = {
+ @AuthorizationScope(scope = "write:pets", description = "modify pets in your account"),
+ @AuthorizationScope(scope = "read:pets", description = "read your pets")
+ })
+ }, tags={ "pet", })
+ @ApiResponses(value = {
+ @ApiResponse(code = 405, message = "Invalid input") })
+ @RequestMapping(value = "/pet",
+ produces = { "application/xml", "application/json" },
+ consumes = { "application/json", "application/xml" },
+ method = RequestMethod.POST)
+ default ResponseEntity addPet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody Pet body) {
+ if(getObjectMapper().isPresent() && getAcceptHeader().isPresent()) {
+ } else {
+ log.warn("ObjectMapper or HttpServletRequest not configured in default PetApi interface so no example is generated");
+ }
+ return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
+ }
+
+
+ @ApiOperation(value = "Deletes a pet", nickname = "deletePet", notes = "", authorizations = {
+ @Authorization(value = "petstore_auth", scopes = {
+ @AuthorizationScope(scope = "write:pets", description = "modify pets in your account"),
+ @AuthorizationScope(scope = "read:pets", description = "read your pets")
+ })
+ }, tags={ "pet", })
+ @ApiResponses(value = {
+ @ApiResponse(code = 400, message = "Invalid pet value") })
+ @RequestMapping(value = "/pet/{petId}",
+ produces = { "application/xml", "application/json" },
+ method = RequestMethod.DELETE)
+ default ResponseEntity deletePet(@ApiParam(value = "Pet id to delete",required=true) @PathVariable("petId") Long petId,@ApiParam(value = "" ) @RequestHeader(value="api_key", required=false) String apiKey) {
+ if(getObjectMapper().isPresent() && getAcceptHeader().isPresent()) {
+ } else {
+ log.warn("ObjectMapper or HttpServletRequest not configured in default PetApi interface so no example is generated");
+ }
+ return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
+ }
+
+
+ @ApiOperation(value = "Finds Pets by status", nickname = "findPetsByStatus", 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")
+ })
+ }, tags={ "pet", })
+ @ApiResponses(value = {
+ @ApiResponse(code = 200, message = "successful operation", response = Pet.class, responseContainer = "List"),
+ @ApiResponse(code = 400, message = "Invalid status value") })
+ @RequestMapping(value = "/pet/findByStatus",
+ produces = { "application/xml", "application/json" },
+ method = RequestMethod.GET)
+ default ResponseEntity> findPetsByStatus(@NotNull @ApiParam(value = "Status values that need to be considered for filter", required = true, allowableValues = "available, pending, sold") @Valid @RequestParam(value = "status", required = true) List status) {
+ if(getObjectMapper().isPresent() && getAcceptHeader().isPresent()) {
+ if (getAcceptHeader().get().contains("application/xml")) {
+ try {
+ return new ResponseEntity<>(getObjectMapper().get().readValue(" 123456789 doggie aeiou aeiou", List.class), HttpStatus.NOT_IMPLEMENTED);
+ } catch (IOException e) {
+ log.error("Couldn't serialize response for content type application/xml", e);
+ return new ResponseEntity<>(HttpStatus.INTERNAL_SERVER_ERROR);
+ }
+ }
+ if (getAcceptHeader().get().contains("application/json")) {
+ try {
+ return new ResponseEntity<>(getObjectMapper().get().readValue("[ { \"photoUrls\" : [ \"photoUrls\", \"photoUrls\" ], \"name\" : \"doggie\", \"id\" : 0, \"category\" : { \"name\" : \"name\", \"id\" : 6 }, \"tags\" : [ { \"name\" : \"name\", \"id\" : 1 }, { \"name\" : \"name\", \"id\" : 1 } ], \"status\" : \"available\"}, { \"photoUrls\" : [ \"photoUrls\", \"photoUrls\" ], \"name\" : \"doggie\", \"id\" : 0, \"category\" : { \"name\" : \"name\", \"id\" : 6 }, \"tags\" : [ { \"name\" : \"name\", \"id\" : 1 }, { \"name\" : \"name\", \"id\" : 1 } ], \"status\" : \"available\"} ]", List.class), HttpStatus.NOT_IMPLEMENTED);
+ } catch (IOException e) {
+ log.error("Couldn't serialize response for content type application/json", e);
+ return new ResponseEntity<>(HttpStatus.INTERNAL_SERVER_ERROR);
+ }
+ }
+ } else {
+ log.warn("ObjectMapper or HttpServletRequest not configured in default PetApi interface so no example is generated");
+ }
+ return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
+ }
+
+
+ @ApiOperation(value = "Finds Pets by tags", nickname = "findPetsByTags", 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")
+ })
+ }, tags={ "pet", })
+ @ApiResponses(value = {
+ @ApiResponse(code = 200, message = "successful operation", response = Pet.class, responseContainer = "List"),
+ @ApiResponse(code = 400, message = "Invalid tag value") })
+ @RequestMapping(value = "/pet/findByTags",
+ produces = { "application/xml", "application/json" },
+ method = RequestMethod.GET)
+ default ResponseEntity> findPetsByTags(@NotNull @ApiParam(value = "Tags to filter by", required = true) @Valid @RequestParam(value = "tags", required = true) List tags) {
+ if(getObjectMapper().isPresent() && getAcceptHeader().isPresent()) {
+ if (getAcceptHeader().get().contains("application/xml")) {
+ try {
+ return new ResponseEntity<>(getObjectMapper().get().readValue(" 123456789 doggie aeiou aeiou", List.class), HttpStatus.NOT_IMPLEMENTED);
+ } catch (IOException e) {
+ log.error("Couldn't serialize response for content type application/xml", e);
+ return new ResponseEntity<>(HttpStatus.INTERNAL_SERVER_ERROR);
+ }
+ }
+ if (getAcceptHeader().get().contains("application/json")) {
+ try {
+ return new ResponseEntity<>(getObjectMapper().get().readValue("[ { \"photoUrls\" : [ \"photoUrls\", \"photoUrls\" ], \"name\" : \"doggie\", \"id\" : 0, \"category\" : { \"name\" : \"name\", \"id\" : 6 }, \"tags\" : [ { \"name\" : \"name\", \"id\" : 1 }, { \"name\" : \"name\", \"id\" : 1 } ], \"status\" : \"available\"}, { \"photoUrls\" : [ \"photoUrls\", \"photoUrls\" ], \"name\" : \"doggie\", \"id\" : 0, \"category\" : { \"name\" : \"name\", \"id\" : 6 }, \"tags\" : [ { \"name\" : \"name\", \"id\" : 1 }, { \"name\" : \"name\", \"id\" : 1 } ], \"status\" : \"available\"} ]", List.class), HttpStatus.NOT_IMPLEMENTED);
+ } catch (IOException e) {
+ log.error("Couldn't serialize response for content type application/json", e);
+ return new ResponseEntity<>(HttpStatus.INTERNAL_SERVER_ERROR);
+ }
+ }
+ } else {
+ log.warn("ObjectMapper or HttpServletRequest not configured in default PetApi interface so no example is generated");
+ }
+ return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
+ }
+
+
+ @ApiOperation(value = "Find pet by ID", nickname = "getPetById", notes = "Returns a single pet", response = Pet.class, authorizations = {
+ @Authorization(value = "api_key")
+ }, tags={ "pet", })
+ @ApiResponses(value = {
+ @ApiResponse(code = 200, message = "successful operation", response = Pet.class),
+ @ApiResponse(code = 400, message = "Invalid ID supplied"),
+ @ApiResponse(code = 404, message = "Pet not found") })
+ @RequestMapping(value = "/pet/{petId}",
+ produces = { "application/xml", "application/json" },
+ method = RequestMethod.GET)
+ default ResponseEntity getPetById(@ApiParam(value = "ID of pet to return",required=true) @PathVariable("petId") Long petId) {
+ if(getObjectMapper().isPresent() && getAcceptHeader().isPresent()) {
+ if (getAcceptHeader().get().contains("application/xml")) {
+ try {
+ return new ResponseEntity<>(getObjectMapper().get().readValue(" 123456789 doggie aeiou aeiou", Pet.class), HttpStatus.NOT_IMPLEMENTED);
+ } catch (IOException e) {
+ log.error("Couldn't serialize response for content type application/xml", e);
+ return new ResponseEntity<>(HttpStatus.INTERNAL_SERVER_ERROR);
+ }
+ }
+ if (getAcceptHeader().get().contains("application/json")) {
+ try {
+ return new ResponseEntity<>(getObjectMapper().get().readValue("{ \"photoUrls\" : [ \"photoUrls\", \"photoUrls\" ], \"name\" : \"doggie\", \"id\" : 0, \"category\" : { \"name\" : \"name\", \"id\" : 6 }, \"tags\" : [ { \"name\" : \"name\", \"id\" : 1 }, { \"name\" : \"name\", \"id\" : 1 } ], \"status\" : \"available\"}", Pet.class), HttpStatus.NOT_IMPLEMENTED);
+ } catch (IOException e) {
+ log.error("Couldn't serialize response for content type application/json", e);
+ return new ResponseEntity<>(HttpStatus.INTERNAL_SERVER_ERROR);
+ }
+ }
+ } else {
+ log.warn("ObjectMapper or HttpServletRequest not configured in default PetApi interface so no example is generated");
+ }
+ return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
+ }
+
+
+ @ApiOperation(value = "Update an existing pet", nickname = "updatePet", notes = "", authorizations = {
+ @Authorization(value = "petstore_auth", scopes = {
+ @AuthorizationScope(scope = "write:pets", description = "modify pets in your account"),
+ @AuthorizationScope(scope = "read:pets", description = "read your pets")
+ })
+ }, tags={ "pet", })
+ @ApiResponses(value = {
+ @ApiResponse(code = 400, message = "Invalid ID supplied"),
+ @ApiResponse(code = 404, message = "Pet not found"),
+ @ApiResponse(code = 405, message = "Validation exception") })
+ @RequestMapping(value = "/pet",
+ produces = { "application/xml", "application/json" },
+ consumes = { "application/json", "application/xml" },
+ method = RequestMethod.PUT)
+ default ResponseEntity updatePet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody Pet body) {
+ if(getObjectMapper().isPresent() && getAcceptHeader().isPresent()) {
+ } else {
+ log.warn("ObjectMapper or HttpServletRequest not configured in default PetApi interface so no example is generated");
+ }
+ return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
+ }
+
+
+ @ApiOperation(value = "Updates a pet in the store with form data", nickname = "updatePetWithForm", notes = "", authorizations = {
+ @Authorization(value = "petstore_auth", scopes = {
+ @AuthorizationScope(scope = "write:pets", description = "modify pets in your account"),
+ @AuthorizationScope(scope = "read:pets", description = "read your pets")
+ })
+ }, tags={ "pet", })
+ @ApiResponses(value = {
+ @ApiResponse(code = 405, message = "Invalid input") })
+ @RequestMapping(value = "/pet/{petId}",
+ produces = { "application/xml", "application/json" },
+ consumes = { "application/x-www-form-urlencoded" },
+ method = RequestMethod.POST)
+ default ResponseEntity updatePetWithForm(@ApiParam(value = "ID of pet that needs to be updated",required=true) @PathVariable("petId") Long petId,@ApiParam(value = "Updated name of the pet") @RequestParam(value="name", required=false) String name,@ApiParam(value = "Updated status of the pet") @RequestParam(value="status", required=false) String status) {
+ if(getObjectMapper().isPresent() && getAcceptHeader().isPresent()) {
+ } else {
+ log.warn("ObjectMapper or HttpServletRequest not configured in default PetApi interface so no example is generated");
+ }
+ return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
+ }
+
+
+ @ApiOperation(value = "uploads an image", nickname = "uploadFile", 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")
+ })
+ }, tags={ "pet", })
+ @ApiResponses(value = {
+ @ApiResponse(code = 200, message = "successful operation", response = ModelApiResponse.class) })
+ @RequestMapping(value = "/pet/{petId}/uploadImage",
+ produces = { "application/json" },
+ consumes = { "multipart/form-data" },
+ method = RequestMethod.POST)
+ default ResponseEntity uploadFile(@ApiParam(value = "ID of pet to update",required=true) @PathVariable("petId") Long petId,@ApiParam(value = "Additional data to pass to server") @RequestParam(value="additionalMetadata", required=false) String additionalMetadata,@ApiParam(value = "file detail") @Valid @RequestPart("file") MultipartFile file) {
+ if(getObjectMapper().isPresent() && getAcceptHeader().isPresent()) {
+ if (getAcceptHeader().get().contains("application/json")) {
+ try {
+ return new ResponseEntity<>(getObjectMapper().get().readValue("{ \"code\" : 0, \"type\" : \"type\", \"message\" : \"message\"}", ModelApiResponse.class), HttpStatus.NOT_IMPLEMENTED);
+ } catch (IOException e) {
+ log.error("Couldn't serialize response for content type application/json", e);
+ return new ResponseEntity<>(HttpStatus.INTERNAL_SERVER_ERROR);
+ }
+ }
+ } else {
+ log.warn("ObjectMapper or HttpServletRequest not configured in default PetApi interface so no example is generated");
+ }
+ return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
+ }
+
+}
diff --git a/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/io/swagger/api/PetApiController.java b/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/io/swagger/api/PetApiController.java
new file mode 100644
index 00000000000..d90808e4ae4
--- /dev/null
+++ b/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/io/swagger/api/PetApiController.java
@@ -0,0 +1,31 @@
+package io.swagger.api;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+import org.springframework.stereotype.Controller;
+import javax.servlet.http.HttpServletRequest;
+import java.util.Optional;
+
+@Controller
+public class PetApiController implements PetApi {
+
+ private final ObjectMapper objectMapper;
+
+ private final HttpServletRequest request;
+
+ @org.springframework.beans.factory.annotation.Autowired
+ public PetApiController(ObjectMapper objectMapper, HttpServletRequest request) {
+ this.objectMapper = objectMapper;
+ this.request = request;
+ }
+
+ @Override
+ public Optional getObjectMapper() {
+ return Optional.ofNullable(objectMapper);
+ }
+
+ @Override
+ public Optional getRequest() {
+ return Optional.ofNullable(request);
+ }
+
+}
diff --git a/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/io/swagger/api/StoreApi.java b/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/io/swagger/api/StoreApi.java
new file mode 100644
index 00000000000..557fccc0f34
--- /dev/null
+++ b/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/io/swagger/api/StoreApi.java
@@ -0,0 +1,155 @@
+/**
+ * NOTE: This class is auto generated by the swagger code generator program (2.4.0-SNAPSHOT).
+ * https://github.com/swagger-api/swagger-codegen
+ * Do not edit the class manually.
+ */
+package io.swagger.api;
+
+import java.util.Map;
+import io.swagger.model.Order;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import io.swagger.annotations.*;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.ResponseEntity;
+import org.springframework.validation.annotation.Validated;
+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 javax.servlet.http.HttpServletRequest;
+import javax.validation.Valid;
+import javax.validation.constraints.*;
+import java.io.IOException;
+import java.util.List;
+import java.util.Optional;
+
+@Api(value = "store", description = "the store API")
+public interface StoreApi {
+
+ Logger log = LoggerFactory.getLogger(StoreApi.class);
+
+ default Optional getObjectMapper() {
+ return Optional.empty();
+ }
+
+ default Optional getRequest() {
+ return Optional.empty();
+ }
+
+ default Optional getAcceptHeader() {
+ return getRequest().map(r -> r.getHeader("Accept"));
+ }
+
+ @ApiOperation(value = "Delete purchase order by ID", nickname = "deleteOrder", notes = "For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors", tags={ "store", })
+ @ApiResponses(value = {
+ @ApiResponse(code = 400, message = "Invalid ID supplied"),
+ @ApiResponse(code = 404, message = "Order not found") })
+ @RequestMapping(value = "/store/order/{order_id}",
+ produces = { "application/xml", "application/json" },
+ method = RequestMethod.DELETE)
+ default ResponseEntity deleteOrder(@ApiParam(value = "ID of the order that needs to be deleted",required=true) @PathVariable("order_id") String orderId) {
+ if(getObjectMapper().isPresent() && getAcceptHeader().isPresent()) {
+ } else {
+ log.warn("ObjectMapper or HttpServletRequest not configured in default StoreApi interface so no example is generated");
+ }
+ return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
+ }
+
+
+ @ApiOperation(value = "Returns pet inventories by status", nickname = "getInventory", notes = "Returns a map of status codes to quantities", response = Integer.class, responseContainer = "Map", authorizations = {
+ @Authorization(value = "api_key")
+ }, tags={ "store", })
+ @ApiResponses(value = {
+ @ApiResponse(code = 200, message = "successful operation", response = Map.class, responseContainer = "Map") })
+ @RequestMapping(value = "/store/inventory",
+ produces = { "application/json" },
+ method = RequestMethod.GET)
+ default ResponseEntity