From 7da2893e0e5495df100c7881eff2c10d10807e7f Mon Sep 17 00:00:00 2001 From: wing328 Date: Fri, 15 Apr 2016 00:42:59 +0800 Subject: [PATCH] to fix #2585 --- bin/spring-mvc-petstore-j8-async-server.sh | 2 +- bin/spring-mvc-petstore-server.sh | 2 +- .../JavaSpringMVC/headerParams.mustache | 2 +- samples/server/petstore/spring-mvc/pom.xml | 2 +- .../java/io/swagger/api/ApiException.java | 2 +- .../java/io/swagger/api/ApiOriginFilter.java | 2 +- .../io/swagger/api/ApiResponseMessage.java | 2 +- .../io/swagger/api/NotFoundException.java | 2 +- .../src/main/java/io/swagger/api/PetApi.java | 288 ++++++++---------- .../api/PettestingByteArraytrueApi.java | 8 +- .../main/java/io/swagger/api/StoreApi.java | 121 ++++---- .../src/main/java/io/swagger/api/UserApi.java | 179 ++++++----- .../swagger/configuration/SwaggerConfig.java | 4 +- .../configuration/SwaggerUiConfiguration.java | 2 +- .../swagger/configuration/WebApplication.java | 2 +- .../configuration/WebMvcConfiguration.java | 2 +- .../main/java/io/swagger/model/Animal.java | 57 ++++ .../java/io/swagger/model/ApiResponse.java | 7 +- .../src/main/java/io/swagger/model/Cat.java | 72 +++++ .../main/java/io/swagger/model/Category.java | 5 +- .../src/main/java/io/swagger/model/Dog.java | 72 +++++ .../java/io/swagger/model/FormatTest.java | 213 +++++++++++++ .../io/swagger/model/InlineResponse200.java | 136 +++++++++ .../io/swagger/model/Model200Response.java | 60 ++++ .../java/io/swagger/model/ModelReturn.java | 60 ++++ .../src/main/java/io/swagger/model/Name.java | 74 +++++ .../src/main/java/io/swagger/model/Order.java | 11 +- .../src/main/java/io/swagger/model/Pet.java | 9 +- .../io/swagger/model/SpecialModelName.java | 57 ++++ .../src/main/java/io/swagger/model/Tag.java | 5 +- .../src/main/java/io/swagger/model/User.java | 11 +- 31 files changed, 1089 insertions(+), 382 deletions(-) create mode 100644 samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/Animal.java create mode 100644 samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/Cat.java create mode 100644 samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/Dog.java create mode 100644 samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/FormatTest.java create mode 100644 samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/InlineResponse200.java create mode 100644 samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/Model200Response.java create mode 100644 samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/ModelReturn.java create mode 100644 samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/Name.java create mode 100644 samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/SpecialModelName.java diff --git a/bin/spring-mvc-petstore-j8-async-server.sh b/bin/spring-mvc-petstore-j8-async-server.sh index d43b0c43286..2f8d9fb9cd6 100755 --- a/bin/spring-mvc-petstore-j8-async-server.sh +++ b/bin/spring-mvc-petstore-j8-async-server.sh @@ -26,6 +26,6 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="$@ generate -t modules/swagger-codegen/src/main/resources/JavaSpringMVC -i modules/swagger-codegen/src/test/resources/2_0/petstore.json -l spring-mvc -o samples/server/petstore/spring-mvc-j8-async -c bin/spring-mvc-petstore-j8-async.json" +ags="$@ generate -t modules/swagger-codegen/src/main/resources/JavaSpringMVC -i modules/swagger-codegen/src/test/resources/2_0/petstore.yaml -l spring-mvc -o samples/server/petstore/spring-mvc-j8-async -c bin/spring-mvc-petstore-j8-async.json" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/spring-mvc-petstore-server.sh b/bin/spring-mvc-petstore-server.sh index 55eaa7f32e8..14e33f2435b 100755 --- a/bin/spring-mvc-petstore-server.sh +++ b/bin/spring-mvc-petstore-server.sh @@ -26,6 +26,6 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="$@ generate -t modules/swagger-codegen/src/main/resources/JavaSpringMVC -i modules/swagger-codegen/src/test/resources/2_0/petstore.json -l spring-mvc -o samples/server/petstore/spring-mvc" +ags="$@ generate -t modules/swagger-codegen/src/main/resources/JavaSpringMVC -i modules/swagger-codegen/src/test/resources/2_0/petstore.yaml -l spring-mvc -o samples/server/petstore/spring-mvc" java $JAVA_OPTS -jar $executable $ags diff --git a/modules/swagger-codegen/src/main/resources/JavaSpringMVC/headerParams.mustache b/modules/swagger-codegen/src/main/resources/JavaSpringMVC/headerParams.mustache index 229717ddaa9..297d5131d92 100644 --- a/modules/swagger-codegen/src/main/resources/JavaSpringMVC/headerParams.mustache +++ b/modules/swagger-codegen/src/main/resources/JavaSpringMVC/headerParams.mustache @@ -1 +1 @@ -{{#isHeaderParam}}@ApiParam(value = "{{{description}}}" {{#required}},required=true{{/required}} {{#allowableValues}}, allowableValues="{{{allowableValues}}}"{{/allowableValues}}{{#defaultValue}}, defaultValue="{{{defaultValue}}}"{{/defaultValue}}) @RequestHeader(value="{{paramName}}", required={{#required}}true{{/required}}{{^required}}false{{/required}}) {{{dataType}}} {{paramName}}{{/isHeaderParam}} +{{#isHeaderParam}}@ApiParam(value = "{{{description}}}" {{#required}},required=true{{/required}} {{#allowableValues}}, allowableValues="{{{allowableValues}}}"{{/allowableValues}}{{#defaultValue}}, defaultValue="{{{defaultValue}}}"{{/defaultValue}}) @RequestHeader(value="{{baseName}}", required={{#required}}true{{/required}}{{^required}}false{{/required}}) {{{dataType}}} {{paramName}}{{/isHeaderParam}} diff --git a/samples/server/petstore/spring-mvc/pom.xml b/samples/server/petstore/spring-mvc/pom.xml index 65d216606a8..861cd47a031 100644 --- a/samples/server/petstore/spring-mvc/pom.xml +++ b/samples/server/petstore/spring-mvc/pom.xml @@ -118,7 +118,7 @@ - 1.5.7 + 1.5.8 9.2.9.v20150224 1.13 1.6.3 diff --git a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/ApiException.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/ApiException.java index b41beea3e3e..35a4d8dd806 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/ApiException.java +++ b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/ApiException.java @@ -1,6 +1,6 @@ package io.swagger.api; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-02-26T13:58:54.483Z") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-15T00:38:43.027+08:00") public class ApiException extends Exception{ private int code; public ApiException (int code, String msg) { diff --git a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/ApiOriginFilter.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/ApiOriginFilter.java index c128b43b3ee..8e404f707a0 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/ApiOriginFilter.java +++ b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/ApiOriginFilter.java @@ -5,7 +5,7 @@ import java.io.IOException; import javax.servlet.*; import javax.servlet.http.HttpServletResponse; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-02-26T13:58:54.483Z") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-15T00:38:43.027+08:00") public class ApiOriginFilter implements javax.servlet.Filter { @Override public void doFilter(ServletRequest request, ServletResponse response, diff --git a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/ApiResponseMessage.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/ApiResponseMessage.java index 9b6e484b90b..96bda78c904 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/ApiResponseMessage.java +++ b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/ApiResponseMessage.java @@ -3,7 +3,7 @@ package io.swagger.api; import javax.xml.bind.annotation.XmlTransient; @javax.xml.bind.annotation.XmlRootElement -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-02-26T13:58:54.483Z") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-15T00:38:43.027+08:00") public class ApiResponseMessage { public static final int ERROR = 1; public static final int WARNING = 2; diff --git a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/NotFoundException.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/NotFoundException.java index f7f196c51af..47f0b9857d3 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/NotFoundException.java +++ b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/NotFoundException.java @@ -1,6 +1,6 @@ package io.swagger.api; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-02-26T13:58:54.483Z") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-15T00:38:43.027+08:00") public class NotFoundException extends ApiException { private int code; public NotFoundException (int code, String msg) { diff --git a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/PetApi.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/PetApi.java index f907458e17a..224ea8d5d08 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/PetApi.java +++ b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/PetApi.java @@ -3,6 +3,7 @@ package io.swagger.api; import io.swagger.model.*; import io.swagger.model.Pet; +import io.swagger.model.ApiResponse; import java.io.File; import io.swagger.annotations.Api; @@ -31,9 +32,123 @@ import static org.springframework.http.MediaType.*; @Controller @RequestMapping(value = "/pet", produces = {APPLICATION_JSON_VALUE}) @Api(value = "/pet", description = "the pet API") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-02-26T13:58:54.483Z") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-15T00:38:43.027+08:00") public class PetApi { - + + @ApiOperation(value = "Add a new pet to the store", notes = "", response = Void.class, authorizations = { + @Authorization(value = "petstore_auth", scopes = { + @AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), + @AuthorizationScope(scope = "read:pets", description = "read your pets") + }) + }) + @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponse(code = 405, message = "Invalid input") }) + @RequestMapping(value = "", + produces = { "application/xml", "application/json" }, + consumes = { "application/json", "application/xml" }, + method = RequestMethod.POST) + public ResponseEntity addPet( + +@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @RequestBody Pet body +) + throws NotFoundException { + // do some magic! + return new ResponseEntity(HttpStatus.OK); + } + + + @ApiOperation(value = "Deletes a pet", notes = "", response = Void.class, authorizations = { + @Authorization(value = "petstore_auth", scopes = { + @AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), + @AuthorizationScope(scope = "read:pets", description = "read your pets") + }) + }) + @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid pet value") }) + @RequestMapping(value = "/{petId}", + produces = { "application/xml", "application/json" }, + + method = RequestMethod.DELETE) + public ResponseEntity deletePet( +@ApiParam(value = "Pet id to delete",required=true ) @PathVariable("petId") Long petId + +, + +@ApiParam(value = "" ) @RequestHeader(value="api_key", required=false) String apiKey + +) + throws NotFoundException { + // do some magic! + return new ResponseEntity(HttpStatus.OK); + } + + + @ApiOperation(value = "Finds Pets by status", notes = "Multiple status values can be provided with comma separated strings", response = Pet.class, responseContainer = "List", authorizations = { + @Authorization(value = "petstore_auth", scopes = { + @AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), + @AuthorizationScope(scope = "read:pets", description = "read your pets") + }) + }) + @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation"), + @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid status value") }) + @RequestMapping(value = "/findByStatus", + produces = { "application/xml", "application/json" }, + + method = RequestMethod.GET) + public ResponseEntity> findPetsByStatus(@ApiParam(value = "Status values that need to be considered for filter", required = true) @RequestParam(value = "status", required = true) List status + + +) + throws NotFoundException { + // do some magic! + return new ResponseEntity>(HttpStatus.OK); + } + + + @ApiOperation(value = "Finds Pets by tags", notes = "Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.", response = Pet.class, responseContainer = "List", authorizations = { + @Authorization(value = "petstore_auth", scopes = { + @AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), + @AuthorizationScope(scope = "read:pets", description = "read your pets") + }) + }) + @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation"), + @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid tag value") }) + @RequestMapping(value = "/findByTags", + produces = { "application/xml", "application/json" }, + + method = RequestMethod.GET) + public ResponseEntity> findPetsByTags(@ApiParam(value = "Tags to filter by", required = true) @RequestParam(value = "tags", required = true) List tags + + +) + throws NotFoundException { + // do some magic! + return new ResponseEntity>(HttpStatus.OK); + } + + + @ApiOperation(value = "Find pet by ID", notes = "Returns a single pet", response = Pet.class, authorizations = { + @Authorization(value = "api_key") + }) + @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation"), + @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid ID supplied"), + @io.swagger.annotations.ApiResponse(code = 404, message = "Pet not found") }) + @RequestMapping(value = "/{petId}", + produces = { "application/xml", "application/json" }, + + method = RequestMethod.GET) + public ResponseEntity getPetById( +@ApiParam(value = "ID of pet to return",required=true ) @PathVariable("petId") Long petId + +) + throws NotFoundException { + // do some magic! + return new ResponseEntity(HttpStatus.OK); + } + @ApiOperation(value = "Update an existing pet", notes = "", response = Void.class, authorizations = { @Authorization(value = "petstore_auth", scopes = { @@ -46,116 +161,18 @@ public class PetApi { @io.swagger.annotations.ApiResponse(code = 404, message = "Pet not found"), @io.swagger.annotations.ApiResponse(code = 405, message = "Validation exception") }) @RequestMapping(value = "", - produces = { "application/json", "application/xml" }, + produces = { "application/xml", "application/json" }, consumes = { "application/json", "application/xml" }, method = RequestMethod.PUT) public ResponseEntity updatePet( -@ApiParam(value = "Pet object that needs to be added to the store" ) @RequestBody Pet body +@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @RequestBody Pet body ) throws NotFoundException { // do some magic! return new ResponseEntity(HttpStatus.OK); } - - - @ApiOperation(value = "Add a new pet to the store", notes = "", response = Void.class, authorizations = { - @Authorization(value = "petstore_auth", scopes = { - @AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), - @AuthorizationScope(scope = "read:pets", description = "read your pets") - }) - }) - @io.swagger.annotations.ApiResponses(value = { - @io.swagger.annotations.ApiResponse(code = 405, message = "Invalid input") }) - @RequestMapping(value = "", - produces = { "application/json", "application/xml" }, - consumes = { "application/json", "application/xml" }, - method = RequestMethod.POST) - public ResponseEntity addPet( - -@ApiParam(value = "Pet object that needs to be added to the store" ) @RequestBody Pet body -) - throws NotFoundException { - // do some magic! - return new ResponseEntity(HttpStatus.OK); - } - - - - @ApiOperation(value = "Finds Pets by status", notes = "Multiple status values can be provided with comma seperated strings", response = Pet.class, responseContainer = "List", authorizations = { - @Authorization(value = "petstore_auth", scopes = { - @AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), - @AuthorizationScope(scope = "read:pets", description = "read your pets") - }) - }) - @io.swagger.annotations.ApiResponses(value = { - @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation"), - @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid status value") }) - @RequestMapping(value = "/findByStatus", - produces = { "application/json", "application/xml" }, - - method = RequestMethod.GET) - public ResponseEntity> findPetsByStatus(@ApiParam(value = "Status values that need to be considered for filter", defaultValue = "available") @RequestParam(value = "status", required = false, defaultValue="available") List status - - -) - throws NotFoundException { - // do some magic! - return new ResponseEntity>(HttpStatus.OK); - } - - - - @ApiOperation(value = "Finds Pets by tags", notes = "Muliple tags can be provided with comma seperated strings. Use tag1, tag2, tag3 for testing.", response = Pet.class, responseContainer = "List", authorizations = { - @Authorization(value = "petstore_auth", scopes = { - @AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), - @AuthorizationScope(scope = "read:pets", description = "read your pets") - }) - }) - @io.swagger.annotations.ApiResponses(value = { - @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation"), - @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid tag value") }) - @RequestMapping(value = "/findByTags", - produces = { "application/json", "application/xml" }, - - method = RequestMethod.GET) - public ResponseEntity> findPetsByTags(@ApiParam(value = "Tags to filter by") @RequestParam(value = "tags", required = false) List tags - - -) - throws NotFoundException { - // do some magic! - return new ResponseEntity>(HttpStatus.OK); - } - - - - @ApiOperation(value = "Find pet by ID", notes = "Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions", response = Pet.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") - }), - @Authorization(value = "api_key") - }) - @io.swagger.annotations.ApiResponses(value = { - @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation"), - @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid ID supplied"), - @io.swagger.annotations.ApiResponse(code = 404, message = "Pet not found") }) - @RequestMapping(value = "/{petId}", - produces = { "application/json", "application/xml" }, - - method = RequestMethod.GET) - public ResponseEntity getPetById( -@ApiParam(value = "ID of pet that needs to be fetched",required=true ) @PathVariable("petId") Long petId - -) - throws NotFoundException { - // do some magic! - return new ResponseEntity(HttpStatus.OK); - } - - @ApiOperation(value = "Updates a pet in the store with form data", notes = "", response = Void.class, authorizations = { @Authorization(value = "petstore_auth", scopes = { @@ -166,11 +183,11 @@ public class PetApi { @io.swagger.annotations.ApiResponses(value = { @io.swagger.annotations.ApiResponse(code = 405, message = "Invalid input") }) @RequestMapping(value = "/{petId}", - produces = { "application/json", "application/xml" }, + produces = { "application/xml", "application/json" }, consumes = { "application/x-www-form-urlencoded" }, method = RequestMethod.POST) public ResponseEntity updatePetWithForm( -@ApiParam(value = "ID of pet that needs to be updated",required=true ) @PathVariable("petId") String petId +@ApiParam(value = "ID of pet that needs to be updated",required=true ) @PathVariable("petId") Long petId , @@ -188,36 +205,8 @@ public class PetApi { return new ResponseEntity(HttpStatus.OK); } - - @ApiOperation(value = "Deletes a pet", notes = "", response = Void.class, authorizations = { - @Authorization(value = "petstore_auth", scopes = { - @AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), - @AuthorizationScope(scope = "read:pets", description = "read your pets") - }) - }) - @io.swagger.annotations.ApiResponses(value = { - @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid pet value") }) - @RequestMapping(value = "/{petId}", - produces = { "application/json", "application/xml" }, - - method = RequestMethod.DELETE) - public ResponseEntity deletePet( -@ApiParam(value = "Pet id to delete",required=true ) @PathVariable("petId") Long petId - -, - -@ApiParam(value = "" ) @RequestHeader(value="apiKey", required=false) String apiKey - -) - throws NotFoundException { - // do some magic! - return new ResponseEntity(HttpStatus.OK); - } - - - - @ApiOperation(value = "uploads an image", notes = "", response = Void.class, authorizations = { + @ApiOperation(value = "uploads an image", notes = "", response = ApiResponse.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") @@ -226,10 +215,10 @@ public class PetApi { @io.swagger.annotations.ApiResponses(value = { @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation") }) @RequestMapping(value = "/{petId}/uploadImage", - produces = { "application/json", "application/xml" }, + produces = { "application/json" }, consumes = { "multipart/form-data" }, method = RequestMethod.POST) - public ResponseEntity uploadFile( + public ResponseEntity uploadFile( @ApiParam(value = "ID of pet to update",required=true ) @PathVariable("petId") Long petId , @@ -244,34 +233,7 @@ public class PetApi { ) throws NotFoundException { // do some magic! - return new ResponseEntity(HttpStatus.OK); + return new ResponseEntity(HttpStatus.OK); } - - - @ApiOperation(value = "Fake endpoint to test byte array return by 'Find pet by ID'", notes = "Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions", response = byte[].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") - }), - @Authorization(value = "api_key") - }) - @io.swagger.annotations.ApiResponses(value = { - @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation"), - @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid ID supplied"), - @io.swagger.annotations.ApiResponse(code = 404, message = "Pet not found") }) - @RequestMapping(value = "/{petId}?testing_byte_array=true", - produces = { "application/json", "application/xml" }, - - method = RequestMethod.GET) - public ResponseEntity petPetIdtestingByteArraytrueGet( -@ApiParam(value = "ID of pet that needs to be fetched",required=true ) @PathVariable("petId") Long petId - -) - throws NotFoundException { - // do some magic! - return new ResponseEntity(HttpStatus.OK); - } - - } diff --git a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/PettestingByteArraytrueApi.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/PettestingByteArraytrueApi.java index 6151c000b82..f7912cb4d28 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/PettestingByteArraytrueApi.java +++ b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/PettestingByteArraytrueApi.java @@ -27,11 +27,10 @@ import java.util.List; import static org.springframework.http.MediaType.*; @Controller -@RequestMapping(value = "/pet?testing_byte_array=true", produces = {APPLICATION_JSON_VALUE}) -@Api(value = "/pet?testing_byte_array=true", description = "the pet?testing_byte_array=true API") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-02-26T13:58:54.483Z") +@RequestMapping(value = "/pet?testing_byte_array=true", produces = {APPLICATION_JSON_VALUE}) +@Api(value = "/pet?testing_byte_array=true", description = "the pet?testing_byte_array=true API") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-15T00:36:54.567+08:00") public class PettestingByteArraytrueApi { - @ApiOperation(value = "Fake endpoint to test byte array in body parameter for adding a new pet to the store", notes = "", response = Void.class, authorizations = { @Authorization(value = "petstore_auth", scopes = { @@ -54,5 +53,4 @@ public class PettestingByteArraytrueApi { return new ResponseEntity(HttpStatus.OK); } - } diff --git a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/StoreApi.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/StoreApi.java index bfd0765ecd6..b1071168eb2 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/StoreApi.java +++ b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/StoreApi.java @@ -31,78 +31,15 @@ import static org.springframework.http.MediaType.*; @Controller @RequestMapping(value = "/store", produces = {APPLICATION_JSON_VALUE}) @Api(value = "/store", description = "the store API") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-02-26T13:58:54.483Z") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-15T00:38:43.027+08:00") public class StoreApi { - - - @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") - }) - @io.swagger.annotations.ApiResponses(value = { - @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation") }) - @RequestMapping(value = "/inventory", - produces = { "application/json", "application/xml" }, - - method = RequestMethod.GET) - public ResponseEntity> getInventory() - throws NotFoundException { - // do some magic! - return new ResponseEntity>(HttpStatus.OK); - } - - - - @ApiOperation(value = "Place an order for a pet", notes = "", response = Order.class, authorizations = { - @Authorization(value = "test_api_client_id"), - @Authorization(value = "test_api_client_secret") - }) - @io.swagger.annotations.ApiResponses(value = { - @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation"), - @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid Order") }) - @RequestMapping(value = "/order", - produces = { "application/json", "application/xml" }, - - method = RequestMethod.POST) - public ResponseEntity placeOrder( - -@ApiParam(value = "order placed for purchasing the pet" ) @RequestBody Order body -) - throws NotFoundException { - // do some magic! - return new ResponseEntity(HttpStatus.OK); - } - - - - @ApiOperation(value = "Find purchase order by ID", notes = "For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions", response = Order.class, authorizations = { - @Authorization(value = "test_api_key_query"), - @Authorization(value = "test_api_key_header") - }) - @io.swagger.annotations.ApiResponses(value = { - @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation"), - @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid ID supplied"), - @io.swagger.annotations.ApiResponse(code = 404, message = "Order not found") }) - @RequestMapping(value = "/order/{orderId}", - produces = { "application/json", "application/xml" }, - - method = RequestMethod.GET) - public ResponseEntity getOrderById( -@ApiParam(value = "ID of pet that needs to be fetched",required=true ) @PathVariable("orderId") String orderId - -) - throws NotFoundException { - // do some magic! - return new ResponseEntity(HttpStatus.OK); - } - - @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) @io.swagger.annotations.ApiResponses(value = { @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid ID supplied"), @io.swagger.annotations.ApiResponse(code = 404, message = "Order not found") }) @RequestMapping(value = "/order/{orderId}", - produces = { "application/json", "application/xml" }, + produces = { "application/xml", "application/json" }, method = RequestMethod.DELETE) public ResponseEntity deleteOrder( @@ -114,5 +51,57 @@ public class StoreApi { return new ResponseEntity(HttpStatus.OK); } - + + @ApiOperation(value = "Returns pet inventories by status", notes = "Returns a map of status codes to quantities", response = Integer.class, responseContainer = "Map", authorizations = { + @Authorization(value = "api_key") + }) + @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation") }) + @RequestMapping(value = "/inventory", + produces = { "application/json" }, + + method = RequestMethod.GET) + public ResponseEntity> getInventory() + throws NotFoundException { + // do some magic! + return new ResponseEntity>(HttpStatus.OK); + } + + + @ApiOperation(value = "Find purchase order by ID", notes = "For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions", response = Order.class) + @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation"), + @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid ID supplied"), + @io.swagger.annotations.ApiResponse(code = 404, message = "Order not found") }) + @RequestMapping(value = "/order/{orderId}", + produces = { "application/xml", "application/json" }, + + method = RequestMethod.GET) + public ResponseEntity getOrderById( +@ApiParam(value = "ID of pet that needs to be fetched",required=true ) @PathVariable("orderId") Long orderId + +) + throws NotFoundException { + // do some magic! + return new ResponseEntity(HttpStatus.OK); + } + + + @ApiOperation(value = "Place an order for a pet", notes = "", response = Order.class) + @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation"), + @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid Order") }) + @RequestMapping(value = "/order", + produces = { "application/xml", "application/json" }, + + method = RequestMethod.POST) + public ResponseEntity placeOrder( + +@ApiParam(value = "order placed for purchasing the pet" ,required=true ) @RequestBody Order body +) + throws NotFoundException { + // do some magic! + return new ResponseEntity(HttpStatus.OK); + } + } diff --git a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/UserApi.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/UserApi.java index eafb9a3356e..d121b2ee27d 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/UserApi.java +++ b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/UserApi.java @@ -31,151 +31,66 @@ import static org.springframework.http.MediaType.*; @Controller @RequestMapping(value = "/user", produces = {APPLICATION_JSON_VALUE}) @Api(value = "/user", description = "the user API") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-02-26T13:58:54.483Z") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-15T00:38:43.027+08:00") public class UserApi { - @ApiOperation(value = "Create user", notes = "This can only be done by the logged in user.", response = Void.class) @io.swagger.annotations.ApiResponses(value = { @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation") }) @RequestMapping(value = "", - produces = { "application/json", "application/xml" }, + produces = { "application/xml", "application/json" }, method = RequestMethod.POST) public ResponseEntity createUser( -@ApiParam(value = "Created user object" ) @RequestBody User body +@ApiParam(value = "Created user object" ,required=true ) @RequestBody User body ) throws NotFoundException { // do some magic! return new ResponseEntity(HttpStatus.OK); } - @ApiOperation(value = "Creates list of users with given input array", notes = "", response = Void.class) @io.swagger.annotations.ApiResponses(value = { @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation") }) @RequestMapping(value = "/createWithArray", - produces = { "application/json", "application/xml" }, + produces = { "application/xml", "application/json" }, method = RequestMethod.POST) public ResponseEntity createUsersWithArrayInput( -@ApiParam(value = "List of user object" ) @RequestBody List body +@ApiParam(value = "List of user object" ,required=true ) @RequestBody List body ) throws NotFoundException { // do some magic! return new ResponseEntity(HttpStatus.OK); } - @ApiOperation(value = "Creates list of users with given input array", notes = "", response = Void.class) @io.swagger.annotations.ApiResponses(value = { @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation") }) @RequestMapping(value = "/createWithList", - produces = { "application/json", "application/xml" }, + produces = { "application/xml", "application/json" }, method = RequestMethod.POST) public ResponseEntity createUsersWithListInput( -@ApiParam(value = "List of user object" ) @RequestBody List body +@ApiParam(value = "List of user object" ,required=true ) @RequestBody List body ) throws NotFoundException { // do some magic! return new ResponseEntity(HttpStatus.OK); } - - - @ApiOperation(value = "Logs user into the system", notes = "", response = String.class) - @io.swagger.annotations.ApiResponses(value = { - @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation"), - @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid username/password supplied") }) - @RequestMapping(value = "/login", - produces = { "application/json", "application/xml" }, - - method = RequestMethod.GET) - public ResponseEntity loginUser(@ApiParam(value = "The user name for login") @RequestParam(value = "username", required = false) String username - - -, - @ApiParam(value = "The password for login in clear text") @RequestParam(value = "password", required = false) String password - - -) - throws NotFoundException { - // do some magic! - return new ResponseEntity(HttpStatus.OK); - } - - - - @ApiOperation(value = "Logs out current logged in user session", notes = "", response = Void.class) - @io.swagger.annotations.ApiResponses(value = { - @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation") }) - @RequestMapping(value = "/logout", - produces = { "application/json", "application/xml" }, - - method = RequestMethod.GET) - public ResponseEntity logoutUser() - throws NotFoundException { - // do some magic! - return new ResponseEntity(HttpStatus.OK); - } - - - - @ApiOperation(value = "Get user by user name", notes = "", response = User.class) - @io.swagger.annotations.ApiResponses(value = { - @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation"), - @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid username supplied"), - @io.swagger.annotations.ApiResponse(code = 404, message = "User not found") }) - @RequestMapping(value = "/{username}", - produces = { "application/json", "application/xml" }, - - method = RequestMethod.GET) - public ResponseEntity getUserByName( -@ApiParam(value = "The name that needs to be fetched. Use user1 for testing.",required=true ) @PathVariable("username") String username - -) - throws NotFoundException { - // do some magic! - return new ResponseEntity(HttpStatus.OK); - } - - - - @ApiOperation(value = "Updated user", notes = "This can only be done by the logged in user.", response = Void.class) - @io.swagger.annotations.ApiResponses(value = { - @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid user supplied"), - @io.swagger.annotations.ApiResponse(code = 404, message = "User not found") }) - @RequestMapping(value = "/{username}", - produces = { "application/json", "application/xml" }, - - method = RequestMethod.PUT) - public ResponseEntity updateUser( -@ApiParam(value = "name that need to be deleted",required=true ) @PathVariable("username") String username - -, - - -@ApiParam(value = "Updated user object" ) @RequestBody User body -) - throws NotFoundException { - // do some magic! - return new ResponseEntity(HttpStatus.OK); - } - - @ApiOperation(value = "Delete user", notes = "This can only be done by the logged in user.", response = Void.class) @io.swagger.annotations.ApiResponses(value = { @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid username supplied"), @io.swagger.annotations.ApiResponse(code = 404, message = "User not found") }) @RequestMapping(value = "/{username}", - produces = { "application/json", "application/xml" }, + produces = { "application/xml", "application/json" }, method = RequestMethod.DELETE) public ResponseEntity deleteUser( @@ -187,5 +102,81 @@ public class UserApi { return new ResponseEntity(HttpStatus.OK); } - + + @ApiOperation(value = "Get user by user name", notes = "", response = User.class) + @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation"), + @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid username supplied"), + @io.swagger.annotations.ApiResponse(code = 404, message = "User not found") }) + @RequestMapping(value = "/{username}", + produces = { "application/xml", "application/json" }, + + method = RequestMethod.GET) + public ResponseEntity getUserByName( +@ApiParam(value = "The name that needs to be fetched. Use user1 for testing. ",required=true ) @PathVariable("username") String username + +) + throws NotFoundException { + // do some magic! + return new ResponseEntity(HttpStatus.OK); + } + + + @ApiOperation(value = "Logs user into the system", notes = "", response = String.class) + @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation"), + @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid username/password supplied") }) + @RequestMapping(value = "/login", + produces = { "application/xml", "application/json" }, + + method = RequestMethod.GET) + public ResponseEntity loginUser(@ApiParam(value = "The user name for login", required = true) @RequestParam(value = "username", required = true) String username + + +, + @ApiParam(value = "The password for login in clear text", required = true) @RequestParam(value = "password", required = true) String password + + +) + throws NotFoundException { + // do some magic! + return new ResponseEntity(HttpStatus.OK); + } + + + @ApiOperation(value = "Logs out current logged in user session", notes = "", response = Void.class) + @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation") }) + @RequestMapping(value = "/logout", + produces = { "application/xml", "application/json" }, + + method = RequestMethod.GET) + public ResponseEntity logoutUser() + throws NotFoundException { + // do some magic! + return new ResponseEntity(HttpStatus.OK); + } + + + @ApiOperation(value = "Updated user", notes = "This can only be done by the logged in user.", response = Void.class) + @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid user supplied"), + @io.swagger.annotations.ApiResponse(code = 404, message = "User not found") }) + @RequestMapping(value = "/{username}", + produces = { "application/xml", "application/json" }, + + method = RequestMethod.PUT) + public ResponseEntity updateUser( +@ApiParam(value = "name that need to be deleted",required=true ) @PathVariable("username") String username + +, + + +@ApiParam(value = "Updated user object" ,required=true ) @RequestBody User body +) + throws NotFoundException { + // do some magic! + return new ResponseEntity(HttpStatus.OK); + } + } diff --git a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/configuration/SwaggerConfig.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/configuration/SwaggerConfig.java index f9a4e70eedf..ce9f55730f6 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/configuration/SwaggerConfig.java +++ b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/configuration/SwaggerConfig.java @@ -18,13 +18,13 @@ import springfox.documentation.swagger2.annotations.EnableSwagger2; @EnableSwagger2 //Loads the spring beans required by the framework @PropertySource("classpath:swagger.properties") @Import(SwaggerUiConfiguration.class) -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-02-26T13:58:54.483Z") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-15T00:38:43.027+08:00") public class SwaggerConfig { @Bean ApiInfo apiInfo() { ApiInfo apiInfo = new ApiInfo( "Swagger Petstore", - "This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters", + "This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.", "1.0.0", "", "apiteam@swagger.io", diff --git a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/configuration/SwaggerUiConfiguration.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/configuration/SwaggerUiConfiguration.java index d5f6abb5b58..97f36a314a6 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/configuration/SwaggerUiConfiguration.java +++ b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/configuration/SwaggerUiConfiguration.java @@ -8,7 +8,7 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter @Configuration @EnableWebMvc -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-02-26T13:58:54.483Z") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-15T00:38:43.027+08:00") public class SwaggerUiConfiguration extends WebMvcConfigurerAdapter { private static final String[] SERVLET_RESOURCE_LOCATIONS = { "/" }; diff --git a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/configuration/WebApplication.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/configuration/WebApplication.java index ad7b104266e..145e1702c36 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/configuration/WebApplication.java +++ b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/configuration/WebApplication.java @@ -2,7 +2,7 @@ package io.swagger.configuration; import org.springframework.web.servlet.support.AbstractAnnotationConfigDispatcherServletInitializer; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-02-26T13:58:54.483Z") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-15T00:38:43.027+08:00") public class WebApplication extends AbstractAnnotationConfigDispatcherServletInitializer { @Override diff --git a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/configuration/WebMvcConfiguration.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/configuration/WebMvcConfiguration.java index 67c3f82ac7a..a28af377e32 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/configuration/WebMvcConfiguration.java +++ b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/configuration/WebMvcConfiguration.java @@ -3,7 +3,7 @@ package io.swagger.configuration; import org.springframework.web.servlet.config.annotation.DefaultServletHandlerConfigurer; import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-02-26T13:58:54.483Z") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-15T00:38:43.027+08:00") public class WebMvcConfiguration extends WebMvcConfigurationSupport { @Override public void configureDefaultServletHandling(DefaultServletHandlerConfigurer configurer) { diff --git a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/Animal.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/Animal.java new file mode 100644 index 00000000000..ff0afdd4f86 --- /dev/null +++ b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/Animal.java @@ -0,0 +1,57 @@ +package io.swagger.model; + +import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +import io.swagger.annotations.*; +import com.fasterxml.jackson.annotation.JsonProperty; + +import java.util.Objects; + + +@ApiModel(description = "") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-15T00:36:54.567+08:00") +public class Animal { + + private String className = null; + + /** + **/ + @ApiModelProperty(required = true, value = "") + @JsonProperty("className") + public String getClassName() { + return className; + } + public void setClassName(String className) { + this.className = className; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Animal animal = (Animal) o; + return Objects.equals(className, animal.className); + } + + @Override + public int hashCode() { + return Objects.hash(className); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Animal {\n"); + + sb.append(" className: ").append(className).append("\n"); + sb.append("}\n"); + return sb.toString(); + } +} diff --git a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/ApiResponse.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/ApiResponse.java index 89364524a61..f63be372820 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/ApiResponse.java +++ b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/ApiResponse.java @@ -1,7 +1,6 @@ package io.swagger.model; import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonValue; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; @@ -12,14 +11,13 @@ import java.util.Objects; @ApiModel(description = "") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-01-22T15:27:38.634-06:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-15T00:38:43.027+08:00") public class ApiResponse { private Integer code = null; private String type = null; private String message = null; - /** **/ @ApiModelProperty(value = "") @@ -31,7 +29,6 @@ public class ApiResponse { this.code = code; } - /** **/ @ApiModelProperty(value = "") @@ -43,7 +40,6 @@ public class ApiResponse { this.type = type; } - /** **/ @ApiModelProperty(value = "") @@ -55,7 +51,6 @@ public class ApiResponse { this.message = message; } - @Override public boolean equals(Object o) { diff --git a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/Cat.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/Cat.java new file mode 100644 index 00000000000..884c739d46d --- /dev/null +++ b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/Cat.java @@ -0,0 +1,72 @@ +package io.swagger.model; + +import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import io.swagger.model.Animal; + +import io.swagger.annotations.*; +import com.fasterxml.jackson.annotation.JsonProperty; + +import java.util.Objects; + + +@ApiModel(description = "") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-15T00:36:54.567+08:00") +public class Cat extends Animal { + + private String className = null; + private Boolean declawed = null; + + /** + **/ + @ApiModelProperty(required = true, value = "") + @JsonProperty("className") + public String getClassName() { + return className; + } + public void setClassName(String className) { + this.className = className; + } + + /** + **/ + @ApiModelProperty(value = "") + @JsonProperty("declawed") + public Boolean getDeclawed() { + return declawed; + } + public void setDeclawed(Boolean declawed) { + this.declawed = declawed; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Cat cat = (Cat) o; + return Objects.equals(className, cat.className) && + Objects.equals(declawed, cat.declawed); + } + + @Override + public int hashCode() { + return Objects.hash(className, declawed); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Cat {\n"); + sb.append(" " + super.toString()).append("\n"); + sb.append(" className: ").append(className).append("\n"); + sb.append(" declawed: ").append(declawed).append("\n"); + sb.append("}\n"); + return sb.toString(); + } +} diff --git a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/Category.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/Category.java index 6a928dfc593..f19ad61729d 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/Category.java +++ b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/Category.java @@ -11,13 +11,12 @@ import java.util.Objects; @ApiModel(description = "") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-02-26T13:58:54.483Z") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-15T00:38:43.027+08:00") public class Category { private Long id = null; private String name = null; - /** **/ @ApiModelProperty(value = "") @@ -29,7 +28,6 @@ public class Category { this.id = id; } - /** **/ @ApiModelProperty(value = "") @@ -41,7 +39,6 @@ public class Category { this.name = name; } - @Override public boolean equals(Object o) { diff --git a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/Dog.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/Dog.java new file mode 100644 index 00000000000..856fb7a0e66 --- /dev/null +++ b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/Dog.java @@ -0,0 +1,72 @@ +package io.swagger.model; + +import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import io.swagger.model.Animal; + +import io.swagger.annotations.*; +import com.fasterxml.jackson.annotation.JsonProperty; + +import java.util.Objects; + + +@ApiModel(description = "") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-15T00:36:54.567+08:00") +public class Dog extends Animal { + + private String className = null; + private String breed = null; + + /** + **/ + @ApiModelProperty(required = true, value = "") + @JsonProperty("className") + public String getClassName() { + return className; + } + public void setClassName(String className) { + this.className = className; + } + + /** + **/ + @ApiModelProperty(value = "") + @JsonProperty("breed") + public String getBreed() { + return breed; + } + public void setBreed(String breed) { + this.breed = breed; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Dog dog = (Dog) o; + return Objects.equals(className, dog.className) && + Objects.equals(breed, dog.breed); + } + + @Override + public int hashCode() { + return Objects.hash(className, breed); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Dog {\n"); + sb.append(" " + super.toString()).append("\n"); + sb.append(" className: ").append(className).append("\n"); + sb.append(" breed: ").append(breed).append("\n"); + sb.append("}\n"); + return sb.toString(); + } +} diff --git a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/FormatTest.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/FormatTest.java new file mode 100644 index 00000000000..309ffd11616 --- /dev/null +++ b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/FormatTest.java @@ -0,0 +1,213 @@ +package io.swagger.model; + +import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.math.BigDecimal; +import java.util.Date; + +import io.swagger.annotations.*; +import com.fasterxml.jackson.annotation.JsonProperty; + +import java.util.Objects; + + +@ApiModel(description = "") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-15T00:36:54.567+08:00") +public class FormatTest { + + private Integer integer = null; + private Integer int32 = null; + private Long int64 = null; + private BigDecimal number = null; + private Float _float = null; + private Double _double = null; + private String string = null; + private byte[] _byte = null; + private byte[] binary = null; + private Date date = null; + private Date dateTime = null; + private String password = null; + + /** + **/ + @ApiModelProperty(value = "") + @JsonProperty("integer") + public Integer getInteger() { + return integer; + } + public void setInteger(Integer integer) { + this.integer = integer; + } + + /** + **/ + @ApiModelProperty(value = "") + @JsonProperty("int32") + public Integer getInt32() { + return int32; + } + public void setInt32(Integer int32) { + this.int32 = int32; + } + + /** + **/ + @ApiModelProperty(value = "") + @JsonProperty("int64") + public Long getInt64() { + return int64; + } + public void setInt64(Long int64) { + this.int64 = int64; + } + + /** + **/ + @ApiModelProperty(required = true, value = "") + @JsonProperty("number") + public BigDecimal getNumber() { + return number; + } + public void setNumber(BigDecimal number) { + this.number = number; + } + + /** + **/ + @ApiModelProperty(value = "") + @JsonProperty("float") + public Float getFloat() { + return _float; + } + public void setFloat(Float _float) { + this._float = _float; + } + + /** + **/ + @ApiModelProperty(value = "") + @JsonProperty("double") + public Double getDouble() { + return _double; + } + public void setDouble(Double _double) { + this._double = _double; + } + + /** + **/ + @ApiModelProperty(value = "") + @JsonProperty("string") + public String getString() { + return string; + } + public void setString(String string) { + this.string = string; + } + + /** + **/ + @ApiModelProperty(value = "") + @JsonProperty("byte") + public byte[] getByte() { + return _byte; + } + public void setByte(byte[] _byte) { + this._byte = _byte; + } + + /** + **/ + @ApiModelProperty(value = "") + @JsonProperty("binary") + public byte[] getBinary() { + return binary; + } + public void setBinary(byte[] binary) { + this.binary = binary; + } + + /** + **/ + @ApiModelProperty(value = "") + @JsonProperty("date") + public Date getDate() { + return date; + } + public void setDate(Date date) { + this.date = date; + } + + /** + **/ + @ApiModelProperty(value = "") + @JsonProperty("dateTime") + public Date getDateTime() { + return dateTime; + } + public void setDateTime(Date dateTime) { + this.dateTime = dateTime; + } + + /** + **/ + @ApiModelProperty(value = "") + @JsonProperty("password") + public String getPassword() { + return password; + } + public void setPassword(String password) { + this.password = password; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + FormatTest formatTest = (FormatTest) o; + return Objects.equals(integer, formatTest.integer) && + Objects.equals(int32, formatTest.int32) && + Objects.equals(int64, formatTest.int64) && + Objects.equals(number, formatTest.number) && + Objects.equals(_float, formatTest._float) && + Objects.equals(_double, formatTest._double) && + Objects.equals(string, formatTest.string) && + Objects.equals(_byte, formatTest._byte) && + Objects.equals(binary, formatTest.binary) && + Objects.equals(date, formatTest.date) && + Objects.equals(dateTime, formatTest.dateTime) && + Objects.equals(password, formatTest.password); + } + + @Override + public int hashCode() { + return Objects.hash(integer, int32, int64, number, _float, _double, string, _byte, binary, date, dateTime, password); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FormatTest {\n"); + + sb.append(" integer: ").append(integer).append("\n"); + sb.append(" int32: ").append(int32).append("\n"); + sb.append(" int64: ").append(int64).append("\n"); + sb.append(" number: ").append(number).append("\n"); + sb.append(" _float: ").append(_float).append("\n"); + sb.append(" _double: ").append(_double).append("\n"); + sb.append(" string: ").append(string).append("\n"); + sb.append(" _byte: ").append(_byte).append("\n"); + sb.append(" binary: ").append(binary).append("\n"); + sb.append(" date: ").append(date).append("\n"); + sb.append(" dateTime: ").append(dateTime).append("\n"); + sb.append(" password: ").append(password).append("\n"); + sb.append("}\n"); + return sb.toString(); + } +} diff --git a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/InlineResponse200.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/InlineResponse200.java new file mode 100644 index 00000000000..9b7bd64697e --- /dev/null +++ b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/InlineResponse200.java @@ -0,0 +1,136 @@ +package io.swagger.model; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import io.swagger.model.Tag; +import java.util.ArrayList; +import java.util.List; + +import io.swagger.annotations.*; +import com.fasterxml.jackson.annotation.JsonProperty; + +import java.util.Objects; + + +@ApiModel(description = "") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-15T00:36:54.567+08:00") +public class InlineResponse200 { + + private List tags = new ArrayList(); + private Long id = null; + private Object category = null; + public enum StatusEnum { + available, pending, sold, + }; + + private StatusEnum status = null; + private String name = null; + private List photoUrls = new ArrayList(); + + /** + **/ + @ApiModelProperty(value = "") + @JsonProperty("tags") + public List getTags() { + return tags; + } + public void setTags(List tags) { + this.tags = tags; + } + + /** + **/ + @ApiModelProperty(required = true, value = "") + @JsonProperty("id") + public Long getId() { + return id; + } + public void setId(Long id) { + this.id = id; + } + + /** + **/ + @ApiModelProperty(value = "") + @JsonProperty("category") + public Object getCategory() { + return category; + } + public void setCategory(Object category) { + this.category = category; + } + + /** + * pet status in the store + **/ + @ApiModelProperty(value = "pet status in the store") + @JsonProperty("status") + public StatusEnum getStatus() { + return status; + } + public void setStatus(StatusEnum status) { + this.status = status; + } + + /** + **/ + @ApiModelProperty(value = "") + @JsonProperty("name") + public String getName() { + return name; + } + public void setName(String name) { + this.name = name; + } + + /** + **/ + @ApiModelProperty(value = "") + @JsonProperty("photoUrls") + public List getPhotoUrls() { + return photoUrls; + } + public void setPhotoUrls(List photoUrls) { + this.photoUrls = photoUrls; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + InlineResponse200 inlineResponse200 = (InlineResponse200) o; + return Objects.equals(tags, inlineResponse200.tags) && + Objects.equals(id, inlineResponse200.id) && + Objects.equals(category, inlineResponse200.category) && + Objects.equals(status, inlineResponse200.status) && + Objects.equals(name, inlineResponse200.name) && + Objects.equals(photoUrls, inlineResponse200.photoUrls); + } + + @Override + public int hashCode() { + return Objects.hash(tags, id, category, status, name, photoUrls); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class InlineResponse200 {\n"); + + sb.append(" tags: ").append(tags).append("\n"); + sb.append(" id: ").append(id).append("\n"); + sb.append(" category: ").append(category).append("\n"); + sb.append(" status: ").append(status).append("\n"); + sb.append(" name: ").append(name).append("\n"); + sb.append(" photoUrls: ").append(photoUrls).append("\n"); + sb.append("}\n"); + return sb.toString(); + } +} diff --git a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/Model200Response.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/Model200Response.java new file mode 100644 index 00000000000..d0babbf10ba --- /dev/null +++ b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/Model200Response.java @@ -0,0 +1,60 @@ +package io.swagger.model; + +import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +import io.swagger.annotations.*; +import com.fasterxml.jackson.annotation.JsonProperty; + +import java.util.Objects; + + +/** + * Model for testing model name starting with number + **/ +@ApiModel(description = "Model for testing model name starting with number") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-15T00:36:54.567+08:00") +public class Model200Response { + + private Integer name = null; + + /** + **/ + @ApiModelProperty(value = "") + @JsonProperty("name") + public Integer getName() { + return name; + } + public void setName(Integer name) { + this.name = name; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Model200Response _200Response = (Model200Response) o; + return Objects.equals(name, _200Response.name); + } + + @Override + public int hashCode() { + return Objects.hash(name); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Model200Response {\n"); + + sb.append(" name: ").append(name).append("\n"); + sb.append("}\n"); + return sb.toString(); + } +} diff --git a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/ModelReturn.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/ModelReturn.java new file mode 100644 index 00000000000..04b1ea734f2 --- /dev/null +++ b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/ModelReturn.java @@ -0,0 +1,60 @@ +package io.swagger.model; + +import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +import io.swagger.annotations.*; +import com.fasterxml.jackson.annotation.JsonProperty; + +import java.util.Objects; + + +/** + * Model for testing reserved words + **/ +@ApiModel(description = "Model for testing reserved words") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-15T00:36:54.567+08:00") +public class ModelReturn { + + private Integer _return = null; + + /** + **/ + @ApiModelProperty(value = "") + @JsonProperty("return") + public Integer getReturn() { + return _return; + } + public void setReturn(Integer _return) { + this._return = _return; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ModelReturn _return = (ModelReturn) o; + return Objects.equals(_return, _return._return); + } + + @Override + public int hashCode() { + return Objects.hash(_return); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ModelReturn {\n"); + + sb.append(" _return: ").append(_return).append("\n"); + sb.append("}\n"); + return sb.toString(); + } +} diff --git a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/Name.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/Name.java new file mode 100644 index 00000000000..475abe42028 --- /dev/null +++ b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/Name.java @@ -0,0 +1,74 @@ +package io.swagger.model; + +import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +import io.swagger.annotations.*; +import com.fasterxml.jackson.annotation.JsonProperty; + +import java.util.Objects; + + +/** + * Model for testing model name same as property name + **/ +@ApiModel(description = "Model for testing model name same as property name") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-15T00:36:54.567+08:00") +public class Name { + + private Integer name = null; + private Integer snakeCase = null; + + /** + **/ + @ApiModelProperty(required = true, value = "") + @JsonProperty("name") + public Integer getName() { + return name; + } + public void setName(Integer name) { + this.name = name; + } + + /** + **/ + @ApiModelProperty(value = "") + @JsonProperty("snake_case") + public Integer getSnakeCase() { + return snakeCase; + } + public void setSnakeCase(Integer snakeCase) { + this.snakeCase = snakeCase; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Name name = (Name) o; + return Objects.equals(name, name.name) && + Objects.equals(snakeCase, name.snakeCase); + } + + @Override + public int hashCode() { + return Objects.hash(name, snakeCase); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Name {\n"); + + sb.append(" name: ").append(name).append("\n"); + sb.append(" snakeCase: ").append(snakeCase).append("\n"); + sb.append("}\n"); + return sb.toString(); + } +} diff --git a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/Order.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/Order.java index 19c3a0ed7da..17ca86f79d5 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/Order.java +++ b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/Order.java @@ -13,7 +13,7 @@ import java.util.Objects; @ApiModel(description = "") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-02-26T13:58:54.483Z") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-15T00:38:43.027+08:00") public class Order { private Long id = null; @@ -25,9 +25,8 @@ public class Order { }; private StatusEnum status = null; - private Boolean complete = null; + private Boolean complete = false; - /** **/ @ApiModelProperty(value = "") @@ -39,7 +38,6 @@ public class Order { this.id = id; } - /** **/ @ApiModelProperty(value = "") @@ -51,7 +49,6 @@ public class Order { this.petId = petId; } - /** **/ @ApiModelProperty(value = "") @@ -63,7 +60,6 @@ public class Order { this.quantity = quantity; } - /** **/ @ApiModelProperty(value = "") @@ -75,7 +71,6 @@ public class Order { this.shipDate = shipDate; } - /** * Order Status **/ @@ -88,7 +83,6 @@ public class Order { this.status = status; } - /** **/ @ApiModelProperty(value = "") @@ -100,7 +94,6 @@ public class Order { this.complete = complete; } - @Override public boolean equals(Object o) { diff --git a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/Pet.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/Pet.java index dfe4f8ab170..237334cecd8 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/Pet.java +++ b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/Pet.java @@ -16,7 +16,7 @@ import java.util.Objects; @ApiModel(description = "") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-02-26T13:58:54.483Z") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-15T00:38:43.027+08:00") public class Pet { private Long id = null; @@ -30,7 +30,6 @@ public class Pet { private StatusEnum status = null; - /** **/ @ApiModelProperty(value = "") @@ -42,7 +41,6 @@ public class Pet { this.id = id; } - /** **/ @ApiModelProperty(value = "") @@ -54,7 +52,6 @@ public class Pet { this.category = category; } - /** **/ @ApiModelProperty(required = true, value = "") @@ -66,7 +63,6 @@ public class Pet { this.name = name; } - /** **/ @ApiModelProperty(required = true, value = "") @@ -78,7 +74,6 @@ public class Pet { this.photoUrls = photoUrls; } - /** **/ @ApiModelProperty(value = "") @@ -90,7 +85,6 @@ public class Pet { this.tags = tags; } - /** * pet status in the store **/ @@ -103,7 +97,6 @@ public class Pet { this.status = status; } - @Override public boolean equals(Object o) { diff --git a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/SpecialModelName.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/SpecialModelName.java new file mode 100644 index 00000000000..0aaad51d9f3 --- /dev/null +++ b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/SpecialModelName.java @@ -0,0 +1,57 @@ +package io.swagger.model; + +import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +import io.swagger.annotations.*; +import com.fasterxml.jackson.annotation.JsonProperty; + +import java.util.Objects; + + +@ApiModel(description = "") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-15T00:36:54.567+08:00") +public class SpecialModelName { + + private Long specialPropertyName = null; + + /** + **/ + @ApiModelProperty(value = "") + @JsonProperty("$special[property.name]") + public Long getSpecialPropertyName() { + return specialPropertyName; + } + public void setSpecialPropertyName(Long specialPropertyName) { + this.specialPropertyName = specialPropertyName; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SpecialModelName specialModelName = (SpecialModelName) o; + return Objects.equals(specialPropertyName, specialModelName.specialPropertyName); + } + + @Override + public int hashCode() { + return Objects.hash(specialPropertyName); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SpecialModelName {\n"); + + sb.append(" specialPropertyName: ").append(specialPropertyName).append("\n"); + sb.append("}\n"); + return sb.toString(); + } +} diff --git a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/Tag.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/Tag.java index af418119b39..198c82110d2 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/Tag.java +++ b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/Tag.java @@ -11,13 +11,12 @@ import java.util.Objects; @ApiModel(description = "") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-02-26T13:58:54.483Z") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-15T00:38:43.027+08:00") public class Tag { private Long id = null; private String name = null; - /** **/ @ApiModelProperty(value = "") @@ -29,7 +28,6 @@ public class Tag { this.id = id; } - /** **/ @ApiModelProperty(value = "") @@ -41,7 +39,6 @@ public class Tag { this.name = name; } - @Override public boolean equals(Object o) { diff --git a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/User.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/User.java index 1862568a35e..0d016a705a6 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/User.java +++ b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/User.java @@ -11,7 +11,7 @@ import java.util.Objects; @ApiModel(description = "") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-02-26T13:58:54.483Z") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-15T00:38:43.027+08:00") public class User { private Long id = null; @@ -23,7 +23,6 @@ public class User { private String phone = null; private Integer userStatus = null; - /** **/ @ApiModelProperty(value = "") @@ -35,7 +34,6 @@ public class User { this.id = id; } - /** **/ @ApiModelProperty(value = "") @@ -47,7 +45,6 @@ public class User { this.username = username; } - /** **/ @ApiModelProperty(value = "") @@ -59,7 +56,6 @@ public class User { this.firstName = firstName; } - /** **/ @ApiModelProperty(value = "") @@ -71,7 +67,6 @@ public class User { this.lastName = lastName; } - /** **/ @ApiModelProperty(value = "") @@ -83,7 +78,6 @@ public class User { this.email = email; } - /** **/ @ApiModelProperty(value = "") @@ -95,7 +89,6 @@ public class User { this.password = password; } - /** **/ @ApiModelProperty(value = "") @@ -107,7 +100,6 @@ public class User { this.phone = phone; } - /** * User Status **/ @@ -120,7 +112,6 @@ public class User { this.userStatus = userStatus; } - @Override public boolean equals(Object o) {