diff --git a/bin/spring-all-pestore.sh b/bin/spring-all-pestore.sh
index eb69ef2c4ac..d14665c42d5 100755
--- a/bin/spring-all-pestore.sh
+++ b/bin/spring-all-pestore.sh
@@ -7,3 +7,4 @@
./bin/spring-mvc-petstore-j8-async-server.sh
./bin/springboot-petstore-server.sh
./bin/spring-mvc-petstore-server.sh
+./bin/springboot-petstore-server-beanvalidation.sh
\ No newline at end of file
diff --git a/bin/springboot-petstore-server-beanvalidation.json b/bin/springboot-petstore-server-beanvalidation.json
new file mode 100644
index 00000000000..ac9d7cf599b
--- /dev/null
+++ b/bin/springboot-petstore-server-beanvalidation.json
@@ -0,0 +1,4 @@
+{
+ "library": "spring-boot",
+ "useBeanValidation": true
+}
diff --git a/bin/springboot-petstore-server-beanvalidation.sh b/bin/springboot-petstore-server-beanvalidation.sh
new file mode 100755
index 00000000000..27e73825347
--- /dev/null
+++ b/bin/springboot-petstore-server-beanvalidation.sh
@@ -0,0 +1,34 @@
+#!/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 -o samples/server/petstore/springboot-beanvalidation -c bin/springboot-petstore-server-beanvalidation.json -DhideGenerationTimestamp=true"
+
+echo "Removing files and folders under samples/server/petstore/springboot-beanvalidation/src/main"
+rm -rf samples/server/petstore/springboot-beanvalidation/src/main
+find samples/server/petstore/springboot-beanvalidation -maxdepth 1 -type f ! -name "README.md" -exec rm {} +
+java $JAVA_OPTS -jar $executable $ags
diff --git a/modules/swagger-codegen/src/main/resources/JavaSpring/api.mustache b/modules/swagger-codegen/src/main/resources/JavaSpring/api.mustache
index 327e5c03f78..1371e29c5d9 100644
--- a/modules/swagger-codegen/src/main/resources/JavaSpring/api.mustache
+++ b/modules/swagger-codegen/src/main/resources/JavaSpring/api.mustache
@@ -23,6 +23,7 @@ import java.util.concurrent.{{^jdk8}}Callable{{/jdk8}}{{#jdk8}}CompletableFuture
{{/async}}
{{#useBeanValidation}}
import javax.validation.constraints.*;
+import javax.validation.Valid;
{{/useBeanValidation}}
{{>generatedAnnotation}}
@Api(value = "{{{baseName}}}", description = "the {{{baseName}}} API")
diff --git a/modules/swagger-codegen/src/main/resources/JavaSpring/apiController.mustache b/modules/swagger-codegen/src/main/resources/JavaSpring/apiController.mustache
index 608c22d212a..b952cd6f51e 100644
--- a/modules/swagger-codegen/src/main/resources/JavaSpring/apiController.mustache
+++ b/modules/swagger-codegen/src/main/resources/JavaSpring/apiController.mustache
@@ -24,6 +24,7 @@ import java.util.concurrent.Callable;
{{/async}}{{/jdk8-no-delegate}}
{{#useBeanValidation}}
import javax.validation.constraints.*;
+import javax.validation.Valid;
{{/useBeanValidation}}
{{>generatedAnnotation}}
@Controller
diff --git a/modules/swagger-codegen/src/main/resources/JavaSpring/bodyParams.mustache b/modules/swagger-codegen/src/main/resources/JavaSpring/bodyParams.mustache
index 26fb4a907fc..7fef9ad2b6f 100644
--- a/modules/swagger-codegen/src/main/resources/JavaSpring/bodyParams.mustache
+++ b/modules/swagger-codegen/src/main/resources/JavaSpring/bodyParams.mustache
@@ -1 +1 @@
-{{#isBodyParam}}@ApiParam(value = "{{{description}}}" {{#required}},required=true{{/required}} {{^isContainer}}{{#allowableValues}}, allowableValues="{{{allowableValues}}}"{{/allowableValues}}{{/isContainer}}{{#defaultValue}}, defaultValue="{{{defaultValue}}}"{{/defaultValue}}) @RequestBody {{{dataType}}} {{paramName}}{{/isBodyParam}}
\ No newline at end of file
+{{#isBodyParam}}@ApiParam(value = "{{{description}}}" {{#required}},required=true{{/required}} {{^isContainer}}{{#allowableValues}}, allowableValues="{{{allowableValues}}}"{{/allowableValues}}{{/isContainer}}{{#defaultValue}}, defaultValue="{{{defaultValue}}}"{{/defaultValue}}) {{#useBeanValidation}}@Valid{{/useBeanValidation}} @RequestBody {{{dataType}}} {{paramName}}{{/isBodyParam}}
\ No newline at end of file
diff --git a/samples/server/petstore/springboot-beanvalidation/.swagger-codegen-ignore b/samples/server/petstore/springboot-beanvalidation/.swagger-codegen-ignore
new file mode 100644
index 00000000000..c5fa491b4c5
--- /dev/null
+++ b/samples/server/petstore/springboot-beanvalidation/.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/springboot-beanvalidation/README.md b/samples/server/petstore/springboot-beanvalidation/README.md
new file mode 100644
index 00000000000..a2e8a9f7b84
--- /dev/null
+++ b/samples/server/petstore/springboot-beanvalidation/README.md
@@ -0,0 +1,18 @@
+# Swagger generated server
+
+Spring Boot 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 SpringBoot framework.
+
+The underlying library integrating swagger to SpringBoot is [springfox](https://github.com/springfox/springfox)
+
+Start your server as an simple java application
+
+You can view the api documentation in swagger-ui by pointing to
+http://localhost:8080/
+
+Change default port value in application.properties
\ No newline at end of file
diff --git a/samples/server/petstore/springboot-beanvalidation/pom.xml b/samples/server/petstore/springboot-beanvalidation/pom.xml
new file mode 100644
index 00000000000..d777f7d31f1
--- /dev/null
+++ b/samples/server/petstore/springboot-beanvalidation/pom.xml
@@ -0,0 +1,73 @@
+
+ 4.0.0
+ io.swagger
+ swagger-spring
+ jar
+ swagger-spring
+ 1.0.0
+
+ 1.7
+ ${java.version}
+ ${java.version}
+ 2.5.0
+
+
+ org.springframework.boot
+ spring-boot-starter-parent
+ 1.3.5.RELEASE
+
+
+ src/main/java
+
+
+ org.springframework.boot
+ spring-boot-maven-plugin
+
+
+
+ repackage
+
+
+
+
+
+
+
+
+ org.springframework.boot
+ spring-boot-starter-web
+
+
+ org.springframework.boot
+ spring-boot-starter-tomcat
+ provided
+
+
+
+ io.springfox
+ springfox-swagger2
+ ${springfox-version}
+
+
+ io.springfox
+ springfox-swagger-ui
+ ${springfox-version}
+
+
+
+ com.fasterxml.jackson.datatype
+ jackson-datatype-joda
+
+
+ joda-time
+ joda-time
+
+
+
+ javax.validation
+ validation-api
+ 1.1.0.Final
+ provided
+
+
+
\ No newline at end of file
diff --git a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/RFC3339DateFormat.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/RFC3339DateFormat.java
new file mode 100644
index 00000000000..0c3d276d2d4
--- /dev/null
+++ b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/RFC3339DateFormat.java
@@ -0,0 +1,20 @@
+package io.swagger;
+
+import com.fasterxml.jackson.databind.util.ISO8601DateFormat;
+import com.fasterxml.jackson.databind.util.ISO8601Utils;
+
+import java.text.FieldPosition;
+import java.util.Date;
+
+
+public class RFC3339DateFormat extends ISO8601DateFormat {
+
+ // Same as ISO8601DateFormat but serializing milliseconds.
+ @Override
+ public StringBuffer format(Date date, StringBuffer toAppendTo, FieldPosition fieldPosition) {
+ String value = ISO8601Utils.format(date, true);
+ toAppendTo.append(value);
+ return toAppendTo;
+ }
+
+}
\ No newline at end of file
diff --git a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/Swagger2SpringBoot.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/Swagger2SpringBoot.java
new file mode 100644
index 00000000000..c06fbae3c7a
--- /dev/null
+++ b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/Swagger2SpringBoot.java
@@ -0,0 +1,36 @@
+package io.swagger;
+
+import org.springframework.boot.CommandLineRunner;
+import org.springframework.boot.ExitCodeGenerator;
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.context.annotation.ComponentScan;
+
+import springfox.documentation.swagger2.annotations.EnableSwagger2;
+
+@SpringBootApplication
+@EnableSwagger2
+@ComponentScan(basePackages = "io.swagger")
+public class Swagger2SpringBoot implements CommandLineRunner {
+
+ @Override
+ public void run(String... arg0) throws Exception {
+ if (arg0.length > 0 && arg0[0].equals("exitcode")) {
+ throw new ExitException();
+ }
+ }
+
+ public static void main(String[] args) throws Exception {
+ new SpringApplication(Swagger2SpringBoot.class).run(args);
+ }
+
+ class ExitException extends RuntimeException implements ExitCodeGenerator {
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ public int getExitCode() {
+ return 10;
+ }
+
+ }
+}
diff --git a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/api/ApiException.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/api/ApiException.java
new file mode 100644
index 00000000000..7fa61c50d24
--- /dev/null
+++ b/samples/server/petstore/springboot-beanvalidation/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/springboot-beanvalidation/src/main/java/io/swagger/api/ApiOriginFilter.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/api/ApiOriginFilter.java
new file mode 100644
index 00000000000..f0f62dc7206
--- /dev/null
+++ b/samples/server/petstore/springboot-beanvalidation/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 {
+ }
+}
\ No newline at end of file
diff --git a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/api/ApiResponseMessage.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/api/ApiResponseMessage.java
new file mode 100644
index 00000000000..f03840f8e06
--- /dev/null
+++ b/samples/server/petstore/springboot-beanvalidation/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/springboot-beanvalidation/src/main/java/io/swagger/api/FakeApi.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/api/FakeApi.java
new file mode 100644
index 00000000000..b8cf659bac1
--- /dev/null
+++ b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/api/FakeApi.java
@@ -0,0 +1,79 @@
+package io.swagger.api;
+
+import java.math.BigDecimal;
+import io.swagger.model.Client;
+import org.joda.time.DateTime;
+import org.joda.time.LocalDate;
+
+import io.swagger.annotations.*;
+import org.springframework.http.ResponseEntity;
+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 javax.validation.constraints.*;
+import javax.validation.Valid;
+
+@Api(value = "fake", description = "the fake API")
+public interface FakeApi {
+
+ @ApiOperation(value = "To test \"client\" model", 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)
+ ResponseEntity testClientModel(@ApiParam(value = "client model" ,required=true ) @Valid @RequestBody Client body);
+
+
+ @ApiOperation(value = "Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 ", notes = "Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 ", response = Void.class, authorizations = {
+ @Authorization(value = "http_basic_test")
+ }, tags={ "fake", })
+ @ApiResponses(value = {
+ @ApiResponse(code = 400, message = "Invalid username supplied", response = Void.class),
+ @ApiResponse(code = 404, message = "User not found", response = Void.class) })
+ @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)
+ ResponseEntity testEndpointParameters(@ApiParam(value = "None", required=true ) @RequestPart(value="number", required=true) BigDecimal number,
+ @ApiParam(value = "None", required=true ) @RequestPart(value="_double", required=true) Double _double,
+ @ApiParam(value = "None", required=true ) @RequestPart(value="patternWithoutDelimiter", required=true) String patternWithoutDelimiter,
+ @ApiParam(value = "None", required=true ) @RequestPart(value="_byte", required=true) byte[] _byte,
+ @ApiParam(value = "None" ) @RequestPart(value="integer", required=false) Integer integer,
+ @ApiParam(value = "None" ) @RequestPart(value="int32", required=false) Integer int32,
+ @ApiParam(value = "None" ) @RequestPart(value="int64", required=false) Long int64,
+ @ApiParam(value = "None" ) @RequestPart(value="_float", required=false) Float _float,
+ @ApiParam(value = "None" ) @RequestPart(value="string", required=false) String string,
+ @ApiParam(value = "None" ) @RequestPart(value="binary", required=false) byte[] binary,
+ @ApiParam(value = "None" ) @RequestPart(value="date", required=false) LocalDate date,
+ @ApiParam(value = "None" ) @RequestPart(value="dateTime", required=false) DateTime dateTime,
+ @ApiParam(value = "None" ) @RequestPart(value="password", required=false) String password,
+ @ApiParam(value = "None" ) @RequestPart(value="paramCallback", required=false) String paramCallback);
+
+
+ @ApiOperation(value = "To test enum parameters", notes = "To test enum parameters", response = Void.class, tags={ "fake", })
+ @ApiResponses(value = {
+ @ApiResponse(code = 400, message = "Invalid request", response = Void.class),
+ @ApiResponse(code = 404, message = "Not found", response = Void.class) })
+ @RequestMapping(value = "/fake",
+ produces = { "*/*" },
+ consumes = { "*/*" },
+ method = RequestMethod.GET)
+ ResponseEntity testEnumParameters(@ApiParam(value = "Form parameter enum test (string array)" , allowableValues="GREATER_THAN, DOLLAR") @RequestPart(value="enumFormStringArray", required=false) List enumFormStringArray,
+ @ApiParam(value = "Form parameter enum test (string)" , allowableValues="_ABC, _EFG, _XYZ_", defaultValue="-efg") @RequestPart(value="enumFormString", required=false) String enumFormString,
+ @ApiParam(value = "Header parameter enum test (string array)" , allowableValues="GREATER_THAN, DOLLAR") @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 = "GREATER_THAN, DOLLAR") @RequestParam(value = "enumQueryStringArray", required = false) List enumQueryStringArray,
+ @ApiParam(value = "Query parameter enum test (string)", allowableValues = "_ABC, _EFG, _XYZ_", defaultValue = "-efg") @RequestParam(value = "enumQueryString", required = false, defaultValue="-efg") String enumQueryString,
+ @ApiParam(value = "Query parameter enum test (double)") @RequestParam(value = "enumQueryInteger", required = false) Integer enumQueryInteger,
+ @ApiParam(value = "Query parameter enum test (double)" ) @RequestPart(value="enumQueryDouble", required=false) Double enumQueryDouble);
+
+}
diff --git a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/api/FakeApiController.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/api/FakeApiController.java
new file mode 100644
index 00000000000..60295226cbb
--- /dev/null
+++ b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/api/FakeApiController.java
@@ -0,0 +1,65 @@
+package io.swagger.api;
+
+import java.math.BigDecimal;
+import io.swagger.model.Client;
+import org.joda.time.DateTime;
+import org.joda.time.LocalDate;
+
+import io.swagger.annotations.*;
+
+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.RequestParam;
+import org.springframework.web.bind.annotation.RequestPart;
+import org.springframework.web.multipart.MultipartFile;
+
+import java.util.List;
+
+import javax.validation.constraints.*;
+import javax.validation.Valid;
+
+@Controller
+public class FakeApiController implements FakeApi {
+
+
+
+ public ResponseEntity testClientModel(@ApiParam(value = "client model" ,required=true ) @Valid @RequestBody Client body) {
+ // do some magic!
+ return new ResponseEntity(HttpStatus.OK);
+ }
+
+ public ResponseEntity testEndpointParameters(@ApiParam(value = "None", required=true ) @RequestPart(value="number", required=true) BigDecimal number,
+ @ApiParam(value = "None", required=true ) @RequestPart(value="_double", required=true) Double _double,
+ @ApiParam(value = "None", required=true ) @RequestPart(value="patternWithoutDelimiter", required=true) String patternWithoutDelimiter,
+ @ApiParam(value = "None", required=true ) @RequestPart(value="_byte", required=true) byte[] _byte,
+ @ApiParam(value = "None" ) @RequestPart(value="integer", required=false) Integer integer,
+ @ApiParam(value = "None" ) @RequestPart(value="int32", required=false) Integer int32,
+ @ApiParam(value = "None" ) @RequestPart(value="int64", required=false) Long int64,
+ @ApiParam(value = "None" ) @RequestPart(value="_float", required=false) Float _float,
+ @ApiParam(value = "None" ) @RequestPart(value="string", required=false) String string,
+ @ApiParam(value = "None" ) @RequestPart(value="binary", required=false) byte[] binary,
+ @ApiParam(value = "None" ) @RequestPart(value="date", required=false) LocalDate date,
+ @ApiParam(value = "None" ) @RequestPart(value="dateTime", required=false) DateTime dateTime,
+ @ApiParam(value = "None" ) @RequestPart(value="password", required=false) String password,
+ @ApiParam(value = "None" ) @RequestPart(value="paramCallback", required=false) String paramCallback) {
+ // do some magic!
+ return new ResponseEntity(HttpStatus.OK);
+ }
+
+ public ResponseEntity testEnumParameters(@ApiParam(value = "Form parameter enum test (string array)" , allowableValues="GREATER_THAN, DOLLAR") @RequestPart(value="enumFormStringArray", required=false) List enumFormStringArray,
+ @ApiParam(value = "Form parameter enum test (string)" , allowableValues="_ABC, _EFG, _XYZ_", defaultValue="-efg") @RequestPart(value="enumFormString", required=false) String enumFormString,
+ @ApiParam(value = "Header parameter enum test (string array)" , allowableValues="GREATER_THAN, DOLLAR") @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 = "GREATER_THAN, DOLLAR") @RequestParam(value = "enumQueryStringArray", required = false) List enumQueryStringArray,
+ @ApiParam(value = "Query parameter enum test (string)", allowableValues = "_ABC, _EFG, _XYZ_", defaultValue = "-efg") @RequestParam(value = "enumQueryString", required = false, defaultValue="-efg") String enumQueryString,
+ @ApiParam(value = "Query parameter enum test (double)") @RequestParam(value = "enumQueryInteger", required = false) Integer enumQueryInteger,
+ @ApiParam(value = "Query parameter enum test (double)" ) @RequestPart(value="enumQueryDouble", required=false) Double enumQueryDouble) {
+ // do some magic!
+ return new ResponseEntity(HttpStatus.OK);
+ }
+
+}
diff --git a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/api/NotFoundException.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/api/NotFoundException.java
new file mode 100644
index 00000000000..295109d7fc4
--- /dev/null
+++ b/samples/server/petstore/springboot-beanvalidation/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/springboot-beanvalidation/src/main/java/io/swagger/api/PetApi.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/api/PetApi.java
new file mode 100644
index 00000000000..2c7f86fa1c4
--- /dev/null
+++ b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/api/PetApi.java
@@ -0,0 +1,148 @@
+package io.swagger.api;
+
+import java.io.File;
+import io.swagger.model.ModelApiResponse;
+import io.swagger.model.Pet;
+
+import io.swagger.annotations.*;
+import org.springframework.http.ResponseEntity;
+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 javax.validation.constraints.*;
+import javax.validation.Valid;
+
+@Api(value = "pet", description = "the pet API")
+public interface PetApi {
+
+ @ApiOperation(value = "Add a new pet to the store", notes = "", response = Void.class, authorizations = {
+ @Authorization(value = "petstore_auth", scopes = {
+ @AuthorizationScope(scope = "write:pets", description = "modify pets in your account"),
+ @AuthorizationScope(scope = "read:pets", description = "read your pets")
+ })
+ }, tags={ "pet", })
+ @ApiResponses(value = {
+ @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)
+ ResponseEntity addPet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody Pet body);
+
+
+ @ApiOperation(value = "Deletes a pet", notes = "", response = Void.class, authorizations = {
+ @Authorization(value = "petstore_auth", scopes = {
+ @AuthorizationScope(scope = "write:pets", description = "modify pets in your account"),
+ @AuthorizationScope(scope = "read:pets", description = "read your pets")
+ })
+ }, tags={ "pet", })
+ @ApiResponses(value = {
+ @ApiResponse(code = 400, message = "Invalid pet value", response = Void.class) })
+ @RequestMapping(value = "/pet/{petId}",
+ produces = { "application/xml", "application/json" },
+ method = RequestMethod.DELETE)
+ ResponseEntity deletePet(@ApiParam(value = "Pet id to delete",required=true ) @PathVariable("petId") Long petId,
+ @ApiParam(value = "" ) @RequestHeader(value="api_key", required=false) String apiKey);
+
+
+ @ApiOperation(value = "Finds Pets by status", notes = "Multiple status values can be provided with comma separated strings", response = Pet.class, responseContainer = "List", authorizations = {
+ @Authorization(value = "petstore_auth", scopes = {
+ @AuthorizationScope(scope = "write:pets", description = "modify pets in your account"),
+ @AuthorizationScope(scope = "read:pets", description = "read your pets")
+ })
+ }, tags={ "pet", })
+ @ApiResponses(value = {
+ @ApiResponse(code = 200, message = "successful operation", response = Pet.class),
+ @ApiResponse(code = 400, message = "Invalid status value", response = Pet.class) })
+ @RequestMapping(value = "/pet/findByStatus",
+ produces = { "application/xml", "application/json" },
+ method = RequestMethod.GET)
+ ResponseEntity> findPetsByStatus( @NotNull @ApiParam(value = "Status values that need to be considered for filter", required = true, allowableValues = "AVAILABLE, PENDING, SOLD") @RequestParam(value = "status", required = true) List status);
+
+
+ @ApiOperation(value = "Finds Pets by tags", notes = "Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.", response = Pet.class, responseContainer = "List", authorizations = {
+ @Authorization(value = "petstore_auth", scopes = {
+ @AuthorizationScope(scope = "write:pets", description = "modify pets in your account"),
+ @AuthorizationScope(scope = "read:pets", description = "read your pets")
+ })
+ }, tags={ "pet", })
+ @ApiResponses(value = {
+ @ApiResponse(code = 200, message = "successful operation", response = Pet.class),
+ @ApiResponse(code = 400, message = "Invalid tag value", response = Pet.class) })
+ @RequestMapping(value = "/pet/findByTags",
+ produces = { "application/xml", "application/json" },
+ method = RequestMethod.GET)
+ ResponseEntity> findPetsByTags( @NotNull @ApiParam(value = "Tags to filter by", required = true) @RequestParam(value = "tags", required = true) List tags);
+
+
+ @ApiOperation(value = "Find pet by ID", notes = "Returns a single pet", response = Pet.class, authorizations = {
+ @Authorization(value = "api_key")
+ }, tags={ "pet", })
+ @ApiResponses(value = {
+ @ApiResponse(code = 200, message = "successful operation", response = Pet.class),
+ @ApiResponse(code = 400, message = "Invalid ID supplied", response = Pet.class),
+ @ApiResponse(code = 404, message = "Pet not found", response = Pet.class) })
+ @RequestMapping(value = "/pet/{petId}",
+ produces = { "application/xml", "application/json" },
+ method = RequestMethod.GET)
+ ResponseEntity getPetById(@ApiParam(value = "ID of pet to return",required=true ) @PathVariable("petId") Long petId);
+
+
+ @ApiOperation(value = "Update an existing pet", notes = "", response = Void.class, authorizations = {
+ @Authorization(value = "petstore_auth", scopes = {
+ @AuthorizationScope(scope = "write:pets", description = "modify pets in your account"),
+ @AuthorizationScope(scope = "read:pets", description = "read your pets")
+ })
+ }, tags={ "pet", })
+ @ApiResponses(value = {
+ @ApiResponse(code = 400, message = "Invalid ID supplied", response = Void.class),
+ @ApiResponse(code = 404, message = "Pet not found", response = Void.class),
+ @ApiResponse(code = 405, message = "Validation exception", response = Void.class) })
+ @RequestMapping(value = "/pet",
+ produces = { "application/xml", "application/json" },
+ consumes = { "application/json", "application/xml" },
+ method = RequestMethod.PUT)
+ ResponseEntity updatePet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody Pet body);
+
+
+ @ApiOperation(value = "Updates a pet in the store with form data", notes = "", response = Void.class, authorizations = {
+ @Authorization(value = "petstore_auth", scopes = {
+ @AuthorizationScope(scope = "write:pets", description = "modify pets in your account"),
+ @AuthorizationScope(scope = "read:pets", description = "read your pets")
+ })
+ }, tags={ "pet", })
+ @ApiResponses(value = {
+ @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)
+ ResponseEntity updatePetWithForm(@ApiParam(value = "ID of pet that needs to be updated",required=true ) @PathVariable("petId") Long petId,
+ @ApiParam(value = "Updated name of the pet" ) @RequestPart(value="name", required=false) String name,
+ @ApiParam(value = "Updated status of the pet" ) @RequestPart(value="status", required=false) String status);
+
+
+ @ApiOperation(value = "uploads an image", notes = "", response = ModelApiResponse.class, authorizations = {
+ @Authorization(value = "petstore_auth", scopes = {
+ @AuthorizationScope(scope = "write:pets", description = "modify pets in your account"),
+ @AuthorizationScope(scope = "read:pets", description = "read your pets")
+ })
+ }, 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)
+ ResponseEntity uploadFile(@ApiParam(value = "ID of pet to update",required=true ) @PathVariable("petId") Long petId,
+ @ApiParam(value = "Additional data to pass to server" ) @RequestPart(value="additionalMetadata", required=false) String additionalMetadata,
+ @ApiParam(value = "file detail") @RequestPart("file") MultipartFile file);
+
+}
diff --git a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/api/PetApiController.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/api/PetApiController.java
new file mode 100644
index 00000000000..3e513074286
--- /dev/null
+++ b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/api/PetApiController.java
@@ -0,0 +1,74 @@
+package io.swagger.api;
+
+import java.io.File;
+import io.swagger.model.ModelApiResponse;
+import io.swagger.model.Pet;
+
+import io.swagger.annotations.*;
+
+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.RequestParam;
+import org.springframework.web.bind.annotation.RequestPart;
+import org.springframework.web.multipart.MultipartFile;
+
+import java.util.List;
+
+import javax.validation.constraints.*;
+import javax.validation.Valid;
+
+@Controller
+public class PetApiController implements PetApi {
+
+
+
+ public ResponseEntity addPet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody Pet body) {
+ // do some magic!
+ return new ResponseEntity(HttpStatus.OK);
+ }
+
+ 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) {
+ // do some magic!
+ return new ResponseEntity(HttpStatus.OK);
+ }
+
+ public ResponseEntity> findPetsByStatus( @NotNull @ApiParam(value = "Status values that need to be considered for filter", required = true, allowableValues = "AVAILABLE, PENDING, SOLD") @RequestParam(value = "status", required = true) List status) {
+ // do some magic!
+ return new ResponseEntity>(HttpStatus.OK);
+ }
+
+ public ResponseEntity> findPetsByTags( @NotNull @ApiParam(value = "Tags to filter by", required = true) @RequestParam(value = "tags", required = true) List tags) {
+ // do some magic!
+ return new ResponseEntity>(HttpStatus.OK);
+ }
+
+ public ResponseEntity getPetById(@ApiParam(value = "ID of pet to return",required=true ) @PathVariable("petId") Long petId) {
+ // do some magic!
+ return new ResponseEntity(HttpStatus.OK);
+ }
+
+ public ResponseEntity updatePet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody Pet body) {
+ // do some magic!
+ return new ResponseEntity(HttpStatus.OK);
+ }
+
+ public ResponseEntity updatePetWithForm(@ApiParam(value = "ID of pet that needs to be updated",required=true ) @PathVariable("petId") Long petId,
+ @ApiParam(value = "Updated name of the pet" ) @RequestPart(value="name", required=false) String name,
+ @ApiParam(value = "Updated status of the pet" ) @RequestPart(value="status", required=false) String status) {
+ // do some magic!
+ return new ResponseEntity(HttpStatus.OK);
+ }
+
+ public ResponseEntity uploadFile(@ApiParam(value = "ID of pet to update",required=true ) @PathVariable("petId") Long petId,
+ @ApiParam(value = "Additional data to pass to server" ) @RequestPart(value="additionalMetadata", required=false) String additionalMetadata,
+ @ApiParam(value = "file detail") @RequestPart("file") MultipartFile file) {
+ // do some magic!
+ return new ResponseEntity(HttpStatus.OK);
+ }
+
+}
diff --git a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/api/StoreApi.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/api/StoreApi.java
new file mode 100644
index 00000000000..a84c8afaeb6
--- /dev/null
+++ b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/api/StoreApi.java
@@ -0,0 +1,65 @@
+package io.swagger.api;
+
+import java.util.Map;
+import io.swagger.model.Order;
+
+import io.swagger.annotations.*;
+import org.springframework.http.ResponseEntity;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestBody;
+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 javax.validation.constraints.*;
+import javax.validation.Valid;
+
+@Api(value = "store", description = "the store API")
+public interface StoreApi {
+
+ @ApiOperation(value = "Delete purchase order by ID", notes = "For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors", response = Void.class, tags={ "store", })
+ @ApiResponses(value = {
+ @ApiResponse(code = 400, message = "Invalid ID supplied", response = Void.class),
+ @ApiResponse(code = 404, message = "Order not found", response = Void.class) })
+ @RequestMapping(value = "/store/order/{orderId}",
+ produces = { "application/xml", "application/json" },
+ method = RequestMethod.DELETE)
+ ResponseEntity deleteOrder(@ApiParam(value = "ID of the order that needs to be deleted",required=true ) @PathVariable("orderId") String orderId);
+
+
+ @ApiOperation(value = "Returns pet inventories by status", notes = "Returns a map of status codes to quantities", response = Integer.class, responseContainer = "Map", authorizations = {
+ @Authorization(value = "api_key")
+ }, tags={ "store", })
+ @ApiResponses(value = {
+ @ApiResponse(code = 200, message = "successful operation", response = Integer.class) })
+ @RequestMapping(value = "/store/inventory",
+ produces = { "application/json" },
+ method = RequestMethod.GET)
+ ResponseEntity