diff --git a/modules/swagger-codegen/src/main/resources/JavaSpring/beanValidation.mustache b/modules/swagger-codegen/src/main/resources/JavaSpring/beanValidation.mustache index c8c6946fef6..f6b013abc98 100644 --- a/modules/swagger-codegen/src/main/resources/JavaSpring/beanValidation.mustache +++ b/modules/swagger-codegen/src/main/resources/JavaSpring/beanValidation.mustache @@ -1,4 +1,5 @@ {{#required}} @NotNull {{/required}} -{{>beanValidationCore}} \ No newline at end of file +{{>beanValidationCore}} + @Valid diff --git a/modules/swagger-codegen/src/main/resources/JavaSpring/beanValidationCore.mustache b/modules/swagger-codegen/src/main/resources/JavaSpring/beanValidationCore.mustache index dc7a8392216..982ee8208aa 100644 --- a/modules/swagger-codegen/src/main/resources/JavaSpring/beanValidationCore.mustache +++ b/modules/swagger-codegen/src/main/resources/JavaSpring/beanValidationCore.mustache @@ -5,16 +5,16 @@ minLength set, maxLength not }}{{#minLength}}{{^maxLength}} @Size(min={{minLength}}){{/maxLength}}{{/minLength}}{{! minLength not set, maxLength set }}{{^minLength}}{{#maxLength}} @Size(max={{maxLength}}){{/maxLength}}{{/minLength}}{{! -@Size: minItems && maxItems set +@Size: minItems && maxItems set }}{{#minItems}}{{#maxItems}} @Size(min={{minItems}},max={{maxItems}}){{/maxItems}}{{/minItems}}{{! -@Size: minItems set, maxItems not +@Size: minItems set, maxItems not }}{{#minItems}}{{^maxItems}} @Size(min={{minItems}}){{/maxItems}}{{/minItems}}{{! -@Size: minItems not set && maxItems set -}}{{^minItems}}{{#maxItems}} @Size(max={{maxItems}}){{/maxItems}}{{/minItems}}{{! +@Size: minItems not set && maxItems set +}}{{^minItems}}{{#maxItems}} @Size(max={{maxItems}}){{/maxItems}}{{/minItems}}{{! check for integer or long / all others=decimal type with @Decimal* isInteger set }}{{#isInteger}}{{#minimum}} @Min({{minimum}}){{/minimum}}{{#maximum}} @Max({{maximum}}){{/maximum}}{{/isInteger}}{{! -isLong set +isLong set }}{{#isLong}}{{#minimum}} @Min({{minimum}}){{/minimum}}{{#maximum}} @Max({{maximum}}){{/maximum}}{{/isLong}}{{! Not Integer, not Long => we have a decimal value! }}{{^isInteger}}{{^isLong}}{{#minimum}} @DecimalMin("{{minimum}}"){{/minimum}}{{#maximum}} @DecimalMax("{{maximum}}"){{/maximum}}{{/isLong}}{{/isInteger}} \ No newline at end of file diff --git a/modules/swagger-codegen/src/main/resources/JavaSpring/beanValidationQueryParams.mustache b/modules/swagger-codegen/src/main/resources/JavaSpring/beanValidationQueryParams.mustache index f8eef8f94c7..c4ff01d7e55 100644 --- a/modules/swagger-codegen/src/main/resources/JavaSpring/beanValidationQueryParams.mustache +++ b/modules/swagger-codegen/src/main/resources/JavaSpring/beanValidationQueryParams.mustache @@ -1 +1 @@ -{{#required}} @NotNull{{/required}}{{>beanValidationCore}} \ No newline at end of file +{{#required}} @NotNull{{/required}}{{>beanValidationCore}} \ No newline at end of file diff --git a/modules/swagger-codegen/src/main/resources/JavaSpring/model.mustache b/modules/swagger-codegen/src/main/resources/JavaSpring/model.mustache index a3d4e232757..12a0f530bb0 100644 --- a/modules/swagger-codegen/src/main/resources/JavaSpring/model.mustache +++ b/modules/swagger-codegen/src/main/resources/JavaSpring/model.mustache @@ -7,8 +7,10 @@ import java.util.Objects; import java.io.Serializable; {{/serializableModel}} {{#useBeanValidation}} +import javax.validation.Valid; import javax.validation.constraints.*; {{/useBeanValidation}} + {{#models}} {{#model}} {{#isEnum}} diff --git a/modules/swagger-codegen/src/main/resources/cpprest/api-source.mustache b/modules/swagger-codegen/src/main/resources/cpprest/api-source.mustache index 2a35f85fa12..9899a86b6e5 100644 --- a/modules/swagger-codegen/src/main/resources/cpprest/api-source.mustache +++ b/modules/swagger-codegen/src/main/resources/cpprest/api-source.mustache @@ -28,13 +28,13 @@ using namespace {{modelNamespace}}; {{#operation}} pplx::task<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}void{{/returnType}}> {{classname}}::{{operationId}}({{#allParams}}{{{dataType}}} {{paramName}}{{^required}}{{/required}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) { - {{#allParams}}{{#required}}{{^isPrimitiveType}}{{^isContainer}} +{{#allParams}}{{#required}}{{^isPrimitiveType}}{{^isContainer}} // verify the required parameter '{{paramName}}' is set if ({{paramName}} == nullptr) { throw ApiException(400, U("Missing required parameter '{{paramName}}' when calling {{classname}}->{{operationId}}")); } - {{/isContainer}}{{/isPrimitiveType}}{{/required}}{{/allParams}} +{{/isContainer}}{{/isPrimitiveType}}{{/required}}{{/allParams}} std::shared_ptr apiConfiguration( m_ApiClient->getConfiguration() ); utility::string_t path = U("{{{path}}}"); diff --git a/modules/swagger-codegen/src/main/resources/cpprest/apiclient-source.mustache b/modules/swagger-codegen/src/main/resources/cpprest/apiclient-source.mustache index d1232aaaa2d..dc2bddb8db3 100644 --- a/modules/swagger-codegen/src/main/resources/cpprest/apiclient-source.mustache +++ b/modules/swagger-codegen/src/main/resources/cpprest/apiclient-source.mustache @@ -33,11 +33,15 @@ utility::string_t ApiClient::parameterToString(utility::string_t value) } utility::string_t ApiClient::parameterToString(int64_t value) { - return utility::conversions::to_string_t(std::to_string(value)); + std::stringstream valueAsStringStream; + valueAsStringStream << value; + return utility::conversions::to_string_t(valueAsStringStream.str()); } utility::string_t ApiClient::parameterToString(int32_t value) { - return utility::conversions::to_string_t(std::to_string(value)); + std::stringstream valueAsStringStream; + valueAsStringStream << value; + return utility::conversions::to_string_t(valueAsStringStream.str()); } utility::string_t ApiClient::parameterToString(float value) diff --git a/modules/swagger-codegen/src/main/resources/cpprest/modelbase-source.mustache b/modules/swagger-codegen/src/main/resources/cpprest/modelbase-source.mustache index 65d6d7d12a0..d578f192758 100644 --- a/modules/swagger-codegen/src/main/resources/cpprest/modelbase-source.mustache +++ b/modules/swagger-codegen/src/main/resources/cpprest/modelbase-source.mustache @@ -118,7 +118,9 @@ std::shared_ptr ModelBase::toHttpContent( const utility::string_t& content->setName( name ); content->setContentDisposition( U("form-data") ); content->setContentType( contentType ); - content->setData( std::shared_ptr( new std::stringstream( std::to_string( value ) ) ) ); + std::stringstream* valueAsStringStream = new std::stringstream(); + (*valueAsStringStream) << value; + content->setData( std::shared_ptr( valueAsStringStream ) ); return content; } std::shared_ptr ModelBase::toHttpContent( const utility::string_t& name, int64_t value, const utility::string_t& contentType ) @@ -127,7 +129,9 @@ std::shared_ptr ModelBase::toHttpContent( const utility::string_t& content->setName( name ); content->setContentDisposition( U("form-data") ); content->setContentType( contentType ); - content->setData( std::shared_ptr( new std::stringstream( std::to_string( value ) ) ) ); + std::stringstream* valueAsStringStream = new std::stringstream(); + (*valueAsStringStream) << value; + content->setData( std::shared_ptr( valueAsStringStream) ) ; return content; } std::shared_ptr ModelBase::toHttpContent( const utility::string_t& name, double value, const utility::string_t& contentType ) @@ -136,7 +140,9 @@ std::shared_ptr ModelBase::toHttpContent( const utility::string_t& content->setName( name ); content->setContentDisposition( U("form-data") ); content->setContentType( contentType ); - content->setData( std::shared_ptr( new std::stringstream( std::to_string( value ) ) ) ); + std::stringstream* valueAsStringStream = new std::stringstream(); + (*valueAsStringStream) << value; + content->setData( std::shared_ptr( valueAsStringStream ) ); return content; } diff --git a/samples/client/petstore/cpprest/ApiClient.cpp b/samples/client/petstore/cpprest/ApiClient.cpp index 00798258261..aeed9ef42ae 100644 --- a/samples/client/petstore/cpprest/ApiClient.cpp +++ b/samples/client/petstore/cpprest/ApiClient.cpp @@ -45,9 +45,18 @@ utility::string_t ApiClient::parameterToString(utility::string_t value) } utility::string_t ApiClient::parameterToString(int64_t value) { - return utility::conversions::to_string_t(std::to_string(value)); + std::stringstream valueAsStringStream; + valueAsStringStream << value; + return utility::conversions::to_string_t(valueAsStringStream.str()); } utility::string_t ApiClient::parameterToString(int32_t value) +{ + std::stringstream valueAsStringStream; + valueAsStringStream << value; + return utility::conversions::to_string_t(valueAsStringStream.str()); +} + +utility::string_t ApiClient::parameterToString(float value) { return utility::conversions::to_string_t(std::to_string(value)); } @@ -120,12 +129,24 @@ pplx::task ApiClient::callApi( } else { - web::http::uri_builder formData; - for (auto& kvp : formParams) + if (contentType == U("application/json")) { - formData.append_query(kvp.first, kvp.second); + web::json::value body_data = web::json::value::object(); + for (auto& kvp : formParams) + { + body_data[U(kvp.first)] = ModelBase::toJson(kvp.second); + } + request.set_body(body_data); + } + else + { + web::http::uri_builder formData; + for (auto& kvp : formParams) + { + formData.append_query(kvp.first, kvp.second); + } + request.set_body(formData.query(), U("application/x-www-form-urlencoded")); } - request.set_body(formData.query(), U("application/x-www-form-urlencoded")); } } diff --git a/samples/client/petstore/cpprest/ApiClient.h b/samples/client/petstore/cpprest/ApiClient.h index 1678e9e8c51..1f38c864f0e 100644 --- a/samples/client/petstore/cpprest/ApiClient.h +++ b/samples/client/petstore/cpprest/ApiClient.h @@ -50,6 +50,7 @@ public: static utility::string_t parameterToString(utility::string_t value); static utility::string_t parameterToString(int32_t value); static utility::string_t parameterToString(int64_t value); + static utility::string_t parameterToString(float value); static utility::string_t parameterToString(const utility::datetime &value); template diff --git a/samples/client/petstore/cpprest/ModelBase.cpp b/samples/client/petstore/cpprest/ModelBase.cpp index 197741f5379..07f44a15a0e 100644 --- a/samples/client/petstore/cpprest/ModelBase.cpp +++ b/samples/client/petstore/cpprest/ModelBase.cpp @@ -130,7 +130,9 @@ std::shared_ptr ModelBase::toHttpContent( const utility::string_t& content->setName( name ); content->setContentDisposition( U("form-data") ); content->setContentType( contentType ); - content->setData( std::shared_ptr( new std::stringstream( std::to_string( value ) ) ) ); + std::stringstream* valueAsStringStream = new std::stringstream(); + (*valueAsStringStream) << value; + content->setData( std::shared_ptr( valueAsStringStream ) ); return content; } std::shared_ptr ModelBase::toHttpContent( const utility::string_t& name, int64_t value, const utility::string_t& contentType ) @@ -139,7 +141,9 @@ std::shared_ptr ModelBase::toHttpContent( const utility::string_t& content->setName( name ); content->setContentDisposition( U("form-data") ); content->setContentType( contentType ); - content->setData( std::shared_ptr( new std::stringstream( std::to_string( value ) ) ) ); + std::stringstream* valueAsStringStream = new std::stringstream(); + (*valueAsStringStream) << value; + content->setData( std::shared_ptr( valueAsStringStream) ) ; return content; } std::shared_ptr ModelBase::toHttpContent( const utility::string_t& name, double value, const utility::string_t& contentType ) @@ -148,7 +152,9 @@ std::shared_ptr ModelBase::toHttpContent( const utility::string_t& content->setName( name ); content->setContentDisposition( U("form-data") ); content->setContentType( contentType ); - content->setData( std::shared_ptr( new std::stringstream( std::to_string( value ) ) ) ); + std::stringstream* valueAsStringStream = new std::stringstream(); + (*valueAsStringStream) << value; + content->setData( std::shared_ptr( valueAsStringStream ) ); return content; } @@ -277,6 +283,10 @@ int32_t ModelBase::int32_tFromJson(web::json::value& val) { return val.as_integer(); } +float ModelBase::floatFromJson(web::json::value& val) +{ + return val.as_double(); +} utility::string_t ModelBase::stringFromJson(web::json::value& val) { return val.is_string() ? val.as_string() : U(""); @@ -313,6 +323,15 @@ int32_t ModelBase::int32_tFromHttpContent(std::shared_ptr val) ss >> result; return result; } +float ModelBase::floatFromHttpContent(std::shared_ptr val) +{ + utility::string_t str = ModelBase::stringFromHttpContent(val); + + utility::stringstream_t ss(str); + float result = 0; + ss >> result; + return result; +} utility::string_t ModelBase::stringFromHttpContent(std::shared_ptr val) { std::shared_ptr data = val->getData(); diff --git a/samples/client/petstore/cpprest/ModelBase.h b/samples/client/petstore/cpprest/ModelBase.h index 013c99a5d70..558d403b15d 100644 --- a/samples/client/petstore/cpprest/ModelBase.h +++ b/samples/client/petstore/cpprest/ModelBase.h @@ -56,6 +56,7 @@ public: static int64_t int64_tFromJson(web::json::value& val); static int32_t int32_tFromJson(web::json::value& val); + static float floatFromJson(web::json::value& val); static utility::string_t stringFromJson(web::json::value& val); static utility::datetime dateFromJson(web::json::value& val); static double doubleFromJson(web::json::value& val); @@ -72,6 +73,7 @@ public: static int64_t int64_tFromHttpContent(std::shared_ptr val); static int32_t int32_tFromHttpContent(std::shared_ptr val); + static float floatFromHttpContent(std::shared_ptr val); static utility::string_t stringFromHttpContent(std::shared_ptr val); static utility::datetime dateFromHttpContent(std::shared_ptr val); static bool boolFromHttpContent(std::shared_ptr val); diff --git a/samples/client/petstore/cpprest/api/PetApi.cpp b/samples/client/petstore/cpprest/api/PetApi.cpp index d3e337d367f..a5e3d57c70b 100644 --- a/samples/client/petstore/cpprest/api/PetApi.cpp +++ b/samples/client/petstore/cpprest/api/PetApi.cpp @@ -38,13 +38,13 @@ PetApi::~PetApi() pplx::task PetApi::addPet(std::shared_ptr body) { - + // verify the required parameter 'body' is set if (body == nullptr) { throw ApiException(400, U("Missing required parameter 'body' when calling PetApi->addPet")); } - + std::shared_ptr apiConfiguration( m_ApiClient->getConfiguration() ); utility::string_t path = U("/pet"); @@ -160,7 +160,7 @@ pplx::task PetApi::addPet(std::shared_ptr body) } pplx::task PetApi::deletePet(int64_t petId, utility::string_t apiKey) { - + std::shared_ptr apiConfiguration( m_ApiClient->getConfiguration() ); utility::string_t path = U("/pet/{petId}"); @@ -266,7 +266,7 @@ pplx::task PetApi::deletePet(int64_t petId, utility::string_t apiKey) } pplx::task>> PetApi::findPetsByStatus(std::vector status) { - + std::shared_ptr apiConfiguration( m_ApiClient->getConfiguration() ); utility::string_t path = U("/pet/findByStatus"); @@ -396,7 +396,7 @@ pplx::task>> PetApi::findPetsByStatus(std::vect } pplx::task>> PetApi::findPetsByTags(std::vector tags) { - + std::shared_ptr apiConfiguration( m_ApiClient->getConfiguration() ); utility::string_t path = U("/pet/findByTags"); @@ -526,7 +526,7 @@ pplx::task>> PetApi::findPetsByTags(std::vector } pplx::task> PetApi::getPetById(int64_t petId) { - + std::shared_ptr apiConfiguration( m_ApiClient->getConfiguration() ); utility::string_t path = U("/pet/{petId}"); @@ -652,13 +652,13 @@ pplx::task> PetApi::getPetById(int64_t petId) } pplx::task PetApi::updatePet(std::shared_ptr body) { - + // verify the required parameter 'body' is set if (body == nullptr) { throw ApiException(400, U("Missing required parameter 'body' when calling PetApi->updatePet")); } - + std::shared_ptr apiConfiguration( m_ApiClient->getConfiguration() ); utility::string_t path = U("/pet"); @@ -774,7 +774,7 @@ pplx::task PetApi::updatePet(std::shared_ptr body) } pplx::task PetApi::updatePetWithForm(int64_t petId, utility::string_t name, utility::string_t status) { - + std::shared_ptr apiConfiguration( m_ApiClient->getConfiguration() ); utility::string_t path = U("/pet/{petId}"); @@ -885,7 +885,7 @@ pplx::task PetApi::updatePetWithForm(int64_t petId, utility::string_t name } pplx::task> PetApi::uploadFile(int64_t petId, utility::string_t additionalMetadata, std::shared_ptr file) { - + std::shared_ptr apiConfiguration( m_ApiClient->getConfiguration() ); utility::string_t path = U("/pet/{petId}/uploadImage"); diff --git a/samples/client/petstore/cpprest/api/StoreApi.cpp b/samples/client/petstore/cpprest/api/StoreApi.cpp index 40a6b8cfb71..d418af4fa4c 100644 --- a/samples/client/petstore/cpprest/api/StoreApi.cpp +++ b/samples/client/petstore/cpprest/api/StoreApi.cpp @@ -38,7 +38,7 @@ StoreApi::~StoreApi() pplx::task StoreApi::deleteOrder(utility::string_t orderId) { - + std::shared_ptr apiConfiguration( m_ApiClient->getConfiguration() ); utility::string_t path = U("/store/order/{orderId}"); @@ -138,7 +138,7 @@ pplx::task StoreApi::deleteOrder(utility::string_t orderId) } pplx::task> StoreApi::getInventory() { - + std::shared_ptr apiConfiguration( m_ApiClient->getConfiguration() ); utility::string_t path = U("/store/inventory"); @@ -267,7 +267,7 @@ pplx::task> StoreApi::getInventory() } pplx::task> StoreApi::getOrderById(int64_t orderId) { - + std::shared_ptr apiConfiguration( m_ApiClient->getConfiguration() ); utility::string_t path = U("/store/order/{orderId}"); @@ -385,13 +385,13 @@ pplx::task> StoreApi::getOrderById(int64_t orderId) } pplx::task> StoreApi::placeOrder(std::shared_ptr body) { - + // verify the required parameter 'body' is set if (body == nullptr) { throw ApiException(400, U("Missing required parameter 'body' when calling StoreApi->placeOrder")); } - + std::shared_ptr apiConfiguration( m_ApiClient->getConfiguration() ); utility::string_t path = U("/store/order"); diff --git a/samples/client/petstore/cpprest/api/UserApi.cpp b/samples/client/petstore/cpprest/api/UserApi.cpp index 289295a36b5..3e0318000f9 100644 --- a/samples/client/petstore/cpprest/api/UserApi.cpp +++ b/samples/client/petstore/cpprest/api/UserApi.cpp @@ -38,13 +38,13 @@ UserApi::~UserApi() pplx::task UserApi::createUser(std::shared_ptr body) { - + // verify the required parameter 'body' is set if (body == nullptr) { throw ApiException(400, U("Missing required parameter 'body' when calling UserApi->createUser")); } - + std::shared_ptr apiConfiguration( m_ApiClient->getConfiguration() ); utility::string_t path = U("/user"); @@ -156,7 +156,7 @@ pplx::task UserApi::createUser(std::shared_ptr body) } pplx::task UserApi::createUsersWithArrayInput(std::vector> body) { - + std::shared_ptr apiConfiguration( m_ApiClient->getConfiguration() ); utility::string_t path = U("/user/createWithArray"); @@ -281,7 +281,7 @@ pplx::task UserApi::createUsersWithArrayInput(std::vector UserApi::createUsersWithListInput(std::vector> body) { - + std::shared_ptr apiConfiguration( m_ApiClient->getConfiguration() ); utility::string_t path = U("/user/createWithList"); @@ -406,7 +406,7 @@ pplx::task UserApi::createUsersWithListInput(std::vector UserApi::deleteUser(utility::string_t username) { - + std::shared_ptr apiConfiguration( m_ApiClient->getConfiguration() ); utility::string_t path = U("/user/{username}"); @@ -506,7 +506,7 @@ pplx::task UserApi::deleteUser(utility::string_t username) } pplx::task> UserApi::getUserByName(utility::string_t username) { - + std::shared_ptr apiConfiguration( m_ApiClient->getConfiguration() ); utility::string_t path = U("/user/{username}"); @@ -624,7 +624,7 @@ pplx::task> UserApi::getUserByName(utility::string_t usern } pplx::task UserApi::loginUser(utility::string_t username, utility::string_t password) { - + std::shared_ptr apiConfiguration( m_ApiClient->getConfiguration() ); utility::string_t path = U("/user/login"); @@ -759,7 +759,7 @@ pplx::task UserApi::loginUser(utility::string_t username, uti } pplx::task UserApi::logoutUser() { - + std::shared_ptr apiConfiguration( m_ApiClient->getConfiguration() ); utility::string_t path = U("/user/logout"); @@ -858,13 +858,13 @@ pplx::task UserApi::logoutUser() } pplx::task UserApi::updateUser(utility::string_t username, std::shared_ptr body) { - + // verify the required parameter 'body' is set if (body == nullptr) { throw ApiException(400, U("Missing required parameter 'body' when calling UserApi->updateUser")); } - + std::shared_ptr apiConfiguration( m_ApiClient->getConfiguration() ); utility::string_t path = U("/user/{username}"); diff --git a/samples/client/petstore/spring-cloud/src/main/java/io/swagger/api/PetApi.java b/samples/client/petstore/spring-cloud/src/main/java/io/swagger/api/PetApi.java index b20ecbf840f..4a9c5cca68d 100644 --- a/samples/client/petstore/spring-cloud/src/main/java/io/swagger/api/PetApi.java +++ b/samples/client/petstore/spring-cloud/src/main/java/io/swagger/api/PetApi.java @@ -66,7 +66,7 @@ public interface PetApi { produces = "application/json", consumes = "application/json", method = RequestMethod.GET) - com.netflix.hystrix.HystrixCommand>> 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, @RequestHeader("Accept") String accept) throws IOException; + com.netflix.hystrix.HystrixCommand>> 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, @RequestHeader("Accept") String accept) throws IOException; @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 = { @@ -82,7 +82,7 @@ public interface PetApi { produces = "application/json", consumes = "application/json", method = RequestMethod.GET) - com.netflix.hystrix.HystrixCommand>> findPetsByTags( @NotNull @ApiParam(value = "Tags to filter by", required = true) @RequestParam(value = "tags", required = true) List tags, @RequestHeader("Accept") String accept) throws IOException; + com.netflix.hystrix.HystrixCommand>> findPetsByTags( @NotNull@ApiParam(value = "Tags to filter by", required = true) @RequestParam(value = "tags", required = true) List tags, @RequestHeader("Accept") String accept) throws IOException; @ApiOperation(value = "Find pet by ID", notes = "Returns a single pet", response = Pet.class, authorizations = { diff --git a/samples/client/petstore/spring-cloud/src/main/java/io/swagger/api/UserApi.java b/samples/client/petstore/spring-cloud/src/main/java/io/swagger/api/UserApi.java index af204933788..68ed26e5263 100644 --- a/samples/client/petstore/spring-cloud/src/main/java/io/swagger/api/UserApi.java +++ b/samples/client/petstore/spring-cloud/src/main/java/io/swagger/api/UserApi.java @@ -83,7 +83,7 @@ public interface UserApi { produces = "application/json", consumes = "application/json", method = RequestMethod.GET) - com.netflix.hystrix.HystrixCommand> loginUser( @NotNull @ApiParam(value = "The user name for login", required = true) @RequestParam(value = "username", required = true) String username, @NotNull @ApiParam(value = "The password for login in clear text", required = true) @RequestParam(value = "password", required = true) String password, @RequestHeader("Accept") String accept) throws IOException; + com.netflix.hystrix.HystrixCommand> loginUser( @NotNull@ApiParam(value = "The user name for login", required = true) @RequestParam(value = "username", required = true) String username, @NotNull@ApiParam(value = "The password for login in clear text", required = true) @RequestParam(value = "password", required = true) String password, @RequestHeader("Accept") String accept) throws IOException; @ApiOperation(value = "Logs out current logged in user session", notes = "", response = Void.class, tags={ "user", }) diff --git a/samples/client/petstore/spring-cloud/src/main/java/io/swagger/model/Category.java b/samples/client/petstore/spring-cloud/src/main/java/io/swagger/model/Category.java index 9611305a687..7289c191a9c 100644 --- a/samples/client/petstore/spring-cloud/src/main/java/io/swagger/model/Category.java +++ b/samples/client/petstore/spring-cloud/src/main/java/io/swagger/model/Category.java @@ -5,7 +5,9 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * A category for a pet */ @@ -28,6 +30,8 @@ public class Category { * @return id **/ @ApiModelProperty(value = "") + + @Valid public Long getId() { return id; } @@ -46,6 +50,8 @@ public class Category { * @return name **/ @ApiModelProperty(value = "") + + @Valid public String getName() { return name; } diff --git a/samples/client/petstore/spring-cloud/src/main/java/io/swagger/model/ModelApiResponse.java b/samples/client/petstore/spring-cloud/src/main/java/io/swagger/model/ModelApiResponse.java index 63561b90939..d9a1123d082 100644 --- a/samples/client/petstore/spring-cloud/src/main/java/io/swagger/model/ModelApiResponse.java +++ b/samples/client/petstore/spring-cloud/src/main/java/io/swagger/model/ModelApiResponse.java @@ -5,7 +5,9 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * Describes the result of uploading an image resource */ @@ -31,6 +33,8 @@ public class ModelApiResponse { * @return code **/ @ApiModelProperty(value = "") + + @Valid public Integer getCode() { return code; } @@ -49,6 +53,8 @@ public class ModelApiResponse { * @return type **/ @ApiModelProperty(value = "") + + @Valid public String getType() { return type; } @@ -67,6 +73,8 @@ public class ModelApiResponse { * @return message **/ @ApiModelProperty(value = "") + + @Valid public String getMessage() { return message; } diff --git a/samples/client/petstore/spring-cloud/src/main/java/io/swagger/model/Order.java b/samples/client/petstore/spring-cloud/src/main/java/io/swagger/model/Order.java index c8db6b95510..e417cc17e61 100644 --- a/samples/client/petstore/spring-cloud/src/main/java/io/swagger/model/Order.java +++ b/samples/client/petstore/spring-cloud/src/main/java/io/swagger/model/Order.java @@ -7,7 +7,9 @@ import com.fasterxml.jackson.annotation.JsonValue; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import org.threeten.bp.OffsetDateTime; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * An order for a pets from the pet store */ @@ -75,6 +77,8 @@ public class Order { * @return id **/ @ApiModelProperty(value = "") + + @Valid public Long getId() { return id; } @@ -93,6 +97,8 @@ public class Order { * @return petId **/ @ApiModelProperty(value = "") + + @Valid public Long getPetId() { return petId; } @@ -111,6 +117,8 @@ public class Order { * @return quantity **/ @ApiModelProperty(value = "") + + @Valid public Integer getQuantity() { return quantity; } @@ -129,6 +137,8 @@ public class Order { * @return shipDate **/ @ApiModelProperty(value = "") + + @Valid public OffsetDateTime getShipDate() { return shipDate; } @@ -147,6 +157,8 @@ public class Order { * @return status **/ @ApiModelProperty(value = "Order Status") + + @Valid public StatusEnum getStatus() { return status; } @@ -165,6 +177,8 @@ public class Order { * @return complete **/ @ApiModelProperty(value = "") + + @Valid public Boolean getComplete() { return complete; } diff --git a/samples/client/petstore/spring-cloud/src/main/java/io/swagger/model/Pet.java b/samples/client/petstore/spring-cloud/src/main/java/io/swagger/model/Pet.java index 159b993ed37..f79e9ae56d4 100644 --- a/samples/client/petstore/spring-cloud/src/main/java/io/swagger/model/Pet.java +++ b/samples/client/petstore/spring-cloud/src/main/java/io/swagger/model/Pet.java @@ -10,7 +10,9 @@ import io.swagger.model.Category; import io.swagger.model.Tag; import java.util.ArrayList; import java.util.List; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * A pet for sale in the pet store */ @@ -78,6 +80,8 @@ public class Pet { * @return id **/ @ApiModelProperty(value = "") + + @Valid public Long getId() { return id; } @@ -96,6 +100,8 @@ public class Pet { * @return category **/ @ApiModelProperty(value = "") + + @Valid public Category getCategory() { return category; } @@ -115,6 +121,8 @@ public class Pet { **/ @ApiModelProperty(example = "doggie", required = true, value = "") @NotNull + + @Valid public String getName() { return name; } @@ -139,6 +147,8 @@ public class Pet { **/ @ApiModelProperty(required = true, value = "") @NotNull + + @Valid public List getPhotoUrls() { return photoUrls; } @@ -165,6 +175,8 @@ public class Pet { * @return tags **/ @ApiModelProperty(value = "") + + @Valid public List getTags() { return tags; } @@ -183,6 +195,8 @@ public class Pet { * @return status **/ @ApiModelProperty(value = "pet status in the store") + + @Valid public StatusEnum getStatus() { return status; } diff --git a/samples/client/petstore/spring-cloud/src/main/java/io/swagger/model/Tag.java b/samples/client/petstore/spring-cloud/src/main/java/io/swagger/model/Tag.java index f363f8d9f86..e9ad7e51654 100644 --- a/samples/client/petstore/spring-cloud/src/main/java/io/swagger/model/Tag.java +++ b/samples/client/petstore/spring-cloud/src/main/java/io/swagger/model/Tag.java @@ -5,7 +5,9 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * A tag for a pet */ @@ -28,6 +30,8 @@ public class Tag { * @return id **/ @ApiModelProperty(value = "") + + @Valid public Long getId() { return id; } @@ -46,6 +50,8 @@ public class Tag { * @return name **/ @ApiModelProperty(value = "") + + @Valid public String getName() { return name; } diff --git a/samples/client/petstore/spring-cloud/src/main/java/io/swagger/model/User.java b/samples/client/petstore/spring-cloud/src/main/java/io/swagger/model/User.java index 1766e5dde17..b3b24907d97 100644 --- a/samples/client/petstore/spring-cloud/src/main/java/io/swagger/model/User.java +++ b/samples/client/petstore/spring-cloud/src/main/java/io/swagger/model/User.java @@ -5,7 +5,9 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * A User who is purchasing from the pet store */ @@ -46,6 +48,8 @@ public class User { * @return id **/ @ApiModelProperty(value = "") + + @Valid public Long getId() { return id; } @@ -64,6 +68,8 @@ public class User { * @return username **/ @ApiModelProperty(value = "") + + @Valid public String getUsername() { return username; } @@ -82,6 +88,8 @@ public class User { * @return firstName **/ @ApiModelProperty(value = "") + + @Valid public String getFirstName() { return firstName; } @@ -100,6 +108,8 @@ public class User { * @return lastName **/ @ApiModelProperty(value = "") + + @Valid public String getLastName() { return lastName; } @@ -118,6 +128,8 @@ public class User { * @return email **/ @ApiModelProperty(value = "") + + @Valid public String getEmail() { return email; } @@ -136,6 +148,8 @@ public class User { * @return password **/ @ApiModelProperty(value = "") + + @Valid public String getPassword() { return password; } @@ -154,6 +168,8 @@ public class User { * @return phone **/ @ApiModelProperty(value = "") + + @Valid public String getPhone() { return phone; } @@ -172,6 +188,8 @@ public class User { * @return userStatus **/ @ApiModelProperty(value = "User Status") + + @Valid public Integer getUserStatus() { return userStatus; } diff --git a/samples/client/petstore/spring-stubs/src/main/java/io/swagger/api/PetApi.java b/samples/client/petstore/spring-stubs/src/main/java/io/swagger/api/PetApi.java index 3b98d756bb3..45f86ff8cbf 100644 --- a/samples/client/petstore/spring-stubs/src/main/java/io/swagger/api/PetApi.java +++ b/samples/client/petstore/spring-stubs/src/main/java/io/swagger/api/PetApi.java @@ -66,7 +66,7 @@ public interface PetApi { produces = "application/json", consumes = "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, @RequestHeader("Accept") String accept) throws IOException; + 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, @RequestHeader("Accept") String accept) throws IOException; @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 = { @@ -82,7 +82,7 @@ public interface PetApi { produces = "application/json", consumes = "application/json", method = RequestMethod.GET) - ResponseEntity> findPetsByTags( @NotNull @ApiParam(value = "Tags to filter by", required = true) @RequestParam(value = "tags", required = true) List tags, @RequestHeader("Accept") String accept) throws IOException; + ResponseEntity> findPetsByTags( @NotNull@ApiParam(value = "Tags to filter by", required = true) @RequestParam(value = "tags", required = true) List tags, @RequestHeader("Accept") String accept) throws IOException; @ApiOperation(value = "Find pet by ID", notes = "Returns a single pet", response = Pet.class, authorizations = { diff --git a/samples/client/petstore/spring-stubs/src/main/java/io/swagger/api/UserApi.java b/samples/client/petstore/spring-stubs/src/main/java/io/swagger/api/UserApi.java index b626f88e50b..5a4cef2892d 100644 --- a/samples/client/petstore/spring-stubs/src/main/java/io/swagger/api/UserApi.java +++ b/samples/client/petstore/spring-stubs/src/main/java/io/swagger/api/UserApi.java @@ -83,7 +83,7 @@ public interface UserApi { produces = "application/json", consumes = "application/json", method = RequestMethod.GET) - ResponseEntity loginUser( @NotNull @ApiParam(value = "The user name for login", required = true) @RequestParam(value = "username", required = true) String username, @NotNull @ApiParam(value = "The password for login in clear text", required = true) @RequestParam(value = "password", required = true) String password, @RequestHeader("Accept") String accept) throws IOException; + ResponseEntity loginUser( @NotNull@ApiParam(value = "The user name for login", required = true) @RequestParam(value = "username", required = true) String username, @NotNull@ApiParam(value = "The password for login in clear text", required = true) @RequestParam(value = "password", required = true) String password, @RequestHeader("Accept") String accept) throws IOException; @ApiOperation(value = "Logs out current logged in user session", notes = "", response = Void.class, tags={ "user", }) diff --git a/samples/client/petstore/spring-stubs/src/main/java/io/swagger/model/Category.java b/samples/client/petstore/spring-stubs/src/main/java/io/swagger/model/Category.java index 9611305a687..7289c191a9c 100644 --- a/samples/client/petstore/spring-stubs/src/main/java/io/swagger/model/Category.java +++ b/samples/client/petstore/spring-stubs/src/main/java/io/swagger/model/Category.java @@ -5,7 +5,9 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * A category for a pet */ @@ -28,6 +30,8 @@ public class Category { * @return id **/ @ApiModelProperty(value = "") + + @Valid public Long getId() { return id; } @@ -46,6 +50,8 @@ public class Category { * @return name **/ @ApiModelProperty(value = "") + + @Valid public String getName() { return name; } diff --git a/samples/client/petstore/spring-stubs/src/main/java/io/swagger/model/ModelApiResponse.java b/samples/client/petstore/spring-stubs/src/main/java/io/swagger/model/ModelApiResponse.java index 63561b90939..d9a1123d082 100644 --- a/samples/client/petstore/spring-stubs/src/main/java/io/swagger/model/ModelApiResponse.java +++ b/samples/client/petstore/spring-stubs/src/main/java/io/swagger/model/ModelApiResponse.java @@ -5,7 +5,9 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * Describes the result of uploading an image resource */ @@ -31,6 +33,8 @@ public class ModelApiResponse { * @return code **/ @ApiModelProperty(value = "") + + @Valid public Integer getCode() { return code; } @@ -49,6 +53,8 @@ public class ModelApiResponse { * @return type **/ @ApiModelProperty(value = "") + + @Valid public String getType() { return type; } @@ -67,6 +73,8 @@ public class ModelApiResponse { * @return message **/ @ApiModelProperty(value = "") + + @Valid public String getMessage() { return message; } diff --git a/samples/client/petstore/spring-stubs/src/main/java/io/swagger/model/Order.java b/samples/client/petstore/spring-stubs/src/main/java/io/swagger/model/Order.java index c8db6b95510..e417cc17e61 100644 --- a/samples/client/petstore/spring-stubs/src/main/java/io/swagger/model/Order.java +++ b/samples/client/petstore/spring-stubs/src/main/java/io/swagger/model/Order.java @@ -7,7 +7,9 @@ import com.fasterxml.jackson.annotation.JsonValue; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import org.threeten.bp.OffsetDateTime; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * An order for a pets from the pet store */ @@ -75,6 +77,8 @@ public class Order { * @return id **/ @ApiModelProperty(value = "") + + @Valid public Long getId() { return id; } @@ -93,6 +97,8 @@ public class Order { * @return petId **/ @ApiModelProperty(value = "") + + @Valid public Long getPetId() { return petId; } @@ -111,6 +117,8 @@ public class Order { * @return quantity **/ @ApiModelProperty(value = "") + + @Valid public Integer getQuantity() { return quantity; } @@ -129,6 +137,8 @@ public class Order { * @return shipDate **/ @ApiModelProperty(value = "") + + @Valid public OffsetDateTime getShipDate() { return shipDate; } @@ -147,6 +157,8 @@ public class Order { * @return status **/ @ApiModelProperty(value = "Order Status") + + @Valid public StatusEnum getStatus() { return status; } @@ -165,6 +177,8 @@ public class Order { * @return complete **/ @ApiModelProperty(value = "") + + @Valid public Boolean getComplete() { return complete; } diff --git a/samples/client/petstore/spring-stubs/src/main/java/io/swagger/model/Pet.java b/samples/client/petstore/spring-stubs/src/main/java/io/swagger/model/Pet.java index 159b993ed37..f79e9ae56d4 100644 --- a/samples/client/petstore/spring-stubs/src/main/java/io/swagger/model/Pet.java +++ b/samples/client/petstore/spring-stubs/src/main/java/io/swagger/model/Pet.java @@ -10,7 +10,9 @@ import io.swagger.model.Category; import io.swagger.model.Tag; import java.util.ArrayList; import java.util.List; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * A pet for sale in the pet store */ @@ -78,6 +80,8 @@ public class Pet { * @return id **/ @ApiModelProperty(value = "") + + @Valid public Long getId() { return id; } @@ -96,6 +100,8 @@ public class Pet { * @return category **/ @ApiModelProperty(value = "") + + @Valid public Category getCategory() { return category; } @@ -115,6 +121,8 @@ public class Pet { **/ @ApiModelProperty(example = "doggie", required = true, value = "") @NotNull + + @Valid public String getName() { return name; } @@ -139,6 +147,8 @@ public class Pet { **/ @ApiModelProperty(required = true, value = "") @NotNull + + @Valid public List getPhotoUrls() { return photoUrls; } @@ -165,6 +175,8 @@ public class Pet { * @return tags **/ @ApiModelProperty(value = "") + + @Valid public List getTags() { return tags; } @@ -183,6 +195,8 @@ public class Pet { * @return status **/ @ApiModelProperty(value = "pet status in the store") + + @Valid public StatusEnum getStatus() { return status; } diff --git a/samples/client/petstore/spring-stubs/src/main/java/io/swagger/model/Tag.java b/samples/client/petstore/spring-stubs/src/main/java/io/swagger/model/Tag.java index f363f8d9f86..e9ad7e51654 100644 --- a/samples/client/petstore/spring-stubs/src/main/java/io/swagger/model/Tag.java +++ b/samples/client/petstore/spring-stubs/src/main/java/io/swagger/model/Tag.java @@ -5,7 +5,9 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * A tag for a pet */ @@ -28,6 +30,8 @@ public class Tag { * @return id **/ @ApiModelProperty(value = "") + + @Valid public Long getId() { return id; } @@ -46,6 +50,8 @@ public class Tag { * @return name **/ @ApiModelProperty(value = "") + + @Valid public String getName() { return name; } diff --git a/samples/client/petstore/spring-stubs/src/main/java/io/swagger/model/User.java b/samples/client/petstore/spring-stubs/src/main/java/io/swagger/model/User.java index 1766e5dde17..b3b24907d97 100644 --- a/samples/client/petstore/spring-stubs/src/main/java/io/swagger/model/User.java +++ b/samples/client/petstore/spring-stubs/src/main/java/io/swagger/model/User.java @@ -5,7 +5,9 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * A User who is purchasing from the pet store */ @@ -46,6 +48,8 @@ public class User { * @return id **/ @ApiModelProperty(value = "") + + @Valid public Long getId() { return id; } @@ -64,6 +68,8 @@ public class User { * @return username **/ @ApiModelProperty(value = "") + + @Valid public String getUsername() { return username; } @@ -82,6 +88,8 @@ public class User { * @return firstName **/ @ApiModelProperty(value = "") + + @Valid public String getFirstName() { return firstName; } @@ -100,6 +108,8 @@ public class User { * @return lastName **/ @ApiModelProperty(value = "") + + @Valid public String getLastName() { return lastName; } @@ -118,6 +128,8 @@ public class User { * @return email **/ @ApiModelProperty(value = "") + + @Valid public String getEmail() { return email; } @@ -136,6 +148,8 @@ public class User { * @return password **/ @ApiModelProperty(value = "") + + @Valid public String getPassword() { return password; } @@ -154,6 +168,8 @@ public class User { * @return phone **/ @ApiModelProperty(value = "") + + @Valid public String getPhone() { return phone; } @@ -172,6 +188,8 @@ public class User { * @return userStatus **/ @ApiModelProperty(value = "User Status") + + @Valid public Integer getUserStatus() { return userStatus; } diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/FakeApi.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/FakeApi.java index 83e1a78e6bd..5dc9bce00ef 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/FakeApi.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/FakeApi.java @@ -63,7 +63,7 @@ public interface FakeApi { produces = { "*/*" }, consumes = { "*/*" }, method = RequestMethod.GET) - default CompletableFuture> testEnumParameters(@ApiParam(value = "Form parameter enum test (string array)", allowableValues=">, $") @RequestPart(value="enum_form_string_array", required=false) List enumFormStringArray,@ApiParam(value = "Form parameter enum test (string)", allowableValues="_abc, -efg, (xyz)", defaultValue="-efg") @RequestPart(value="enum_form_string", required=false) String enumFormString,@ApiParam(value = "Header parameter enum test (string array)" , allowableValues=">, $") @RequestHeader(value="enum_header_string_array", required=false) List enumHeaderStringArray,@ApiParam(value = "Header parameter enum test (string)" , allowableValues="_abc, -efg, (xyz)", defaultValue="-efg") @RequestHeader(value="enum_header_string", required=false) String enumHeaderString, @ApiParam(value = "Query parameter enum test (string array)", allowableValues = ">, $") @RequestParam(value = "enum_query_string_array", required = false) List enumQueryStringArray, @ApiParam(value = "Query parameter enum test (string)", allowableValues = "_abc, -efg, (xyz)", defaultValue = "-efg") @RequestParam(value = "enum_query_string", required = false, defaultValue="-efg") String enumQueryString, @ApiParam(value = "Query parameter enum test (double)", allowableValues = "1, -2") @RequestParam(value = "enum_query_integer", required = false) Integer enumQueryInteger,@ApiParam(value = "Query parameter enum test (double)", allowableValues="1.1, -1.2") @RequestPart(value="enum_query_double", required=false) Double enumQueryDouble, @RequestHeader("Accept") String accept) { + default CompletableFuture> testEnumParameters(@ApiParam(value = "Form parameter enum test (string array)", allowableValues=">, $") @RequestPart(value="enum_form_string_array", required=false) List enumFormStringArray,@ApiParam(value = "Form parameter enum test (string)", allowableValues="_abc, -efg, (xyz)", defaultValue="-efg") @RequestPart(value="enum_form_string", required=false) String enumFormString,@ApiParam(value = "Header parameter enum test (string array)" , allowableValues=">, $") @RequestHeader(value="enum_header_string_array", required=false) List enumHeaderStringArray,@ApiParam(value = "Header parameter enum test (string)" , allowableValues="_abc, -efg, (xyz)", defaultValue="-efg") @RequestHeader(value="enum_header_string", required=false) String enumHeaderString,@ApiParam(value = "Query parameter enum test (string array)", allowableValues = ">, $") @RequestParam(value = "enum_query_string_array", required = false) List enumQueryStringArray,@ApiParam(value = "Query parameter enum test (string)", allowableValues = "_abc, -efg, (xyz)", defaultValue = "-efg") @RequestParam(value = "enum_query_string", required = false, defaultValue="-efg") String enumQueryString,@ApiParam(value = "Query parameter enum test (double)", allowableValues = "1, -2") @RequestParam(value = "enum_query_integer", required = false) Integer enumQueryInteger,@ApiParam(value = "Query parameter enum test (double)", allowableValues="1.1, -1.2") @RequestPart(value="enum_query_double", required=false) Double enumQueryDouble, @RequestHeader("Accept") String accept) { // do some magic! return CompletableFuture.completedFuture(new ResponseEntity(HttpStatus.OK)); } diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/PetApi.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/PetApi.java index a261cf7d4a4..1c4d6eade78 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/PetApi.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/PetApi.java @@ -72,7 +72,7 @@ public interface PetApi { @RequestMapping(value = "/pet/findByStatus", produces = { "application/xml", "application/json" }, method = RequestMethod.GET) - default CompletableFuture>> 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, @RequestHeader("Accept") String accept) throws IOException { + default CompletableFuture>> 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, @RequestHeader("Accept") String accept) throws IOException { // do some magic! return CompletableFuture.completedFuture(new ResponseEntity>(HttpStatus.OK)); } @@ -90,7 +90,7 @@ public interface PetApi { @RequestMapping(value = "/pet/findByTags", produces = { "application/xml", "application/json" }, method = RequestMethod.GET) - default CompletableFuture>> findPetsByTags( @NotNull @ApiParam(value = "Tags to filter by", required = true) @RequestParam(value = "tags", required = true) List tags, @RequestHeader("Accept") String accept) throws IOException { + default CompletableFuture>> findPetsByTags( @NotNull@ApiParam(value = "Tags to filter by", required = true) @RequestParam(value = "tags", required = true) List tags, @RequestHeader("Accept") String accept) throws IOException { // do some magic! return CompletableFuture.completedFuture(new ResponseEntity>(HttpStatus.OK)); } diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/UserApi.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/UserApi.java index f4d9d3dca8f..21aee4b1686 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/UserApi.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/UserApi.java @@ -94,7 +94,7 @@ public interface UserApi { @RequestMapping(value = "/user/login", produces = { "application/xml", "application/json" }, method = RequestMethod.GET) - default CompletableFuture> loginUser( @NotNull @ApiParam(value = "The user name for login", required = true) @RequestParam(value = "username", required = true) String username, @NotNull @ApiParam(value = "The password for login in clear text", required = true) @RequestParam(value = "password", required = true) String password, @RequestHeader("Accept") String accept) throws IOException { + default CompletableFuture> loginUser( @NotNull@ApiParam(value = "The user name for login", required = true) @RequestParam(value = "username", required = true) String username, @NotNull@ApiParam(value = "The password for login in clear text", required = true) @RequestParam(value = "password", required = true) String password, @RequestHeader("Accept") String accept) throws IOException { // do some magic! return CompletableFuture.completedFuture(new ResponseEntity(HttpStatus.OK)); } diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/AdditionalPropertiesClass.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/AdditionalPropertiesClass.java index f4cfcadae51..80be4236b0d 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/AdditionalPropertiesClass.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/AdditionalPropertiesClass.java @@ -8,7 +8,9 @@ import io.swagger.annotations.ApiModelProperty; import java.util.HashMap; import java.util.List; import java.util.Map; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * AdditionalPropertiesClass */ @@ -38,6 +40,8 @@ public class AdditionalPropertiesClass { * @return mapProperty **/ @ApiModelProperty(value = "") + + @Valid public Map getMapProperty() { return mapProperty; } @@ -64,6 +68,8 @@ public class AdditionalPropertiesClass { * @return mapOfMapProperty **/ @ApiModelProperty(value = "") + + @Valid public Map> getMapOfMapProperty() { return mapOfMapProperty; } diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/Animal.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/Animal.java index a218f0b5542..bc957d1c803 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/Animal.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/Animal.java @@ -7,7 +7,9 @@ import com.fasterxml.jackson.annotation.JsonSubTypes; import com.fasterxml.jackson.annotation.JsonTypeInfo; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * Animal */ @@ -35,6 +37,8 @@ public class Animal { **/ @ApiModelProperty(required = true, value = "") @NotNull + + @Valid public String getClassName() { return className; } @@ -53,6 +57,8 @@ public class Animal { * @return color **/ @ApiModelProperty(value = "") + + @Valid public String getColor() { return color; } diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/AnimalFarm.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/AnimalFarm.java index 33dc04699af..9fa4159f203 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/AnimalFarm.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/AnimalFarm.java @@ -4,7 +4,9 @@ import java.util.Objects; import io.swagger.model.Animal; import java.util.ArrayList; import java.util.List; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * AnimalFarm */ diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/ArrayOfArrayOfNumberOnly.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/ArrayOfArrayOfNumberOnly.java index 8f975d8feda..f9dca7d60b5 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/ArrayOfArrayOfNumberOnly.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/ArrayOfArrayOfNumberOnly.java @@ -8,7 +8,9 @@ import io.swagger.annotations.ApiModelProperty; import java.math.BigDecimal; import java.util.ArrayList; import java.util.List; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * ArrayOfArrayOfNumberOnly */ @@ -35,6 +37,8 @@ public class ArrayOfArrayOfNumberOnly { * @return arrayArrayNumber **/ @ApiModelProperty(value = "") + + @Valid public List> getArrayArrayNumber() { return arrayArrayNumber; } diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/ArrayOfNumberOnly.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/ArrayOfNumberOnly.java index 2c556008554..e9c8a313be0 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/ArrayOfNumberOnly.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/ArrayOfNumberOnly.java @@ -8,7 +8,9 @@ import io.swagger.annotations.ApiModelProperty; import java.math.BigDecimal; import java.util.ArrayList; import java.util.List; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * ArrayOfNumberOnly */ @@ -35,6 +37,8 @@ public class ArrayOfNumberOnly { * @return arrayNumber **/ @ApiModelProperty(value = "") + + @Valid public List getArrayNumber() { return arrayNumber; } diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/ArrayTest.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/ArrayTest.java index 664e319cd35..78c35d3c63a 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/ArrayTest.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/ArrayTest.java @@ -8,7 +8,9 @@ import io.swagger.annotations.ApiModelProperty; import io.swagger.model.ReadOnlyFirst; import java.util.ArrayList; import java.util.List; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * ArrayTest */ @@ -41,6 +43,8 @@ public class ArrayTest { * @return arrayOfString **/ @ApiModelProperty(value = "") + + @Valid public List getArrayOfString() { return arrayOfString; } @@ -67,6 +71,8 @@ public class ArrayTest { * @return arrayArrayOfInteger **/ @ApiModelProperty(value = "") + + @Valid public List> getArrayArrayOfInteger() { return arrayArrayOfInteger; } @@ -93,6 +99,8 @@ public class ArrayTest { * @return arrayArrayOfModel **/ @ApiModelProperty(value = "") + + @Valid public List> getArrayArrayOfModel() { return arrayArrayOfModel; } diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/Capitalization.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/Capitalization.java index d7ad5642ccf..93533c28822 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/Capitalization.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/Capitalization.java @@ -5,7 +5,9 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * Capitalization */ @@ -39,6 +41,8 @@ public class Capitalization { * @return smallCamel **/ @ApiModelProperty(value = "") + + @Valid public String getSmallCamel() { return smallCamel; } @@ -57,6 +61,8 @@ public class Capitalization { * @return capitalCamel **/ @ApiModelProperty(value = "") + + @Valid public String getCapitalCamel() { return capitalCamel; } @@ -75,6 +81,8 @@ public class Capitalization { * @return smallSnake **/ @ApiModelProperty(value = "") + + @Valid public String getSmallSnake() { return smallSnake; } @@ -93,6 +101,8 @@ public class Capitalization { * @return capitalSnake **/ @ApiModelProperty(value = "") + + @Valid public String getCapitalSnake() { return capitalSnake; } @@ -111,6 +121,8 @@ public class Capitalization { * @return scAETHFlowPoints **/ @ApiModelProperty(value = "") + + @Valid public String getScAETHFlowPoints() { return scAETHFlowPoints; } @@ -129,6 +141,8 @@ public class Capitalization { * @return ATT_NAME **/ @ApiModelProperty(value = "Name of the pet ") + + @Valid public String getATTNAME() { return ATT_NAME; } diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/Cat.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/Cat.java index 747e5dc0c7e..edcbc354be6 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/Cat.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/Cat.java @@ -6,7 +6,9 @@ import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import io.swagger.model.Animal; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * Cat */ @@ -25,6 +27,8 @@ public class Cat extends Animal { * @return declawed **/ @ApiModelProperty(value = "") + + @Valid public Boolean getDeclawed() { return declawed; } diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/Category.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/Category.java index 9629da6500e..6dd9cb7a2ad 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/Category.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/Category.java @@ -5,7 +5,9 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * Category */ @@ -27,6 +29,8 @@ public class Category { * @return id **/ @ApiModelProperty(value = "") + + @Valid public Long getId() { return id; } @@ -45,6 +49,8 @@ public class Category { * @return name **/ @ApiModelProperty(value = "") + + @Valid public String getName() { return name; } diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/ClassModel.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/ClassModel.java index d69acffefa8..6a6379f5b60 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/ClassModel.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/ClassModel.java @@ -5,7 +5,9 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * Model for testing model with \"_class\" property */ @@ -25,6 +27,8 @@ public class ClassModel { * @return propertyClass **/ @ApiModelProperty(value = "") + + @Valid public String getPropertyClass() { return propertyClass; } diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/Client.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/Client.java index f9cec5a225e..3b8d16cabf2 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/Client.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/Client.java @@ -5,7 +5,9 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * Client */ @@ -24,6 +26,8 @@ public class Client { * @return client **/ @ApiModelProperty(value = "") + + @Valid public String getClient() { return client; } diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/Dog.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/Dog.java index 9057e840fc3..513131a9fa7 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/Dog.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/Dog.java @@ -6,7 +6,9 @@ import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import io.swagger.model.Animal; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * Dog */ @@ -25,6 +27,8 @@ public class Dog extends Animal { * @return breed **/ @ApiModelProperty(value = "") + + @Valid public String getBreed() { return breed; } diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/EnumArrays.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/EnumArrays.java index f904035e482..bbf4a3036e9 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/EnumArrays.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/EnumArrays.java @@ -8,7 +8,9 @@ import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import java.util.ArrayList; import java.util.List; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * EnumArrays */ @@ -92,6 +94,8 @@ public class EnumArrays { * @return justSymbol **/ @ApiModelProperty(value = "") + + @Valid public JustSymbolEnum getJustSymbol() { return justSymbol; } @@ -118,6 +122,8 @@ public class EnumArrays { * @return arrayEnum **/ @ApiModelProperty(value = "") + + @Valid public List getArrayEnum() { return arrayEnum; } diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/EnumClass.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/EnumClass.java index cdfc0933c3e..4cfbe4b9fcf 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/EnumClass.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/EnumClass.java @@ -2,7 +2,9 @@ package io.swagger.model; import java.util.Objects; import com.fasterxml.jackson.annotation.JsonValue; +import javax.validation.Valid; import javax.validation.constraints.*; + import com.fasterxml.jackson.annotation.JsonCreator; /** diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/EnumTest.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/EnumTest.java index 9f2a0275a6a..c7e4793cdf7 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/EnumTest.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/EnumTest.java @@ -7,7 +7,9 @@ import com.fasterxml.jackson.annotation.JsonValue; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import io.swagger.model.OuterEnum; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * EnumTest */ @@ -130,6 +132,8 @@ public class EnumTest { * @return enumString **/ @ApiModelProperty(value = "") + + @Valid public EnumStringEnum getEnumString() { return enumString; } @@ -148,6 +152,8 @@ public class EnumTest { * @return enumInteger **/ @ApiModelProperty(value = "") + + @Valid public EnumIntegerEnum getEnumInteger() { return enumInteger; } @@ -166,6 +172,8 @@ public class EnumTest { * @return enumNumber **/ @ApiModelProperty(value = "") + + @Valid public EnumNumberEnum getEnumNumber() { return enumNumber; } @@ -184,6 +192,8 @@ public class EnumTest { * @return outerEnum **/ @ApiModelProperty(value = "") + + @Valid public OuterEnum getOuterEnum() { return outerEnum; } diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/FormatTest.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/FormatTest.java index c6d568be7ed..f63a8de2c15 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/FormatTest.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/FormatTest.java @@ -9,7 +9,9 @@ import java.math.BigDecimal; import java.time.LocalDate; import java.time.OffsetDateTime; import java.util.UUID; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * FormatTest */ @@ -66,7 +68,9 @@ public class FormatTest { * @return integer **/ @ApiModelProperty(value = "") - @Min(10) @Max(100) public Integer getInteger() { + @Min(10) @Max(100) + @Valid + public Integer getInteger() { return integer; } @@ -86,7 +90,9 @@ public class FormatTest { * @return int32 **/ @ApiModelProperty(value = "") - @Min(20) @Max(200) public Integer getInt32() { + @Min(20) @Max(200) + @Valid + public Integer getInt32() { return int32; } @@ -104,6 +110,8 @@ public class FormatTest { * @return int64 **/ @ApiModelProperty(value = "") + + @Valid public Long getInt64() { return int64; } @@ -125,7 +133,9 @@ public class FormatTest { **/ @ApiModelProperty(required = true, value = "") @NotNull - @DecimalMin("32.1") @DecimalMax("543.2") public BigDecimal getNumber() { + @DecimalMin("32.1") @DecimalMax("543.2") + @Valid + public BigDecimal getNumber() { return number; } @@ -145,7 +155,9 @@ public class FormatTest { * @return _float **/ @ApiModelProperty(value = "") - @DecimalMin("54.3") @DecimalMax("987.6") public Float getFloat() { + @DecimalMin("54.3") @DecimalMax("987.6") + @Valid + public Float getFloat() { return _float; } @@ -165,7 +177,9 @@ public class FormatTest { * @return _double **/ @ApiModelProperty(value = "") - @DecimalMin("67.8") @DecimalMax("123.4") public Double getDouble() { + @DecimalMin("67.8") @DecimalMax("123.4") + @Valid + public Double getDouble() { return _double; } @@ -183,7 +197,9 @@ public class FormatTest { * @return string **/ @ApiModelProperty(value = "") - @Pattern(regexp="/[a-z]/i") public String getString() { + @Pattern(regexp="/[a-z]/i") + @Valid + public String getString() { return string; } @@ -202,6 +218,8 @@ public class FormatTest { **/ @ApiModelProperty(required = true, value = "") @NotNull + + @Valid public byte[] getByte() { return _byte; } @@ -220,6 +238,8 @@ public class FormatTest { * @return binary **/ @ApiModelProperty(value = "") + + @Valid public byte[] getBinary() { return binary; } @@ -239,6 +259,8 @@ public class FormatTest { **/ @ApiModelProperty(required = true, value = "") @NotNull + + @Valid public LocalDate getDate() { return date; } @@ -257,6 +279,8 @@ public class FormatTest { * @return dateTime **/ @ApiModelProperty(value = "") + + @Valid public OffsetDateTime getDateTime() { return dateTime; } @@ -275,6 +299,8 @@ public class FormatTest { * @return uuid **/ @ApiModelProperty(value = "") + + @Valid public UUID getUuid() { return uuid; } @@ -294,7 +320,9 @@ public class FormatTest { **/ @ApiModelProperty(required = true, value = "") @NotNull - @Size(min=10,max=64) public String getPassword() { + @Size(min=10,max=64) + @Valid + public String getPassword() { return password; } diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/HasOnlyReadOnly.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/HasOnlyReadOnly.java index a26492e4912..0f8b608e261 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/HasOnlyReadOnly.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/HasOnlyReadOnly.java @@ -5,7 +5,9 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * HasOnlyReadOnly */ @@ -27,6 +29,8 @@ public class HasOnlyReadOnly { * @return bar **/ @ApiModelProperty(readOnly = true, value = "") + + @Valid public String getBar() { return bar; } @@ -45,6 +49,8 @@ public class HasOnlyReadOnly { * @return foo **/ @ApiModelProperty(readOnly = true, value = "") + + @Valid public String getFoo() { return foo; } diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/MapTest.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/MapTest.java index 434c3a8f1b5..1530a53f53f 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/MapTest.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/MapTest.java @@ -9,7 +9,9 @@ import io.swagger.annotations.ApiModelProperty; import java.util.HashMap; import java.util.List; import java.util.Map; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * MapTest */ @@ -70,6 +72,8 @@ public class MapTest { * @return mapMapOfString **/ @ApiModelProperty(value = "") + + @Valid public Map> getMapMapOfString() { return mapMapOfString; } @@ -96,6 +100,8 @@ public class MapTest { * @return mapOfEnumString **/ @ApiModelProperty(value = "") + + @Valid public Map getMapOfEnumString() { return mapOfEnumString; } diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/MixedPropertiesAndAdditionalPropertiesClass.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/MixedPropertiesAndAdditionalPropertiesClass.java index 727205e40f9..eafbcb4ecb8 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/MixedPropertiesAndAdditionalPropertiesClass.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/MixedPropertiesAndAdditionalPropertiesClass.java @@ -11,7 +11,9 @@ import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.UUID; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * MixedPropertiesAndAdditionalPropertiesClass */ @@ -36,6 +38,8 @@ public class MixedPropertiesAndAdditionalPropertiesClass { * @return uuid **/ @ApiModelProperty(value = "") + + @Valid public UUID getUuid() { return uuid; } @@ -54,6 +58,8 @@ public class MixedPropertiesAndAdditionalPropertiesClass { * @return dateTime **/ @ApiModelProperty(value = "") + + @Valid public OffsetDateTime getDateTime() { return dateTime; } @@ -80,6 +86,8 @@ public class MixedPropertiesAndAdditionalPropertiesClass { * @return map **/ @ApiModelProperty(value = "") + + @Valid public Map getMap() { return map; } diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/Model200Response.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/Model200Response.java index 4d47f6c03c9..97349fef05c 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/Model200Response.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/Model200Response.java @@ -5,7 +5,9 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * Model for testing model name starting with number */ @@ -28,6 +30,8 @@ public class Model200Response { * @return name **/ @ApiModelProperty(value = "") + + @Valid public Integer getName() { return name; } @@ -46,6 +50,8 @@ public class Model200Response { * @return propertyClass **/ @ApiModelProperty(value = "") + + @Valid public String getPropertyClass() { return propertyClass; } diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/ModelApiResponse.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/ModelApiResponse.java index 36da9b20d9d..c8882b3b1e2 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/ModelApiResponse.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/ModelApiResponse.java @@ -5,7 +5,9 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * ModelApiResponse */ @@ -30,6 +32,8 @@ public class ModelApiResponse { * @return code **/ @ApiModelProperty(value = "") + + @Valid public Integer getCode() { return code; } @@ -48,6 +52,8 @@ public class ModelApiResponse { * @return type **/ @ApiModelProperty(value = "") + + @Valid public String getType() { return type; } @@ -66,6 +72,8 @@ public class ModelApiResponse { * @return message **/ @ApiModelProperty(value = "") + + @Valid public String getMessage() { return message; } diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/ModelReturn.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/ModelReturn.java index 7ffc24a0144..7018d7de09c 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/ModelReturn.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/ModelReturn.java @@ -5,7 +5,9 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * Model for testing reserved words */ @@ -25,6 +27,8 @@ public class ModelReturn { * @return _return **/ @ApiModelProperty(value = "") + + @Valid public Integer getReturn() { return _return; } diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/Name.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/Name.java index 953199166ff..46069fdd14b 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/Name.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/Name.java @@ -5,7 +5,9 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * Model for testing model name same as property name */ @@ -35,6 +37,8 @@ public class Name { **/ @ApiModelProperty(required = true, value = "") @NotNull + + @Valid public Integer getName() { return name; } @@ -53,6 +57,8 @@ public class Name { * @return snakeCase **/ @ApiModelProperty(readOnly = true, value = "") + + @Valid public Integer getSnakeCase() { return snakeCase; } @@ -71,6 +77,8 @@ public class Name { * @return property **/ @ApiModelProperty(value = "") + + @Valid public String getProperty() { return property; } @@ -89,6 +97,8 @@ public class Name { * @return _123Number **/ @ApiModelProperty(readOnly = true, value = "") + + @Valid public Integer get123Number() { return _123Number; } diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/NumberOnly.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/NumberOnly.java index e6dbf3139e2..e243ecb429b 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/NumberOnly.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/NumberOnly.java @@ -6,7 +6,9 @@ import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import java.math.BigDecimal; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * NumberOnly */ @@ -25,6 +27,8 @@ public class NumberOnly { * @return justNumber **/ @ApiModelProperty(value = "") + + @Valid public BigDecimal getJustNumber() { return justNumber; } diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/Order.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/Order.java index d65ed713151..e1a5d94cc8f 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/Order.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/Order.java @@ -7,7 +7,9 @@ import com.fasterxml.jackson.annotation.JsonValue; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import java.time.OffsetDateTime; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * Order */ @@ -74,6 +76,8 @@ public class Order { * @return id **/ @ApiModelProperty(value = "") + + @Valid public Long getId() { return id; } @@ -92,6 +96,8 @@ public class Order { * @return petId **/ @ApiModelProperty(value = "") + + @Valid public Long getPetId() { return petId; } @@ -110,6 +116,8 @@ public class Order { * @return quantity **/ @ApiModelProperty(value = "") + + @Valid public Integer getQuantity() { return quantity; } @@ -128,6 +136,8 @@ public class Order { * @return shipDate **/ @ApiModelProperty(value = "") + + @Valid public OffsetDateTime getShipDate() { return shipDate; } @@ -146,6 +156,8 @@ public class Order { * @return status **/ @ApiModelProperty(value = "Order Status") + + @Valid public StatusEnum getStatus() { return status; } @@ -164,6 +176,8 @@ public class Order { * @return complete **/ @ApiModelProperty(value = "") + + @Valid public Boolean getComplete() { return complete; } diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/OuterEnum.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/OuterEnum.java index 5f0075e4457..f3c6d31fb86 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/OuterEnum.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/OuterEnum.java @@ -2,7 +2,9 @@ package io.swagger.model; import java.util.Objects; import com.fasterxml.jackson.annotation.JsonValue; +import javax.validation.Valid; import javax.validation.constraints.*; + import com.fasterxml.jackson.annotation.JsonCreator; /** diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/Pet.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/Pet.java index b013846b4d6..c84687b699f 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/Pet.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/Pet.java @@ -10,7 +10,9 @@ import io.swagger.model.Category; import io.swagger.model.Tag; import java.util.ArrayList; import java.util.List; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * Pet */ @@ -77,6 +79,8 @@ public class Pet { * @return id **/ @ApiModelProperty(value = "") + + @Valid public Long getId() { return id; } @@ -95,6 +99,8 @@ public class Pet { * @return category **/ @ApiModelProperty(value = "") + + @Valid public Category getCategory() { return category; } @@ -114,6 +120,8 @@ public class Pet { **/ @ApiModelProperty(example = "doggie", required = true, value = "") @NotNull + + @Valid public String getName() { return name; } @@ -138,6 +146,8 @@ public class Pet { **/ @ApiModelProperty(required = true, value = "") @NotNull + + @Valid public List getPhotoUrls() { return photoUrls; } @@ -164,6 +174,8 @@ public class Pet { * @return tags **/ @ApiModelProperty(value = "") + + @Valid public List getTags() { return tags; } @@ -182,6 +194,8 @@ public class Pet { * @return status **/ @ApiModelProperty(value = "pet status in the store") + + @Valid public StatusEnum getStatus() { return status; } diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/ReadOnlyFirst.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/ReadOnlyFirst.java index 47700659fd2..8e79be0008d 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/ReadOnlyFirst.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/ReadOnlyFirst.java @@ -5,7 +5,9 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * ReadOnlyFirst */ @@ -27,6 +29,8 @@ public class ReadOnlyFirst { * @return bar **/ @ApiModelProperty(readOnly = true, value = "") + + @Valid public String getBar() { return bar; } @@ -45,6 +49,8 @@ public class ReadOnlyFirst { * @return baz **/ @ApiModelProperty(value = "") + + @Valid public String getBaz() { return baz; } diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/SpecialModelName.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/SpecialModelName.java index 880d70599b0..3cb7b04353c 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/SpecialModelName.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/SpecialModelName.java @@ -5,7 +5,9 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * SpecialModelName */ @@ -24,6 +26,8 @@ public class SpecialModelName { * @return specialPropertyName **/ @ApiModelProperty(value = "") + + @Valid public Long getSpecialPropertyName() { return specialPropertyName; } diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/Tag.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/Tag.java index 298085317a4..9f8f3a25234 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/Tag.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/Tag.java @@ -5,7 +5,9 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * Tag */ @@ -27,6 +29,8 @@ public class Tag { * @return id **/ @ApiModelProperty(value = "") + + @Valid public Long getId() { return id; } @@ -45,6 +49,8 @@ public class Tag { * @return name **/ @ApiModelProperty(value = "") + + @Valid public String getName() { return name; } diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/User.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/User.java index 8e40f7e0594..501c556de27 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/User.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/User.java @@ -5,7 +5,9 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * User */ @@ -45,6 +47,8 @@ public class User { * @return id **/ @ApiModelProperty(value = "") + + @Valid public Long getId() { return id; } @@ -63,6 +67,8 @@ public class User { * @return username **/ @ApiModelProperty(value = "") + + @Valid public String getUsername() { return username; } @@ -81,6 +87,8 @@ public class User { * @return firstName **/ @ApiModelProperty(value = "") + + @Valid public String getFirstName() { return firstName; } @@ -99,6 +107,8 @@ public class User { * @return lastName **/ @ApiModelProperty(value = "") + + @Valid public String getLastName() { return lastName; } @@ -117,6 +127,8 @@ public class User { * @return email **/ @ApiModelProperty(value = "") + + @Valid public String getEmail() { return email; } @@ -135,6 +147,8 @@ public class User { * @return password **/ @ApiModelProperty(value = "") + + @Valid public String getPassword() { return password; } @@ -153,6 +167,8 @@ public class User { * @return phone **/ @ApiModelProperty(value = "") + + @Valid public String getPhone() { return phone; } @@ -171,6 +187,8 @@ public class User { * @return userStatus **/ @ApiModelProperty(value = "User Status") + + @Valid public Integer getUserStatus() { return userStatus; } diff --git a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/FakeApi.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/FakeApi.java index 890a18bec96..f6093ba101c 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/FakeApi.java +++ b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/FakeApi.java @@ -55,6 +55,6 @@ public interface FakeApi { produces = { "*/*" }, consumes = { "*/*" }, method = RequestMethod.GET) - ResponseEntity testEnumParameters(@ApiParam(value = "Form parameter enum test (string array)", allowableValues=">, $") @RequestPart(value="enum_form_string_array", required=false) List enumFormStringArray,@ApiParam(value = "Form parameter enum test (string)", allowableValues="_abc, -efg, (xyz)", defaultValue="-efg") @RequestPart(value="enum_form_string", required=false) String enumFormString,@ApiParam(value = "Header parameter enum test (string array)" , allowableValues=">, $") @RequestHeader(value="enum_header_string_array", required=false) List enumHeaderStringArray,@ApiParam(value = "Header parameter enum test (string)" , allowableValues="_abc, -efg, (xyz)", defaultValue="-efg") @RequestHeader(value="enum_header_string", required=false) String enumHeaderString, @ApiParam(value = "Query parameter enum test (string array)", allowableValues = ">, $") @RequestParam(value = "enum_query_string_array", required = false) List enumQueryStringArray, @ApiParam(value = "Query parameter enum test (string)", allowableValues = "_abc, -efg, (xyz)", defaultValue = "-efg") @RequestParam(value = "enum_query_string", required = false, defaultValue="-efg") String enumQueryString, @ApiParam(value = "Query parameter enum test (double)", allowableValues = "1, -2") @RequestParam(value = "enum_query_integer", required = false) Integer enumQueryInteger,@ApiParam(value = "Query parameter enum test (double)", allowableValues="1.1, -1.2") @RequestPart(value="enum_query_double", required=false) Double enumQueryDouble, @RequestHeader("Accept") String accept); + ResponseEntity testEnumParameters(@ApiParam(value = "Form parameter enum test (string array)", allowableValues=">, $") @RequestPart(value="enum_form_string_array", required=false) List enumFormStringArray,@ApiParam(value = "Form parameter enum test (string)", allowableValues="_abc, -efg, (xyz)", defaultValue="-efg") @RequestPart(value="enum_form_string", required=false) String enumFormString,@ApiParam(value = "Header parameter enum test (string array)" , allowableValues=">, $") @RequestHeader(value="enum_header_string_array", required=false) List enumHeaderStringArray,@ApiParam(value = "Header parameter enum test (string)" , allowableValues="_abc, -efg, (xyz)", defaultValue="-efg") @RequestHeader(value="enum_header_string", required=false) String enumHeaderString,@ApiParam(value = "Query parameter enum test (string array)", allowableValues = ">, $") @RequestParam(value = "enum_query_string_array", required = false) List enumQueryStringArray,@ApiParam(value = "Query parameter enum test (string)", allowableValues = "_abc, -efg, (xyz)", defaultValue = "-efg") @RequestParam(value = "enum_query_string", required = false, defaultValue="-efg") String enumQueryString,@ApiParam(value = "Query parameter enum test (double)", allowableValues = "1, -2") @RequestParam(value = "enum_query_integer", required = false) Integer enumQueryInteger,@ApiParam(value = "Query parameter enum test (double)", allowableValues="1.1, -1.2") @RequestPart(value="enum_query_double", required=false) Double enumQueryDouble, @RequestHeader("Accept") String accept); } diff --git a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/FakeApiController.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/FakeApiController.java index 63f3e243be6..dc01cc55727 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/FakeApiController.java +++ b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/FakeApiController.java @@ -62,9 +62,9 @@ public class FakeApiController implements FakeApi { @ApiParam(value = "Form parameter enum test (string)", allowableValues="_abc, -efg, (xyz)", defaultValue="-efg") @RequestPart(value="enum_form_string", required=false) String enumFormString, @ApiParam(value = "Header parameter enum test (string array)" , allowableValues=">, $") @RequestHeader(value="enum_header_string_array", required=false) List enumHeaderStringArray, @ApiParam(value = "Header parameter enum test (string)" , allowableValues="_abc, -efg, (xyz)", defaultValue="-efg") @RequestHeader(value="enum_header_string", required=false) String enumHeaderString, - @ApiParam(value = "Query parameter enum test (string array)", allowableValues = ">, $") @RequestParam(value = "enum_query_string_array", required = false) List enumQueryStringArray, - @ApiParam(value = "Query parameter enum test (string)", allowableValues = "_abc, -efg, (xyz)", defaultValue = "-efg") @RequestParam(value = "enum_query_string", required = false, defaultValue="-efg") String enumQueryString, - @ApiParam(value = "Query parameter enum test (double)", allowableValues = "1, -2") @RequestParam(value = "enum_query_integer", required = false) Integer enumQueryInteger, + @ApiParam(value = "Query parameter enum test (string array)", allowableValues = ">, $") @RequestParam(value = "enum_query_string_array", required = false) List enumQueryStringArray, + @ApiParam(value = "Query parameter enum test (string)", allowableValues = "_abc, -efg, (xyz)", defaultValue = "-efg") @RequestParam(value = "enum_query_string", required = false, defaultValue="-efg") String enumQueryString, + @ApiParam(value = "Query parameter enum test (double)", allowableValues = "1, -2") @RequestParam(value = "enum_query_integer", required = false) Integer enumQueryInteger, @ApiParam(value = "Query parameter enum test (double)", allowableValues="1.1, -1.2") @RequestPart(value="enum_query_double", required=false) Double enumQueryDouble, @RequestHeader("Accept") String accept) { // do some magic! 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 5816fb5b92e..1227aedbbd7 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 @@ -64,7 +64,7 @@ public interface PetApi { @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, @RequestHeader("Accept") String accept) throws IOException; + 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, @RequestHeader("Accept") String accept) throws IOException; @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 = { @@ -79,7 +79,7 @@ public interface PetApi { @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, @RequestHeader("Accept") String accept) throws IOException; + ResponseEntity> findPetsByTags( @NotNull@ApiParam(value = "Tags to filter by", required = true) @RequestParam(value = "tags", required = true) List tags, @RequestHeader("Accept") String accept) throws IOException; @ApiOperation(value = "Find pet by ID", notes = "Returns a single pet", response = Pet.class, authorizations = { diff --git a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/PetApiController.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/PetApiController.java index 220aa32691d..7fc193be9c5 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/PetApiController.java +++ b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/PetApiController.java @@ -38,7 +38,7 @@ public class PetApiController implements PetApi { 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, + 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, @RequestHeader("Accept") String accept) throws IOException { // do some magic! @@ -55,7 +55,7 @@ public class PetApiController implements PetApi { return new ResponseEntity>(HttpStatus.OK); } - public ResponseEntity> findPetsByTags( @NotNull @ApiParam(value = "Tags to filter by", required = true) @RequestParam(value = "tags", required = true) List tags, + public ResponseEntity> findPetsByTags( @NotNull@ApiParam(value = "Tags to filter by", required = true) @RequestParam(value = "tags", required = true) List tags, @RequestHeader("Accept") String accept) throws IOException { // do some magic! 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 53899d1eddd..adc0d21d30b 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 @@ -77,7 +77,7 @@ public interface UserApi { @RequestMapping(value = "/user/login", produces = { "application/xml", "application/json" }, method = RequestMethod.GET) - ResponseEntity loginUser( @NotNull @ApiParam(value = "The user name for login", required = true) @RequestParam(value = "username", required = true) String username, @NotNull @ApiParam(value = "The password for login in clear text", required = true) @RequestParam(value = "password", required = true) String password, @RequestHeader("Accept") String accept) throws IOException; + ResponseEntity loginUser( @NotNull@ApiParam(value = "The user name for login", required = true) @RequestParam(value = "username", required = true) String username, @NotNull@ApiParam(value = "The password for login in clear text", required = true) @RequestParam(value = "password", required = true) String password, @RequestHeader("Accept") String accept) throws IOException; @ApiOperation(value = "Logs out current logged in user session", notes = "", response = Void.class, tags={ "user", }) diff --git a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/UserApiController.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/UserApiController.java index d8cac8d5eb8..8188aeaeb8d 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/UserApiController.java +++ b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/UserApiController.java @@ -65,8 +65,8 @@ public class UserApiController implements UserApi { return new ResponseEntity(HttpStatus.OK); } - public ResponseEntity loginUser( @NotNull @ApiParam(value = "The user name for login", required = true) @RequestParam(value = "username", required = true) String username, - @NotNull @ApiParam(value = "The password for login in clear text", required = true) @RequestParam(value = "password", required = true) String password, + public ResponseEntity loginUser( @NotNull@ApiParam(value = "The user name for login", required = true) @RequestParam(value = "username", required = true) String username, + @NotNull@ApiParam(value = "The password for login in clear text", required = true) @RequestParam(value = "password", required = true) String password, @RequestHeader("Accept") String accept) throws IOException { // do some magic! diff --git a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/AdditionalPropertiesClass.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/AdditionalPropertiesClass.java index f4cfcadae51..80be4236b0d 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/AdditionalPropertiesClass.java +++ b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/AdditionalPropertiesClass.java @@ -8,7 +8,9 @@ import io.swagger.annotations.ApiModelProperty; import java.util.HashMap; import java.util.List; import java.util.Map; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * AdditionalPropertiesClass */ @@ -38,6 +40,8 @@ public class AdditionalPropertiesClass { * @return mapProperty **/ @ApiModelProperty(value = "") + + @Valid public Map getMapProperty() { return mapProperty; } @@ -64,6 +68,8 @@ public class AdditionalPropertiesClass { * @return mapOfMapProperty **/ @ApiModelProperty(value = "") + + @Valid public Map> getMapOfMapProperty() { return mapOfMapProperty; } 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 index a218f0b5542..bc957d1c803 100644 --- 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 @@ -7,7 +7,9 @@ import com.fasterxml.jackson.annotation.JsonSubTypes; import com.fasterxml.jackson.annotation.JsonTypeInfo; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * Animal */ @@ -35,6 +37,8 @@ public class Animal { **/ @ApiModelProperty(required = true, value = "") @NotNull + + @Valid public String getClassName() { return className; } @@ -53,6 +57,8 @@ public class Animal { * @return color **/ @ApiModelProperty(value = "") + + @Valid public String getColor() { return color; } diff --git a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/AnimalFarm.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/AnimalFarm.java index 33dc04699af..9fa4159f203 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/AnimalFarm.java +++ b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/AnimalFarm.java @@ -4,7 +4,9 @@ import java.util.Objects; import io.swagger.model.Animal; import java.util.ArrayList; import java.util.List; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * AnimalFarm */ diff --git a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/ArrayOfArrayOfNumberOnly.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/ArrayOfArrayOfNumberOnly.java index 8f975d8feda..f9dca7d60b5 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/ArrayOfArrayOfNumberOnly.java +++ b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/ArrayOfArrayOfNumberOnly.java @@ -8,7 +8,9 @@ import io.swagger.annotations.ApiModelProperty; import java.math.BigDecimal; import java.util.ArrayList; import java.util.List; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * ArrayOfArrayOfNumberOnly */ @@ -35,6 +37,8 @@ public class ArrayOfArrayOfNumberOnly { * @return arrayArrayNumber **/ @ApiModelProperty(value = "") + + @Valid public List> getArrayArrayNumber() { return arrayArrayNumber; } diff --git a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/ArrayOfNumberOnly.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/ArrayOfNumberOnly.java index 2c556008554..e9c8a313be0 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/ArrayOfNumberOnly.java +++ b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/ArrayOfNumberOnly.java @@ -8,7 +8,9 @@ import io.swagger.annotations.ApiModelProperty; import java.math.BigDecimal; import java.util.ArrayList; import java.util.List; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * ArrayOfNumberOnly */ @@ -35,6 +37,8 @@ public class ArrayOfNumberOnly { * @return arrayNumber **/ @ApiModelProperty(value = "") + + @Valid public List getArrayNumber() { return arrayNumber; } diff --git a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/ArrayTest.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/ArrayTest.java index 664e319cd35..78c35d3c63a 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/ArrayTest.java +++ b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/ArrayTest.java @@ -8,7 +8,9 @@ import io.swagger.annotations.ApiModelProperty; import io.swagger.model.ReadOnlyFirst; import java.util.ArrayList; import java.util.List; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * ArrayTest */ @@ -41,6 +43,8 @@ public class ArrayTest { * @return arrayOfString **/ @ApiModelProperty(value = "") + + @Valid public List getArrayOfString() { return arrayOfString; } @@ -67,6 +71,8 @@ public class ArrayTest { * @return arrayArrayOfInteger **/ @ApiModelProperty(value = "") + + @Valid public List> getArrayArrayOfInteger() { return arrayArrayOfInteger; } @@ -93,6 +99,8 @@ public class ArrayTest { * @return arrayArrayOfModel **/ @ApiModelProperty(value = "") + + @Valid public List> getArrayArrayOfModel() { return arrayArrayOfModel; } diff --git a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/Capitalization.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/Capitalization.java index d7ad5642ccf..93533c28822 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/Capitalization.java +++ b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/Capitalization.java @@ -5,7 +5,9 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * Capitalization */ @@ -39,6 +41,8 @@ public class Capitalization { * @return smallCamel **/ @ApiModelProperty(value = "") + + @Valid public String getSmallCamel() { return smallCamel; } @@ -57,6 +61,8 @@ public class Capitalization { * @return capitalCamel **/ @ApiModelProperty(value = "") + + @Valid public String getCapitalCamel() { return capitalCamel; } @@ -75,6 +81,8 @@ public class Capitalization { * @return smallSnake **/ @ApiModelProperty(value = "") + + @Valid public String getSmallSnake() { return smallSnake; } @@ -93,6 +101,8 @@ public class Capitalization { * @return capitalSnake **/ @ApiModelProperty(value = "") + + @Valid public String getCapitalSnake() { return capitalSnake; } @@ -111,6 +121,8 @@ public class Capitalization { * @return scAETHFlowPoints **/ @ApiModelProperty(value = "") + + @Valid public String getScAETHFlowPoints() { return scAETHFlowPoints; } @@ -129,6 +141,8 @@ public class Capitalization { * @return ATT_NAME **/ @ApiModelProperty(value = "Name of the pet ") + + @Valid public String getATTNAME() { return ATT_NAME; } 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 index 747e5dc0c7e..edcbc354be6 100644 --- 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 @@ -6,7 +6,9 @@ import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import io.swagger.model.Animal; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * Cat */ @@ -25,6 +27,8 @@ public class Cat extends Animal { * @return declawed **/ @ApiModelProperty(value = "") + + @Valid public Boolean getDeclawed() { return declawed; } 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 9629da6500e..6dd9cb7a2ad 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 @@ -5,7 +5,9 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * Category */ @@ -27,6 +29,8 @@ public class Category { * @return id **/ @ApiModelProperty(value = "") + + @Valid public Long getId() { return id; } @@ -45,6 +49,8 @@ public class Category { * @return name **/ @ApiModelProperty(value = "") + + @Valid public String getName() { return name; } diff --git a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/ClassModel.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/ClassModel.java index d69acffefa8..6a6379f5b60 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/ClassModel.java +++ b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/ClassModel.java @@ -5,7 +5,9 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * Model for testing model with \"_class\" property */ @@ -25,6 +27,8 @@ public class ClassModel { * @return propertyClass **/ @ApiModelProperty(value = "") + + @Valid public String getPropertyClass() { return propertyClass; } diff --git a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/Client.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/Client.java index f9cec5a225e..3b8d16cabf2 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/Client.java +++ b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/Client.java @@ -5,7 +5,9 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * Client */ @@ -24,6 +26,8 @@ public class Client { * @return client **/ @ApiModelProperty(value = "") + + @Valid public String getClient() { return client; } 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 index 9057e840fc3..513131a9fa7 100644 --- 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 @@ -6,7 +6,9 @@ import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import io.swagger.model.Animal; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * Dog */ @@ -25,6 +27,8 @@ public class Dog extends Animal { * @return breed **/ @ApiModelProperty(value = "") + + @Valid public String getBreed() { return breed; } diff --git a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/EnumArrays.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/EnumArrays.java index f904035e482..bbf4a3036e9 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/EnumArrays.java +++ b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/EnumArrays.java @@ -8,7 +8,9 @@ import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import java.util.ArrayList; import java.util.List; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * EnumArrays */ @@ -92,6 +94,8 @@ public class EnumArrays { * @return justSymbol **/ @ApiModelProperty(value = "") + + @Valid public JustSymbolEnum getJustSymbol() { return justSymbol; } @@ -118,6 +122,8 @@ public class EnumArrays { * @return arrayEnum **/ @ApiModelProperty(value = "") + + @Valid public List getArrayEnum() { return arrayEnum; } diff --git a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/EnumClass.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/EnumClass.java index cdfc0933c3e..4cfbe4b9fcf 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/EnumClass.java +++ b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/EnumClass.java @@ -2,7 +2,9 @@ package io.swagger.model; import java.util.Objects; import com.fasterxml.jackson.annotation.JsonValue; +import javax.validation.Valid; import javax.validation.constraints.*; + import com.fasterxml.jackson.annotation.JsonCreator; /** diff --git a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/EnumTest.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/EnumTest.java index 9f2a0275a6a..c7e4793cdf7 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/EnumTest.java +++ b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/EnumTest.java @@ -7,7 +7,9 @@ import com.fasterxml.jackson.annotation.JsonValue; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import io.swagger.model.OuterEnum; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * EnumTest */ @@ -130,6 +132,8 @@ public class EnumTest { * @return enumString **/ @ApiModelProperty(value = "") + + @Valid public EnumStringEnum getEnumString() { return enumString; } @@ -148,6 +152,8 @@ public class EnumTest { * @return enumInteger **/ @ApiModelProperty(value = "") + + @Valid public EnumIntegerEnum getEnumInteger() { return enumInteger; } @@ -166,6 +172,8 @@ public class EnumTest { * @return enumNumber **/ @ApiModelProperty(value = "") + + @Valid public EnumNumberEnum getEnumNumber() { return enumNumber; } @@ -184,6 +192,8 @@ public class EnumTest { * @return outerEnum **/ @ApiModelProperty(value = "") + + @Valid public OuterEnum getOuterEnum() { return outerEnum; } 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 index 0f144806e9e..2aaa5179f61 100644 --- 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 @@ -9,7 +9,9 @@ import java.math.BigDecimal; import java.util.UUID; import org.threeten.bp.LocalDate; import org.threeten.bp.OffsetDateTime; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * FormatTest */ @@ -66,7 +68,9 @@ public class FormatTest { * @return integer **/ @ApiModelProperty(value = "") - @Min(10) @Max(100) public Integer getInteger() { + @Min(10) @Max(100) + @Valid + public Integer getInteger() { return integer; } @@ -86,7 +90,9 @@ public class FormatTest { * @return int32 **/ @ApiModelProperty(value = "") - @Min(20) @Max(200) public Integer getInt32() { + @Min(20) @Max(200) + @Valid + public Integer getInt32() { return int32; } @@ -104,6 +110,8 @@ public class FormatTest { * @return int64 **/ @ApiModelProperty(value = "") + + @Valid public Long getInt64() { return int64; } @@ -125,7 +133,9 @@ public class FormatTest { **/ @ApiModelProperty(required = true, value = "") @NotNull - @DecimalMin("32.1") @DecimalMax("543.2") public BigDecimal getNumber() { + @DecimalMin("32.1") @DecimalMax("543.2") + @Valid + public BigDecimal getNumber() { return number; } @@ -145,7 +155,9 @@ public class FormatTest { * @return _float **/ @ApiModelProperty(value = "") - @DecimalMin("54.3") @DecimalMax("987.6") public Float getFloat() { + @DecimalMin("54.3") @DecimalMax("987.6") + @Valid + public Float getFloat() { return _float; } @@ -165,7 +177,9 @@ public class FormatTest { * @return _double **/ @ApiModelProperty(value = "") - @DecimalMin("67.8") @DecimalMax("123.4") public Double getDouble() { + @DecimalMin("67.8") @DecimalMax("123.4") + @Valid + public Double getDouble() { return _double; } @@ -183,7 +197,9 @@ public class FormatTest { * @return string **/ @ApiModelProperty(value = "") - @Pattern(regexp="/[a-z]/i") public String getString() { + @Pattern(regexp="/[a-z]/i") + @Valid + public String getString() { return string; } @@ -202,6 +218,8 @@ public class FormatTest { **/ @ApiModelProperty(required = true, value = "") @NotNull + + @Valid public byte[] getByte() { return _byte; } @@ -220,6 +238,8 @@ public class FormatTest { * @return binary **/ @ApiModelProperty(value = "") + + @Valid public byte[] getBinary() { return binary; } @@ -239,6 +259,8 @@ public class FormatTest { **/ @ApiModelProperty(required = true, value = "") @NotNull + + @Valid public LocalDate getDate() { return date; } @@ -257,6 +279,8 @@ public class FormatTest { * @return dateTime **/ @ApiModelProperty(value = "") + + @Valid public OffsetDateTime getDateTime() { return dateTime; } @@ -275,6 +299,8 @@ public class FormatTest { * @return uuid **/ @ApiModelProperty(value = "") + + @Valid public UUID getUuid() { return uuid; } @@ -294,7 +320,9 @@ public class FormatTest { **/ @ApiModelProperty(required = true, value = "") @NotNull - @Size(min=10,max=64) public String getPassword() { + @Size(min=10,max=64) + @Valid + public String getPassword() { return password; } diff --git a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/HasOnlyReadOnly.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/HasOnlyReadOnly.java index a26492e4912..0f8b608e261 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/HasOnlyReadOnly.java +++ b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/HasOnlyReadOnly.java @@ -5,7 +5,9 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * HasOnlyReadOnly */ @@ -27,6 +29,8 @@ public class HasOnlyReadOnly { * @return bar **/ @ApiModelProperty(readOnly = true, value = "") + + @Valid public String getBar() { return bar; } @@ -45,6 +49,8 @@ public class HasOnlyReadOnly { * @return foo **/ @ApiModelProperty(readOnly = true, value = "") + + @Valid public String getFoo() { return foo; } diff --git a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/MapTest.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/MapTest.java index 434c3a8f1b5..1530a53f53f 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/MapTest.java +++ b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/MapTest.java @@ -9,7 +9,9 @@ import io.swagger.annotations.ApiModelProperty; import java.util.HashMap; import java.util.List; import java.util.Map; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * MapTest */ @@ -70,6 +72,8 @@ public class MapTest { * @return mapMapOfString **/ @ApiModelProperty(value = "") + + @Valid public Map> getMapMapOfString() { return mapMapOfString; } @@ -96,6 +100,8 @@ public class MapTest { * @return mapOfEnumString **/ @ApiModelProperty(value = "") + + @Valid public Map getMapOfEnumString() { return mapOfEnumString; } diff --git a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/MixedPropertiesAndAdditionalPropertiesClass.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/MixedPropertiesAndAdditionalPropertiesClass.java index d9f452920f9..21cb67378eb 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/MixedPropertiesAndAdditionalPropertiesClass.java +++ b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/MixedPropertiesAndAdditionalPropertiesClass.java @@ -11,7 +11,9 @@ import java.util.List; import java.util.Map; import java.util.UUID; import org.threeten.bp.OffsetDateTime; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * MixedPropertiesAndAdditionalPropertiesClass */ @@ -36,6 +38,8 @@ public class MixedPropertiesAndAdditionalPropertiesClass { * @return uuid **/ @ApiModelProperty(value = "") + + @Valid public UUID getUuid() { return uuid; } @@ -54,6 +58,8 @@ public class MixedPropertiesAndAdditionalPropertiesClass { * @return dateTime **/ @ApiModelProperty(value = "") + + @Valid public OffsetDateTime getDateTime() { return dateTime; } @@ -80,6 +86,8 @@ public class MixedPropertiesAndAdditionalPropertiesClass { * @return map **/ @ApiModelProperty(value = "") + + @Valid public Map getMap() { return map; } 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 index 4d47f6c03c9..97349fef05c 100644 --- 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 @@ -5,7 +5,9 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * Model for testing model name starting with number */ @@ -28,6 +30,8 @@ public class Model200Response { * @return name **/ @ApiModelProperty(value = "") + + @Valid public Integer getName() { return name; } @@ -46,6 +50,8 @@ public class Model200Response { * @return propertyClass **/ @ApiModelProperty(value = "") + + @Valid public String getPropertyClass() { return propertyClass; } diff --git a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/ModelApiResponse.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/ModelApiResponse.java index 36da9b20d9d..c8882b3b1e2 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/ModelApiResponse.java +++ b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/ModelApiResponse.java @@ -5,7 +5,9 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * ModelApiResponse */ @@ -30,6 +32,8 @@ public class ModelApiResponse { * @return code **/ @ApiModelProperty(value = "") + + @Valid public Integer getCode() { return code; } @@ -48,6 +52,8 @@ public class ModelApiResponse { * @return type **/ @ApiModelProperty(value = "") + + @Valid public String getType() { return type; } @@ -66,6 +72,8 @@ public class ModelApiResponse { * @return message **/ @ApiModelProperty(value = "") + + @Valid public String getMessage() { return message; } 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 index 7ffc24a0144..7018d7de09c 100644 --- 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 @@ -5,7 +5,9 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * Model for testing reserved words */ @@ -25,6 +27,8 @@ public class ModelReturn { * @return _return **/ @ApiModelProperty(value = "") + + @Valid public Integer getReturn() { return _return; } 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 index 953199166ff..46069fdd14b 100644 --- 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 @@ -5,7 +5,9 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * Model for testing model name same as property name */ @@ -35,6 +37,8 @@ public class Name { **/ @ApiModelProperty(required = true, value = "") @NotNull + + @Valid public Integer getName() { return name; } @@ -53,6 +57,8 @@ public class Name { * @return snakeCase **/ @ApiModelProperty(readOnly = true, value = "") + + @Valid public Integer getSnakeCase() { return snakeCase; } @@ -71,6 +77,8 @@ public class Name { * @return property **/ @ApiModelProperty(value = "") + + @Valid public String getProperty() { return property; } @@ -89,6 +97,8 @@ public class Name { * @return _123Number **/ @ApiModelProperty(readOnly = true, value = "") + + @Valid public Integer get123Number() { return _123Number; } diff --git a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/NumberOnly.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/NumberOnly.java index e6dbf3139e2..e243ecb429b 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/NumberOnly.java +++ b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/NumberOnly.java @@ -6,7 +6,9 @@ import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import java.math.BigDecimal; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * NumberOnly */ @@ -25,6 +27,8 @@ public class NumberOnly { * @return justNumber **/ @ApiModelProperty(value = "") + + @Valid public BigDecimal getJustNumber() { return justNumber; } 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 c5381d2fa7e..3ba7e5a0a85 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 @@ -7,7 +7,9 @@ import com.fasterxml.jackson.annotation.JsonValue; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import org.threeten.bp.OffsetDateTime; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * Order */ @@ -74,6 +76,8 @@ public class Order { * @return id **/ @ApiModelProperty(value = "") + + @Valid public Long getId() { return id; } @@ -92,6 +96,8 @@ public class Order { * @return petId **/ @ApiModelProperty(value = "") + + @Valid public Long getPetId() { return petId; } @@ -110,6 +116,8 @@ public class Order { * @return quantity **/ @ApiModelProperty(value = "") + + @Valid public Integer getQuantity() { return quantity; } @@ -128,6 +136,8 @@ public class Order { * @return shipDate **/ @ApiModelProperty(value = "") + + @Valid public OffsetDateTime getShipDate() { return shipDate; } @@ -146,6 +156,8 @@ public class Order { * @return status **/ @ApiModelProperty(value = "Order Status") + + @Valid public StatusEnum getStatus() { return status; } @@ -164,6 +176,8 @@ public class Order { * @return complete **/ @ApiModelProperty(value = "") + + @Valid public Boolean getComplete() { return complete; } diff --git a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/OuterEnum.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/OuterEnum.java index 5f0075e4457..f3c6d31fb86 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/OuterEnum.java +++ b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/OuterEnum.java @@ -2,7 +2,9 @@ package io.swagger.model; import java.util.Objects; import com.fasterxml.jackson.annotation.JsonValue; +import javax.validation.Valid; import javax.validation.constraints.*; + import com.fasterxml.jackson.annotation.JsonCreator; /** 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 b013846b4d6..c84687b699f 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 @@ -10,7 +10,9 @@ import io.swagger.model.Category; import io.swagger.model.Tag; import java.util.ArrayList; import java.util.List; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * Pet */ @@ -77,6 +79,8 @@ public class Pet { * @return id **/ @ApiModelProperty(value = "") + + @Valid public Long getId() { return id; } @@ -95,6 +99,8 @@ public class Pet { * @return category **/ @ApiModelProperty(value = "") + + @Valid public Category getCategory() { return category; } @@ -114,6 +120,8 @@ public class Pet { **/ @ApiModelProperty(example = "doggie", required = true, value = "") @NotNull + + @Valid public String getName() { return name; } @@ -138,6 +146,8 @@ public class Pet { **/ @ApiModelProperty(required = true, value = "") @NotNull + + @Valid public List getPhotoUrls() { return photoUrls; } @@ -164,6 +174,8 @@ public class Pet { * @return tags **/ @ApiModelProperty(value = "") + + @Valid public List getTags() { return tags; } @@ -182,6 +194,8 @@ public class Pet { * @return status **/ @ApiModelProperty(value = "pet status in the store") + + @Valid public StatusEnum getStatus() { return status; } diff --git a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/ReadOnlyFirst.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/ReadOnlyFirst.java index 47700659fd2..8e79be0008d 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/ReadOnlyFirst.java +++ b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/ReadOnlyFirst.java @@ -5,7 +5,9 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * ReadOnlyFirst */ @@ -27,6 +29,8 @@ public class ReadOnlyFirst { * @return bar **/ @ApiModelProperty(readOnly = true, value = "") + + @Valid public String getBar() { return bar; } @@ -45,6 +49,8 @@ public class ReadOnlyFirst { * @return baz **/ @ApiModelProperty(value = "") + + @Valid public String getBaz() { return baz; } 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 index 880d70599b0..3cb7b04353c 100644 --- 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 @@ -5,7 +5,9 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * SpecialModelName */ @@ -24,6 +26,8 @@ public class SpecialModelName { * @return specialPropertyName **/ @ApiModelProperty(value = "") + + @Valid public Long getSpecialPropertyName() { return specialPropertyName; } 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 298085317a4..9f8f3a25234 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 @@ -5,7 +5,9 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * Tag */ @@ -27,6 +29,8 @@ public class Tag { * @return id **/ @ApiModelProperty(value = "") + + @Valid public Long getId() { return id; } @@ -45,6 +49,8 @@ public class Tag { * @return name **/ @ApiModelProperty(value = "") + + @Valid public String getName() { return name; } 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 8e40f7e0594..501c556de27 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 @@ -5,7 +5,9 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * User */ @@ -45,6 +47,8 @@ public class User { * @return id **/ @ApiModelProperty(value = "") + + @Valid public Long getId() { return id; } @@ -63,6 +67,8 @@ public class User { * @return username **/ @ApiModelProperty(value = "") + + @Valid public String getUsername() { return username; } @@ -81,6 +87,8 @@ public class User { * @return firstName **/ @ApiModelProperty(value = "") + + @Valid public String getFirstName() { return firstName; } @@ -99,6 +107,8 @@ public class User { * @return lastName **/ @ApiModelProperty(value = "") + + @Valid public String getLastName() { return lastName; } @@ -117,6 +127,8 @@ public class User { * @return email **/ @ApiModelProperty(value = "") + + @Valid public String getEmail() { return email; } @@ -135,6 +147,8 @@ public class User { * @return password **/ @ApiModelProperty(value = "") + + @Valid public String getPassword() { return password; } @@ -153,6 +167,8 @@ public class User { * @return phone **/ @ApiModelProperty(value = "") + + @Valid public String getPhone() { return phone; } @@ -171,6 +187,8 @@ public class User { * @return userStatus **/ @ApiModelProperty(value = "User Status") + + @Valid public Integer getUserStatus() { return userStatus; } 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 index 890a18bec96..f6093ba101c 100644 --- 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 @@ -55,6 +55,6 @@ public interface FakeApi { produces = { "*/*" }, consumes = { "*/*" }, method = RequestMethod.GET) - ResponseEntity testEnumParameters(@ApiParam(value = "Form parameter enum test (string array)", allowableValues=">, $") @RequestPart(value="enum_form_string_array", required=false) List enumFormStringArray,@ApiParam(value = "Form parameter enum test (string)", allowableValues="_abc, -efg, (xyz)", defaultValue="-efg") @RequestPart(value="enum_form_string", required=false) String enumFormString,@ApiParam(value = "Header parameter enum test (string array)" , allowableValues=">, $") @RequestHeader(value="enum_header_string_array", required=false) List enumHeaderStringArray,@ApiParam(value = "Header parameter enum test (string)" , allowableValues="_abc, -efg, (xyz)", defaultValue="-efg") @RequestHeader(value="enum_header_string", required=false) String enumHeaderString, @ApiParam(value = "Query parameter enum test (string array)", allowableValues = ">, $") @RequestParam(value = "enum_query_string_array", required = false) List enumQueryStringArray, @ApiParam(value = "Query parameter enum test (string)", allowableValues = "_abc, -efg, (xyz)", defaultValue = "-efg") @RequestParam(value = "enum_query_string", required = false, defaultValue="-efg") String enumQueryString, @ApiParam(value = "Query parameter enum test (double)", allowableValues = "1, -2") @RequestParam(value = "enum_query_integer", required = false) Integer enumQueryInteger,@ApiParam(value = "Query parameter enum test (double)", allowableValues="1.1, -1.2") @RequestPart(value="enum_query_double", required=false) Double enumQueryDouble, @RequestHeader("Accept") String accept); + ResponseEntity testEnumParameters(@ApiParam(value = "Form parameter enum test (string array)", allowableValues=">, $") @RequestPart(value="enum_form_string_array", required=false) List enumFormStringArray,@ApiParam(value = "Form parameter enum test (string)", allowableValues="_abc, -efg, (xyz)", defaultValue="-efg") @RequestPart(value="enum_form_string", required=false) String enumFormString,@ApiParam(value = "Header parameter enum test (string array)" , allowableValues=">, $") @RequestHeader(value="enum_header_string_array", required=false) List enumHeaderStringArray,@ApiParam(value = "Header parameter enum test (string)" , allowableValues="_abc, -efg, (xyz)", defaultValue="-efg") @RequestHeader(value="enum_header_string", required=false) String enumHeaderString,@ApiParam(value = "Query parameter enum test (string array)", allowableValues = ">, $") @RequestParam(value = "enum_query_string_array", required = false) List enumQueryStringArray,@ApiParam(value = "Query parameter enum test (string)", allowableValues = "_abc, -efg, (xyz)", defaultValue = "-efg") @RequestParam(value = "enum_query_string", required = false, defaultValue="-efg") String enumQueryString,@ApiParam(value = "Query parameter enum test (double)", allowableValues = "1, -2") @RequestParam(value = "enum_query_integer", required = false) Integer enumQueryInteger,@ApiParam(value = "Query parameter enum test (double)", allowableValues="1.1, -1.2") @RequestPart(value="enum_query_double", required=false) Double enumQueryDouble, @RequestHeader("Accept") String accept); } 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 index 63f3e243be6..dc01cc55727 100644 --- 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 @@ -62,9 +62,9 @@ public class FakeApiController implements FakeApi { @ApiParam(value = "Form parameter enum test (string)", allowableValues="_abc, -efg, (xyz)", defaultValue="-efg") @RequestPart(value="enum_form_string", required=false) String enumFormString, @ApiParam(value = "Header parameter enum test (string array)" , allowableValues=">, $") @RequestHeader(value="enum_header_string_array", required=false) List enumHeaderStringArray, @ApiParam(value = "Header parameter enum test (string)" , allowableValues="_abc, -efg, (xyz)", defaultValue="-efg") @RequestHeader(value="enum_header_string", required=false) String enumHeaderString, - @ApiParam(value = "Query parameter enum test (string array)", allowableValues = ">, $") @RequestParam(value = "enum_query_string_array", required = false) List enumQueryStringArray, - @ApiParam(value = "Query parameter enum test (string)", allowableValues = "_abc, -efg, (xyz)", defaultValue = "-efg") @RequestParam(value = "enum_query_string", required = false, defaultValue="-efg") String enumQueryString, - @ApiParam(value = "Query parameter enum test (double)", allowableValues = "1, -2") @RequestParam(value = "enum_query_integer", required = false) Integer enumQueryInteger, + @ApiParam(value = "Query parameter enum test (string array)", allowableValues = ">, $") @RequestParam(value = "enum_query_string_array", required = false) List enumQueryStringArray, + @ApiParam(value = "Query parameter enum test (string)", allowableValues = "_abc, -efg, (xyz)", defaultValue = "-efg") @RequestParam(value = "enum_query_string", required = false, defaultValue="-efg") String enumQueryString, + @ApiParam(value = "Query parameter enum test (double)", allowableValues = "1, -2") @RequestParam(value = "enum_query_integer", required = false) Integer enumQueryInteger, @ApiParam(value = "Query parameter enum test (double)", allowableValues="1.1, -1.2") @RequestPart(value="enum_query_double", required=false) Double enumQueryDouble, @RequestHeader("Accept") String accept) { // do some magic! diff --git a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/api/FakeClassnameTestApi.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/api/FakeClassnameTestApi.java new file mode 100644 index 00000000000..bd3568f20e1 --- /dev/null +++ b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/api/FakeClassnameTestApi.java @@ -0,0 +1,33 @@ +package io.swagger.api; + +import io.swagger.model.Client; + +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.io.IOException; + +import java.util.List; +import javax.validation.constraints.*; +import javax.validation.Valid; + +@Api(value = "fake_classname_test", description = "the fake_classname_test API") +public interface FakeClassnameTestApi { + + @ApiOperation(value = "To test class name in snake case", notes = "", response = Client.class, tags={ "fake_classname_tags 123#$%^", }) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "successful operation", response = Client.class) }) + @RequestMapping(value = "/fake_classname_test", + produces = { "application/json" }, + consumes = { "application/json" }, + method = RequestMethod.PATCH) + ResponseEntity testClassname(@ApiParam(value = "client model" ,required=true ) @Valid @RequestBody Client body, @RequestHeader("Accept") String accept) throws IOException; + +} diff --git a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/api/FakeClassnameTestApiController.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/api/FakeClassnameTestApiController.java new file mode 100644 index 00000000000..4c37c7a71de --- /dev/null +++ b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/api/FakeClassnameTestApiController.java @@ -0,0 +1,39 @@ +package io.swagger.api; + +import io.swagger.model.Client; + +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 com.fasterxml.jackson.databind.ObjectMapper; +import java.io.IOException; + +import java.util.List; + +import javax.validation.constraints.*; +import javax.validation.Valid; + +@Controller +public class FakeClassnameTestApiController implements FakeClassnameTestApi { + public ResponseEntity testClassname(@ApiParam(value = "client model" ,required=true ) @Valid @RequestBody Client body, + @RequestHeader("Accept") String accept) throws IOException { + // do some magic! + + ObjectMapper objectMapper = new ObjectMapper(); + + if (accept != null && accept.contains("application/json")) { + return new ResponseEntity(objectMapper.readValue("{ \"client\" : \"aeiou\"}", Client.class), HttpStatus.OK); + } + + return new ResponseEntity(HttpStatus.OK); + } + +} 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 index 5816fb5b92e..1227aedbbd7 100644 --- 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 @@ -64,7 +64,7 @@ public interface PetApi { @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, @RequestHeader("Accept") String accept) throws IOException; + 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, @RequestHeader("Accept") String accept) throws IOException; @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 = { @@ -79,7 +79,7 @@ public interface PetApi { @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, @RequestHeader("Accept") String accept) throws IOException; + ResponseEntity> findPetsByTags( @NotNull@ApiParam(value = "Tags to filter by", required = true) @RequestParam(value = "tags", required = true) List tags, @RequestHeader("Accept") String accept) throws IOException; @ApiOperation(value = "Find pet by ID", notes = "Returns a single pet", response = Pet.class, authorizations = { 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 index 220aa32691d..7fc193be9c5 100644 --- 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 @@ -38,7 +38,7 @@ public class PetApiController implements PetApi { 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, + 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, @RequestHeader("Accept") String accept) throws IOException { // do some magic! @@ -55,7 +55,7 @@ public class PetApiController implements PetApi { return new ResponseEntity>(HttpStatus.OK); } - public ResponseEntity> findPetsByTags( @NotNull @ApiParam(value = "Tags to filter by", required = true) @RequestParam(value = "tags", required = true) List tags, + public ResponseEntity> findPetsByTags( @NotNull@ApiParam(value = "Tags to filter by", required = true) @RequestParam(value = "tags", required = true) List tags, @RequestHeader("Accept") String accept) throws IOException { // do some magic! diff --git a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/api/UserApi.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/api/UserApi.java index 53899d1eddd..adc0d21d30b 100644 --- a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/api/UserApi.java +++ b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/api/UserApi.java @@ -77,7 +77,7 @@ public interface UserApi { @RequestMapping(value = "/user/login", produces = { "application/xml", "application/json" }, method = RequestMethod.GET) - ResponseEntity loginUser( @NotNull @ApiParam(value = "The user name for login", required = true) @RequestParam(value = "username", required = true) String username, @NotNull @ApiParam(value = "The password for login in clear text", required = true) @RequestParam(value = "password", required = true) String password, @RequestHeader("Accept") String accept) throws IOException; + ResponseEntity loginUser( @NotNull@ApiParam(value = "The user name for login", required = true) @RequestParam(value = "username", required = true) String username, @NotNull@ApiParam(value = "The password for login in clear text", required = true) @RequestParam(value = "password", required = true) String password, @RequestHeader("Accept") String accept) throws IOException; @ApiOperation(value = "Logs out current logged in user session", notes = "", response = Void.class, tags={ "user", }) diff --git a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/api/UserApiController.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/api/UserApiController.java index d8cac8d5eb8..8188aeaeb8d 100644 --- a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/api/UserApiController.java +++ b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/api/UserApiController.java @@ -65,8 +65,8 @@ public class UserApiController implements UserApi { return new ResponseEntity(HttpStatus.OK); } - public ResponseEntity loginUser( @NotNull @ApiParam(value = "The user name for login", required = true) @RequestParam(value = "username", required = true) String username, - @NotNull @ApiParam(value = "The password for login in clear text", required = true) @RequestParam(value = "password", required = true) String password, + public ResponseEntity loginUser( @NotNull@ApiParam(value = "The user name for login", required = true) @RequestParam(value = "username", required = true) String username, + @NotNull@ApiParam(value = "The password for login in clear text", required = true) @RequestParam(value = "password", required = true) String password, @RequestHeader("Accept") String accept) throws IOException { // do some magic! diff --git a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/configuration/CustomInstantDeserializer.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/configuration/CustomInstantDeserializer.java new file mode 100644 index 00000000000..c8894e9a562 --- /dev/null +++ b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/configuration/CustomInstantDeserializer.java @@ -0,0 +1,232 @@ +package io.swagger.configuration; + +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.JsonTokenId; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.DeserializationFeature; +import com.fasterxml.jackson.databind.JsonDeserializer; +import com.fasterxml.jackson.datatype.threetenbp.DateTimeUtils; +import com.fasterxml.jackson.datatype.threetenbp.DecimalUtils; +import com.fasterxml.jackson.datatype.threetenbp.deser.ThreeTenDateTimeDeserializerBase; +import com.fasterxml.jackson.datatype.threetenbp.function.BiFunction; +import com.fasterxml.jackson.datatype.threetenbp.function.Function; +import org.threeten.bp.DateTimeException; +import org.threeten.bp.Instant; +import org.threeten.bp.OffsetDateTime; +import org.threeten.bp.ZoneId; +import org.threeten.bp.ZonedDateTime; +import org.threeten.bp.format.DateTimeFormatter; +import org.threeten.bp.temporal.Temporal; +import org.threeten.bp.temporal.TemporalAccessor; + +import java.io.IOException; +import java.math.BigDecimal; + +/** + * Deserializer for ThreeTen temporal {@link Instant}s, {@link OffsetDateTime}, and {@link ZonedDateTime}s. + * Adapted from the jackson threetenbp InstantDeserializer to add support for deserializing rfc822 format. + * + * @author Nick Williams + */ +public class CustomInstantDeserializer + extends ThreeTenDateTimeDeserializerBase { + private static final long serialVersionUID = 1L; + + public static final CustomInstantDeserializer INSTANT = new CustomInstantDeserializer( + Instant.class, DateTimeFormatter.ISO_INSTANT, + new Function() { + @Override + public Instant apply(TemporalAccessor temporalAccessor) { + return Instant.from(temporalAccessor); + } + }, + new Function() { + @Override + public Instant apply(FromIntegerArguments a) { + return Instant.ofEpochMilli(a.value); + } + }, + new Function() { + @Override + public Instant apply(FromDecimalArguments a) { + return Instant.ofEpochSecond(a.integer, a.fraction); + } + }, + null + ); + + public static final CustomInstantDeserializer OFFSET_DATE_TIME = new CustomInstantDeserializer( + OffsetDateTime.class, DateTimeFormatter.ISO_OFFSET_DATE_TIME, + new Function() { + @Override + public OffsetDateTime apply(TemporalAccessor temporalAccessor) { + return OffsetDateTime.from(temporalAccessor); + } + }, + new Function() { + @Override + public OffsetDateTime apply(FromIntegerArguments a) { + return OffsetDateTime.ofInstant(Instant.ofEpochMilli(a.value), a.zoneId); + } + }, + new Function() { + @Override + public OffsetDateTime apply(FromDecimalArguments a) { + return OffsetDateTime.ofInstant(Instant.ofEpochSecond(a.integer, a.fraction), a.zoneId); + } + }, + new BiFunction() { + @Override + public OffsetDateTime apply(OffsetDateTime d, ZoneId z) { + return d.withOffsetSameInstant(z.getRules().getOffset(d.toLocalDateTime())); + } + } + ); + + public static final CustomInstantDeserializer ZONED_DATE_TIME = new CustomInstantDeserializer( + ZonedDateTime.class, DateTimeFormatter.ISO_ZONED_DATE_TIME, + new Function() { + @Override + public ZonedDateTime apply(TemporalAccessor temporalAccessor) { + return ZonedDateTime.from(temporalAccessor); + } + }, + new Function() { + @Override + public ZonedDateTime apply(FromIntegerArguments a) { + return ZonedDateTime.ofInstant(Instant.ofEpochMilli(a.value), a.zoneId); + } + }, + new Function() { + @Override + public ZonedDateTime apply(FromDecimalArguments a) { + return ZonedDateTime.ofInstant(Instant.ofEpochSecond(a.integer, a.fraction), a.zoneId); + } + }, + new BiFunction() { + @Override + public ZonedDateTime apply(ZonedDateTime zonedDateTime, ZoneId zoneId) { + return zonedDateTime.withZoneSameInstant(zoneId); + } + } + ); + + protected final Function fromMilliseconds; + + protected final Function fromNanoseconds; + + protected final Function parsedToValue; + + protected final BiFunction adjust; + + protected CustomInstantDeserializer(Class supportedType, + DateTimeFormatter parser, + Function parsedToValue, + Function fromMilliseconds, + Function fromNanoseconds, + BiFunction adjust) { + super(supportedType, parser); + this.parsedToValue = parsedToValue; + this.fromMilliseconds = fromMilliseconds; + this.fromNanoseconds = fromNanoseconds; + this.adjust = adjust == null ? new BiFunction() { + @Override + public T apply(T t, ZoneId zoneId) { + return t; + } + } : adjust; + } + + @SuppressWarnings("unchecked") + protected CustomInstantDeserializer(CustomInstantDeserializer base, DateTimeFormatter f) { + super((Class) base.handledType(), f); + parsedToValue = base.parsedToValue; + fromMilliseconds = base.fromMilliseconds; + fromNanoseconds = base.fromNanoseconds; + adjust = base.adjust; + } + + @Override + protected JsonDeserializer withDateFormat(DateTimeFormatter dtf) { + if (dtf == _formatter) { + return this; + } + return new CustomInstantDeserializer(this, dtf); + } + + @Override + public T deserialize(JsonParser parser, DeserializationContext context) throws IOException { + //NOTE: Timestamps contain no timezone info, and are always in configured TZ. Only + //string values have to be adjusted to the configured TZ. + switch (parser.getCurrentTokenId()) { + case JsonTokenId.ID_NUMBER_FLOAT: { + BigDecimal value = parser.getDecimalValue(); + long seconds = value.longValue(); + int nanoseconds = DecimalUtils.extractNanosecondDecimal(value, seconds); + return fromNanoseconds.apply(new FromDecimalArguments( + seconds, nanoseconds, getZone(context))); + } + + case JsonTokenId.ID_NUMBER_INT: { + long timestamp = parser.getLongValue(); + if (context.isEnabled(DeserializationFeature.READ_DATE_TIMESTAMPS_AS_NANOSECONDS)) { + return this.fromNanoseconds.apply(new FromDecimalArguments( + timestamp, 0, this.getZone(context) + )); + } + return this.fromMilliseconds.apply(new FromIntegerArguments( + timestamp, this.getZone(context) + )); + } + + case JsonTokenId.ID_STRING: { + String string = parser.getText().trim(); + if (string.length() == 0) { + return null; + } + if (string.endsWith("+0000")) { + string = string.substring(0, string.length() - 5) + "Z"; + } + T value; + try { + TemporalAccessor acc = _formatter.parse(string); + value = parsedToValue.apply(acc); + if (context.isEnabled(DeserializationFeature.ADJUST_DATES_TO_CONTEXT_TIME_ZONE)) { + return adjust.apply(value, this.getZone(context)); + } + } catch (DateTimeException e) { + throw _peelDTE(e); + } + return value; + } + } + throw context.mappingException("Expected type float, integer, or string."); + } + + private ZoneId getZone(DeserializationContext context) { + // Instants are always in UTC, so don't waste compute cycles + return (_valueClass == Instant.class) ? null : DateTimeUtils.timeZoneToZoneId(context.getTimeZone()); + } + + private static class FromIntegerArguments { + public final long value; + public final ZoneId zoneId; + + private FromIntegerArguments(long value, ZoneId zoneId) { + this.value = value; + this.zoneId = zoneId; + } + } + + private static class FromDecimalArguments { + public final long integer; + public final int fraction; + public final ZoneId zoneId; + + private FromDecimalArguments(long integer, int fraction, ZoneId zoneId) { + this.integer = integer; + this.fraction = fraction; + this.zoneId = zoneId; + } + } +} diff --git a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/configuration/JacksonConfiguration.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/configuration/JacksonConfiguration.java new file mode 100644 index 00000000000..2609d724907 --- /dev/null +++ b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/configuration/JacksonConfiguration.java @@ -0,0 +1,23 @@ +package io.swagger.configuration; + +import com.fasterxml.jackson.datatype.threetenbp.ThreeTenModule; +import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.threeten.bp.Instant; +import org.threeten.bp.OffsetDateTime; +import org.threeten.bp.ZonedDateTime; + +@Configuration +public class JacksonConfiguration { + + @Bean + @ConditionalOnMissingBean(ThreeTenModule.class) + ThreeTenModule threeTenModule() { + ThreeTenModule module = new ThreeTenModule(); + module.addDeserializer(Instant.class, CustomInstantDeserializer.INSTANT); + module.addDeserializer(OffsetDateTime.class, CustomInstantDeserializer.OFFSET_DATE_TIME); + module.addDeserializer(ZonedDateTime.class, CustomInstantDeserializer.ZONED_DATE_TIME); + return module; + } +} diff --git a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/AdditionalPropertiesClass.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/AdditionalPropertiesClass.java index f4cfcadae51..80be4236b0d 100644 --- a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/AdditionalPropertiesClass.java +++ b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/AdditionalPropertiesClass.java @@ -8,7 +8,9 @@ import io.swagger.annotations.ApiModelProperty; import java.util.HashMap; import java.util.List; import java.util.Map; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * AdditionalPropertiesClass */ @@ -38,6 +40,8 @@ public class AdditionalPropertiesClass { * @return mapProperty **/ @ApiModelProperty(value = "") + + @Valid public Map getMapProperty() { return mapProperty; } @@ -64,6 +68,8 @@ public class AdditionalPropertiesClass { * @return mapOfMapProperty **/ @ApiModelProperty(value = "") + + @Valid public Map> getMapOfMapProperty() { return mapOfMapProperty; } diff --git a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/Animal.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/Animal.java index a218f0b5542..bc957d1c803 100644 --- a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/Animal.java +++ b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/Animal.java @@ -7,7 +7,9 @@ import com.fasterxml.jackson.annotation.JsonSubTypes; import com.fasterxml.jackson.annotation.JsonTypeInfo; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * Animal */ @@ -35,6 +37,8 @@ public class Animal { **/ @ApiModelProperty(required = true, value = "") @NotNull + + @Valid public String getClassName() { return className; } @@ -53,6 +57,8 @@ public class Animal { * @return color **/ @ApiModelProperty(value = "") + + @Valid public String getColor() { return color; } diff --git a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/AnimalFarm.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/AnimalFarm.java index 33dc04699af..9fa4159f203 100644 --- a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/AnimalFarm.java +++ b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/AnimalFarm.java @@ -4,7 +4,9 @@ import java.util.Objects; import io.swagger.model.Animal; import java.util.ArrayList; import java.util.List; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * AnimalFarm */ diff --git a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/ArrayOfArrayOfNumberOnly.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/ArrayOfArrayOfNumberOnly.java index 8f975d8feda..f9dca7d60b5 100644 --- a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/ArrayOfArrayOfNumberOnly.java +++ b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/ArrayOfArrayOfNumberOnly.java @@ -8,7 +8,9 @@ import io.swagger.annotations.ApiModelProperty; import java.math.BigDecimal; import java.util.ArrayList; import java.util.List; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * ArrayOfArrayOfNumberOnly */ @@ -35,6 +37,8 @@ public class ArrayOfArrayOfNumberOnly { * @return arrayArrayNumber **/ @ApiModelProperty(value = "") + + @Valid public List> getArrayArrayNumber() { return arrayArrayNumber; } diff --git a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/ArrayOfNumberOnly.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/ArrayOfNumberOnly.java index 2c556008554..e9c8a313be0 100644 --- a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/ArrayOfNumberOnly.java +++ b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/ArrayOfNumberOnly.java @@ -8,7 +8,9 @@ import io.swagger.annotations.ApiModelProperty; import java.math.BigDecimal; import java.util.ArrayList; import java.util.List; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * ArrayOfNumberOnly */ @@ -35,6 +37,8 @@ public class ArrayOfNumberOnly { * @return arrayNumber **/ @ApiModelProperty(value = "") + + @Valid public List getArrayNumber() { return arrayNumber; } diff --git a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/ArrayTest.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/ArrayTest.java index 664e319cd35..78c35d3c63a 100644 --- a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/ArrayTest.java +++ b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/ArrayTest.java @@ -8,7 +8,9 @@ import io.swagger.annotations.ApiModelProperty; import io.swagger.model.ReadOnlyFirst; import java.util.ArrayList; import java.util.List; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * ArrayTest */ @@ -41,6 +43,8 @@ public class ArrayTest { * @return arrayOfString **/ @ApiModelProperty(value = "") + + @Valid public List getArrayOfString() { return arrayOfString; } @@ -67,6 +71,8 @@ public class ArrayTest { * @return arrayArrayOfInteger **/ @ApiModelProperty(value = "") + + @Valid public List> getArrayArrayOfInteger() { return arrayArrayOfInteger; } @@ -93,6 +99,8 @@ public class ArrayTest { * @return arrayArrayOfModel **/ @ApiModelProperty(value = "") + + @Valid public List> getArrayArrayOfModel() { return arrayArrayOfModel; } diff --git a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/Capitalization.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/Capitalization.java index d7ad5642ccf..93533c28822 100644 --- a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/Capitalization.java +++ b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/Capitalization.java @@ -5,7 +5,9 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * Capitalization */ @@ -39,6 +41,8 @@ public class Capitalization { * @return smallCamel **/ @ApiModelProperty(value = "") + + @Valid public String getSmallCamel() { return smallCamel; } @@ -57,6 +61,8 @@ public class Capitalization { * @return capitalCamel **/ @ApiModelProperty(value = "") + + @Valid public String getCapitalCamel() { return capitalCamel; } @@ -75,6 +81,8 @@ public class Capitalization { * @return smallSnake **/ @ApiModelProperty(value = "") + + @Valid public String getSmallSnake() { return smallSnake; } @@ -93,6 +101,8 @@ public class Capitalization { * @return capitalSnake **/ @ApiModelProperty(value = "") + + @Valid public String getCapitalSnake() { return capitalSnake; } @@ -111,6 +121,8 @@ public class Capitalization { * @return scAETHFlowPoints **/ @ApiModelProperty(value = "") + + @Valid public String getScAETHFlowPoints() { return scAETHFlowPoints; } @@ -129,6 +141,8 @@ public class Capitalization { * @return ATT_NAME **/ @ApiModelProperty(value = "Name of the pet ") + + @Valid public String getATTNAME() { return ATT_NAME; } diff --git a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/Cat.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/Cat.java index 747e5dc0c7e..edcbc354be6 100644 --- a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/Cat.java +++ b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/Cat.java @@ -6,7 +6,9 @@ import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import io.swagger.model.Animal; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * Cat */ @@ -25,6 +27,8 @@ public class Cat extends Animal { * @return declawed **/ @ApiModelProperty(value = "") + + @Valid public Boolean getDeclawed() { return declawed; } diff --git a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/Category.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/Category.java index 9629da6500e..6dd9cb7a2ad 100644 --- a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/Category.java +++ b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/Category.java @@ -5,7 +5,9 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * Category */ @@ -27,6 +29,8 @@ public class Category { * @return id **/ @ApiModelProperty(value = "") + + @Valid public Long getId() { return id; } @@ -45,6 +49,8 @@ public class Category { * @return name **/ @ApiModelProperty(value = "") + + @Valid public String getName() { return name; } diff --git a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/ClassModel.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/ClassModel.java index d69acffefa8..6a6379f5b60 100644 --- a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/ClassModel.java +++ b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/ClassModel.java @@ -5,7 +5,9 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * Model for testing model with \"_class\" property */ @@ -25,6 +27,8 @@ public class ClassModel { * @return propertyClass **/ @ApiModelProperty(value = "") + + @Valid public String getPropertyClass() { return propertyClass; } diff --git a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/Client.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/Client.java index f9cec5a225e..3b8d16cabf2 100644 --- a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/Client.java +++ b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/Client.java @@ -5,7 +5,9 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * Client */ @@ -24,6 +26,8 @@ public class Client { * @return client **/ @ApiModelProperty(value = "") + + @Valid public String getClient() { return client; } diff --git a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/Dog.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/Dog.java index 9057e840fc3..513131a9fa7 100644 --- a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/Dog.java +++ b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/Dog.java @@ -6,7 +6,9 @@ import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import io.swagger.model.Animal; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * Dog */ @@ -25,6 +27,8 @@ public class Dog extends Animal { * @return breed **/ @ApiModelProperty(value = "") + + @Valid public String getBreed() { return breed; } diff --git a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/EnumArrays.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/EnumArrays.java index f904035e482..bbf4a3036e9 100644 --- a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/EnumArrays.java +++ b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/EnumArrays.java @@ -8,7 +8,9 @@ import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import java.util.ArrayList; import java.util.List; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * EnumArrays */ @@ -92,6 +94,8 @@ public class EnumArrays { * @return justSymbol **/ @ApiModelProperty(value = "") + + @Valid public JustSymbolEnum getJustSymbol() { return justSymbol; } @@ -118,6 +122,8 @@ public class EnumArrays { * @return arrayEnum **/ @ApiModelProperty(value = "") + + @Valid public List getArrayEnum() { return arrayEnum; } diff --git a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/EnumClass.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/EnumClass.java index cdfc0933c3e..4cfbe4b9fcf 100644 --- a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/EnumClass.java +++ b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/EnumClass.java @@ -2,7 +2,9 @@ package io.swagger.model; import java.util.Objects; import com.fasterxml.jackson.annotation.JsonValue; +import javax.validation.Valid; import javax.validation.constraints.*; + import com.fasterxml.jackson.annotation.JsonCreator; /** diff --git a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/EnumTest.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/EnumTest.java index 9f2a0275a6a..c7e4793cdf7 100644 --- a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/EnumTest.java +++ b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/EnumTest.java @@ -7,7 +7,9 @@ import com.fasterxml.jackson.annotation.JsonValue; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import io.swagger.model.OuterEnum; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * EnumTest */ @@ -130,6 +132,8 @@ public class EnumTest { * @return enumString **/ @ApiModelProperty(value = "") + + @Valid public EnumStringEnum getEnumString() { return enumString; } @@ -148,6 +152,8 @@ public class EnumTest { * @return enumInteger **/ @ApiModelProperty(value = "") + + @Valid public EnumIntegerEnum getEnumInteger() { return enumInteger; } @@ -166,6 +172,8 @@ public class EnumTest { * @return enumNumber **/ @ApiModelProperty(value = "") + + @Valid public EnumNumberEnum getEnumNumber() { return enumNumber; } @@ -184,6 +192,8 @@ public class EnumTest { * @return outerEnum **/ @ApiModelProperty(value = "") + + @Valid public OuterEnum getOuterEnum() { return outerEnum; } diff --git a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/FormatTest.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/FormatTest.java index 0f144806e9e..2aaa5179f61 100644 --- a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/FormatTest.java +++ b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/FormatTest.java @@ -9,7 +9,9 @@ import java.math.BigDecimal; import java.util.UUID; import org.threeten.bp.LocalDate; import org.threeten.bp.OffsetDateTime; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * FormatTest */ @@ -66,7 +68,9 @@ public class FormatTest { * @return integer **/ @ApiModelProperty(value = "") - @Min(10) @Max(100) public Integer getInteger() { + @Min(10) @Max(100) + @Valid + public Integer getInteger() { return integer; } @@ -86,7 +90,9 @@ public class FormatTest { * @return int32 **/ @ApiModelProperty(value = "") - @Min(20) @Max(200) public Integer getInt32() { + @Min(20) @Max(200) + @Valid + public Integer getInt32() { return int32; } @@ -104,6 +110,8 @@ public class FormatTest { * @return int64 **/ @ApiModelProperty(value = "") + + @Valid public Long getInt64() { return int64; } @@ -125,7 +133,9 @@ public class FormatTest { **/ @ApiModelProperty(required = true, value = "") @NotNull - @DecimalMin("32.1") @DecimalMax("543.2") public BigDecimal getNumber() { + @DecimalMin("32.1") @DecimalMax("543.2") + @Valid + public BigDecimal getNumber() { return number; } @@ -145,7 +155,9 @@ public class FormatTest { * @return _float **/ @ApiModelProperty(value = "") - @DecimalMin("54.3") @DecimalMax("987.6") public Float getFloat() { + @DecimalMin("54.3") @DecimalMax("987.6") + @Valid + public Float getFloat() { return _float; } @@ -165,7 +177,9 @@ public class FormatTest { * @return _double **/ @ApiModelProperty(value = "") - @DecimalMin("67.8") @DecimalMax("123.4") public Double getDouble() { + @DecimalMin("67.8") @DecimalMax("123.4") + @Valid + public Double getDouble() { return _double; } @@ -183,7 +197,9 @@ public class FormatTest { * @return string **/ @ApiModelProperty(value = "") - @Pattern(regexp="/[a-z]/i") public String getString() { + @Pattern(regexp="/[a-z]/i") + @Valid + public String getString() { return string; } @@ -202,6 +218,8 @@ public class FormatTest { **/ @ApiModelProperty(required = true, value = "") @NotNull + + @Valid public byte[] getByte() { return _byte; } @@ -220,6 +238,8 @@ public class FormatTest { * @return binary **/ @ApiModelProperty(value = "") + + @Valid public byte[] getBinary() { return binary; } @@ -239,6 +259,8 @@ public class FormatTest { **/ @ApiModelProperty(required = true, value = "") @NotNull + + @Valid public LocalDate getDate() { return date; } @@ -257,6 +279,8 @@ public class FormatTest { * @return dateTime **/ @ApiModelProperty(value = "") + + @Valid public OffsetDateTime getDateTime() { return dateTime; } @@ -275,6 +299,8 @@ public class FormatTest { * @return uuid **/ @ApiModelProperty(value = "") + + @Valid public UUID getUuid() { return uuid; } @@ -294,7 +320,9 @@ public class FormatTest { **/ @ApiModelProperty(required = true, value = "") @NotNull - @Size(min=10,max=64) public String getPassword() { + @Size(min=10,max=64) + @Valid + public String getPassword() { return password; } diff --git a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/HasOnlyReadOnly.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/HasOnlyReadOnly.java index a26492e4912..0f8b608e261 100644 --- a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/HasOnlyReadOnly.java +++ b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/HasOnlyReadOnly.java @@ -5,7 +5,9 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * HasOnlyReadOnly */ @@ -27,6 +29,8 @@ public class HasOnlyReadOnly { * @return bar **/ @ApiModelProperty(readOnly = true, value = "") + + @Valid public String getBar() { return bar; } @@ -45,6 +49,8 @@ public class HasOnlyReadOnly { * @return foo **/ @ApiModelProperty(readOnly = true, value = "") + + @Valid public String getFoo() { return foo; } diff --git a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/MapTest.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/MapTest.java index 434c3a8f1b5..1530a53f53f 100644 --- a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/MapTest.java +++ b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/MapTest.java @@ -9,7 +9,9 @@ import io.swagger.annotations.ApiModelProperty; import java.util.HashMap; import java.util.List; import java.util.Map; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * MapTest */ @@ -70,6 +72,8 @@ public class MapTest { * @return mapMapOfString **/ @ApiModelProperty(value = "") + + @Valid public Map> getMapMapOfString() { return mapMapOfString; } @@ -96,6 +100,8 @@ public class MapTest { * @return mapOfEnumString **/ @ApiModelProperty(value = "") + + @Valid public Map getMapOfEnumString() { return mapOfEnumString; } diff --git a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/MixedPropertiesAndAdditionalPropertiesClass.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/MixedPropertiesAndAdditionalPropertiesClass.java index d9f452920f9..21cb67378eb 100644 --- a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/MixedPropertiesAndAdditionalPropertiesClass.java +++ b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/MixedPropertiesAndAdditionalPropertiesClass.java @@ -11,7 +11,9 @@ import java.util.List; import java.util.Map; import java.util.UUID; import org.threeten.bp.OffsetDateTime; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * MixedPropertiesAndAdditionalPropertiesClass */ @@ -36,6 +38,8 @@ public class MixedPropertiesAndAdditionalPropertiesClass { * @return uuid **/ @ApiModelProperty(value = "") + + @Valid public UUID getUuid() { return uuid; } @@ -54,6 +58,8 @@ public class MixedPropertiesAndAdditionalPropertiesClass { * @return dateTime **/ @ApiModelProperty(value = "") + + @Valid public OffsetDateTime getDateTime() { return dateTime; } @@ -80,6 +86,8 @@ public class MixedPropertiesAndAdditionalPropertiesClass { * @return map **/ @ApiModelProperty(value = "") + + @Valid public Map getMap() { return map; } diff --git a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/Model200Response.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/Model200Response.java index 4d47f6c03c9..97349fef05c 100644 --- a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/Model200Response.java +++ b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/Model200Response.java @@ -5,7 +5,9 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * Model for testing model name starting with number */ @@ -28,6 +30,8 @@ public class Model200Response { * @return name **/ @ApiModelProperty(value = "") + + @Valid public Integer getName() { return name; } @@ -46,6 +50,8 @@ public class Model200Response { * @return propertyClass **/ @ApiModelProperty(value = "") + + @Valid public String getPropertyClass() { return propertyClass; } diff --git a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/ModelApiResponse.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/ModelApiResponse.java index 36da9b20d9d..c8882b3b1e2 100644 --- a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/ModelApiResponse.java +++ b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/ModelApiResponse.java @@ -5,7 +5,9 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * ModelApiResponse */ @@ -30,6 +32,8 @@ public class ModelApiResponse { * @return code **/ @ApiModelProperty(value = "") + + @Valid public Integer getCode() { return code; } @@ -48,6 +52,8 @@ public class ModelApiResponse { * @return type **/ @ApiModelProperty(value = "") + + @Valid public String getType() { return type; } @@ -66,6 +72,8 @@ public class ModelApiResponse { * @return message **/ @ApiModelProperty(value = "") + + @Valid public String getMessage() { return message; } diff --git a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/ModelReturn.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/ModelReturn.java index 7ffc24a0144..7018d7de09c 100644 --- a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/ModelReturn.java +++ b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/ModelReturn.java @@ -5,7 +5,9 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * Model for testing reserved words */ @@ -25,6 +27,8 @@ public class ModelReturn { * @return _return **/ @ApiModelProperty(value = "") + + @Valid public Integer getReturn() { return _return; } diff --git a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/Name.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/Name.java index 953199166ff..46069fdd14b 100644 --- a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/Name.java +++ b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/Name.java @@ -5,7 +5,9 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * Model for testing model name same as property name */ @@ -35,6 +37,8 @@ public class Name { **/ @ApiModelProperty(required = true, value = "") @NotNull + + @Valid public Integer getName() { return name; } @@ -53,6 +57,8 @@ public class Name { * @return snakeCase **/ @ApiModelProperty(readOnly = true, value = "") + + @Valid public Integer getSnakeCase() { return snakeCase; } @@ -71,6 +77,8 @@ public class Name { * @return property **/ @ApiModelProperty(value = "") + + @Valid public String getProperty() { return property; } @@ -89,6 +97,8 @@ public class Name { * @return _123Number **/ @ApiModelProperty(readOnly = true, value = "") + + @Valid public Integer get123Number() { return _123Number; } diff --git a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/NumberOnly.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/NumberOnly.java index e6dbf3139e2..e243ecb429b 100644 --- a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/NumberOnly.java +++ b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/NumberOnly.java @@ -6,7 +6,9 @@ import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import java.math.BigDecimal; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * NumberOnly */ @@ -25,6 +27,8 @@ public class NumberOnly { * @return justNumber **/ @ApiModelProperty(value = "") + + @Valid public BigDecimal getJustNumber() { return justNumber; } diff --git a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/Order.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/Order.java index c5381d2fa7e..3ba7e5a0a85 100644 --- a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/Order.java +++ b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/Order.java @@ -7,7 +7,9 @@ import com.fasterxml.jackson.annotation.JsonValue; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import org.threeten.bp.OffsetDateTime; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * Order */ @@ -74,6 +76,8 @@ public class Order { * @return id **/ @ApiModelProperty(value = "") + + @Valid public Long getId() { return id; } @@ -92,6 +96,8 @@ public class Order { * @return petId **/ @ApiModelProperty(value = "") + + @Valid public Long getPetId() { return petId; } @@ -110,6 +116,8 @@ public class Order { * @return quantity **/ @ApiModelProperty(value = "") + + @Valid public Integer getQuantity() { return quantity; } @@ -128,6 +136,8 @@ public class Order { * @return shipDate **/ @ApiModelProperty(value = "") + + @Valid public OffsetDateTime getShipDate() { return shipDate; } @@ -146,6 +156,8 @@ public class Order { * @return status **/ @ApiModelProperty(value = "Order Status") + + @Valid public StatusEnum getStatus() { return status; } @@ -164,6 +176,8 @@ public class Order { * @return complete **/ @ApiModelProperty(value = "") + + @Valid public Boolean getComplete() { return complete; } diff --git a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/OuterEnum.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/OuterEnum.java index 5f0075e4457..f3c6d31fb86 100644 --- a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/OuterEnum.java +++ b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/OuterEnum.java @@ -2,7 +2,9 @@ package io.swagger.model; import java.util.Objects; import com.fasterxml.jackson.annotation.JsonValue; +import javax.validation.Valid; import javax.validation.constraints.*; + import com.fasterxml.jackson.annotation.JsonCreator; /** diff --git a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/Pet.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/Pet.java index b013846b4d6..c84687b699f 100644 --- a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/Pet.java +++ b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/Pet.java @@ -10,7 +10,9 @@ import io.swagger.model.Category; import io.swagger.model.Tag; import java.util.ArrayList; import java.util.List; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * Pet */ @@ -77,6 +79,8 @@ public class Pet { * @return id **/ @ApiModelProperty(value = "") + + @Valid public Long getId() { return id; } @@ -95,6 +99,8 @@ public class Pet { * @return category **/ @ApiModelProperty(value = "") + + @Valid public Category getCategory() { return category; } @@ -114,6 +120,8 @@ public class Pet { **/ @ApiModelProperty(example = "doggie", required = true, value = "") @NotNull + + @Valid public String getName() { return name; } @@ -138,6 +146,8 @@ public class Pet { **/ @ApiModelProperty(required = true, value = "") @NotNull + + @Valid public List getPhotoUrls() { return photoUrls; } @@ -164,6 +174,8 @@ public class Pet { * @return tags **/ @ApiModelProperty(value = "") + + @Valid public List getTags() { return tags; } @@ -182,6 +194,8 @@ public class Pet { * @return status **/ @ApiModelProperty(value = "pet status in the store") + + @Valid public StatusEnum getStatus() { return status; } diff --git a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/ReadOnlyFirst.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/ReadOnlyFirst.java index 47700659fd2..8e79be0008d 100644 --- a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/ReadOnlyFirst.java +++ b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/ReadOnlyFirst.java @@ -5,7 +5,9 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * ReadOnlyFirst */ @@ -27,6 +29,8 @@ public class ReadOnlyFirst { * @return bar **/ @ApiModelProperty(readOnly = true, value = "") + + @Valid public String getBar() { return bar; } @@ -45,6 +49,8 @@ public class ReadOnlyFirst { * @return baz **/ @ApiModelProperty(value = "") + + @Valid public String getBaz() { return baz; } diff --git a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/SpecialModelName.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/SpecialModelName.java index 880d70599b0..3cb7b04353c 100644 --- a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/SpecialModelName.java +++ b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/SpecialModelName.java @@ -5,7 +5,9 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * SpecialModelName */ @@ -24,6 +26,8 @@ public class SpecialModelName { * @return specialPropertyName **/ @ApiModelProperty(value = "") + + @Valid public Long getSpecialPropertyName() { return specialPropertyName; } diff --git a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/Tag.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/Tag.java index 298085317a4..9f8f3a25234 100644 --- a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/Tag.java +++ b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/Tag.java @@ -5,7 +5,9 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * Tag */ @@ -27,6 +29,8 @@ public class Tag { * @return id **/ @ApiModelProperty(value = "") + + @Valid public Long getId() { return id; } @@ -45,6 +49,8 @@ public class Tag { * @return name **/ @ApiModelProperty(value = "") + + @Valid public String getName() { return name; } diff --git a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/User.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/User.java index 8e40f7e0594..501c556de27 100644 --- a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/User.java +++ b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/User.java @@ -5,7 +5,9 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * User */ @@ -45,6 +47,8 @@ public class User { * @return id **/ @ApiModelProperty(value = "") + + @Valid public Long getId() { return id; } @@ -63,6 +67,8 @@ public class User { * @return username **/ @ApiModelProperty(value = "") + + @Valid public String getUsername() { return username; } @@ -81,6 +87,8 @@ public class User { * @return firstName **/ @ApiModelProperty(value = "") + + @Valid public String getFirstName() { return firstName; } @@ -99,6 +107,8 @@ public class User { * @return lastName **/ @ApiModelProperty(value = "") + + @Valid public String getLastName() { return lastName; } @@ -117,6 +127,8 @@ public class User { * @return email **/ @ApiModelProperty(value = "") + + @Valid public String getEmail() { return email; } @@ -135,6 +147,8 @@ public class User { * @return password **/ @ApiModelProperty(value = "") + + @Valid public String getPassword() { return password; } @@ -153,6 +167,8 @@ public class User { * @return phone **/ @ApiModelProperty(value = "") + + @Valid public String getPhone() { return phone; } @@ -171,6 +187,8 @@ public class User { * @return userStatus **/ @ApiModelProperty(value = "User Status") + + @Valid public Integer getUserStatus() { return userStatus; } diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/api/FakeApi.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/api/FakeApi.java index 6c695dcd576..332c9b1101f 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/api/FakeApi.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/api/FakeApi.java @@ -62,7 +62,7 @@ public interface FakeApi { produces = { "*/*" }, consumes = { "*/*" }, method = RequestMethod.GET) - default ResponseEntity testEnumParameters(@ApiParam(value = "Form parameter enum test (string array)", allowableValues=">, $") @RequestPart(value="enum_form_string_array", required=false) List enumFormStringArray,@ApiParam(value = "Form parameter enum test (string)", allowableValues="_abc, -efg, (xyz)", defaultValue="-efg") @RequestPart(value="enum_form_string", required=false) String enumFormString,@ApiParam(value = "Header parameter enum test (string array)" , allowableValues=">, $") @RequestHeader(value="enum_header_string_array", required=false) List enumHeaderStringArray,@ApiParam(value = "Header parameter enum test (string)" , allowableValues="_abc, -efg, (xyz)", defaultValue="-efg") @RequestHeader(value="enum_header_string", required=false) String enumHeaderString, @ApiParam(value = "Query parameter enum test (string array)", allowableValues = ">, $") @RequestParam(value = "enum_query_string_array", required = false) List enumQueryStringArray, @ApiParam(value = "Query parameter enum test (string)", allowableValues = "_abc, -efg, (xyz)", defaultValue = "-efg") @RequestParam(value = "enum_query_string", required = false, defaultValue="-efg") String enumQueryString, @ApiParam(value = "Query parameter enum test (double)", allowableValues = "1, -2") @RequestParam(value = "enum_query_integer", required = false) Integer enumQueryInteger,@ApiParam(value = "Query parameter enum test (double)", allowableValues="1.1, -1.2") @RequestPart(value="enum_query_double", required=false) Double enumQueryDouble, @RequestHeader("Accept") String accept) { + default ResponseEntity testEnumParameters(@ApiParam(value = "Form parameter enum test (string array)", allowableValues=">, $") @RequestPart(value="enum_form_string_array", required=false) List enumFormStringArray,@ApiParam(value = "Form parameter enum test (string)", allowableValues="_abc, -efg, (xyz)", defaultValue="-efg") @RequestPart(value="enum_form_string", required=false) String enumFormString,@ApiParam(value = "Header parameter enum test (string array)" , allowableValues=">, $") @RequestHeader(value="enum_header_string_array", required=false) List enumHeaderStringArray,@ApiParam(value = "Header parameter enum test (string)" , allowableValues="_abc, -efg, (xyz)", defaultValue="-efg") @RequestHeader(value="enum_header_string", required=false) String enumHeaderString,@ApiParam(value = "Query parameter enum test (string array)", allowableValues = ">, $") @RequestParam(value = "enum_query_string_array", required = false) List enumQueryStringArray,@ApiParam(value = "Query parameter enum test (string)", allowableValues = "_abc, -efg, (xyz)", defaultValue = "-efg") @RequestParam(value = "enum_query_string", required = false, defaultValue="-efg") String enumQueryString,@ApiParam(value = "Query parameter enum test (double)", allowableValues = "1, -2") @RequestParam(value = "enum_query_integer", required = false) Integer enumQueryInteger,@ApiParam(value = "Query parameter enum test (double)", allowableValues="1.1, -1.2") @RequestPart(value="enum_query_double", required=false) Double enumQueryDouble, @RequestHeader("Accept") String accept) { // do some magic! return new ResponseEntity(HttpStatus.OK); } diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/api/FakeApiController.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/api/FakeApiController.java index 4235dd3c354..88e3598e353 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/api/FakeApiController.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/api/FakeApiController.java @@ -62,9 +62,9 @@ public class FakeApiController implements FakeApi { @ApiParam(value = "Form parameter enum test (string)", allowableValues="_abc, -efg, (xyz)", defaultValue="-efg") @RequestPart(value="enum_form_string", required=false) String enumFormString, @ApiParam(value = "Header parameter enum test (string array)" , allowableValues=">, $") @RequestHeader(value="enum_header_string_array", required=false) List enumHeaderStringArray, @ApiParam(value = "Header parameter enum test (string)" , allowableValues="_abc, -efg, (xyz)", defaultValue="-efg") @RequestHeader(value="enum_header_string", required=false) String enumHeaderString, - @ApiParam(value = "Query parameter enum test (string array)", allowableValues = ">, $") @RequestParam(value = "enum_query_string_array", required = false) List enumQueryStringArray, - @ApiParam(value = "Query parameter enum test (string)", allowableValues = "_abc, -efg, (xyz)", defaultValue = "-efg") @RequestParam(value = "enum_query_string", required = false, defaultValue="-efg") String enumQueryString, - @ApiParam(value = "Query parameter enum test (double)", allowableValues = "1, -2") @RequestParam(value = "enum_query_integer", required = false) Integer enumQueryInteger, + @ApiParam(value = "Query parameter enum test (string array)", allowableValues = ">, $") @RequestParam(value = "enum_query_string_array", required = false) List enumQueryStringArray, + @ApiParam(value = "Query parameter enum test (string)", allowableValues = "_abc, -efg, (xyz)", defaultValue = "-efg") @RequestParam(value = "enum_query_string", required = false, defaultValue="-efg") String enumQueryString, + @ApiParam(value = "Query parameter enum test (double)", allowableValues = "1, -2") @RequestParam(value = "enum_query_integer", required = false) Integer enumQueryInteger, @ApiParam(value = "Query parameter enum test (double)", allowableValues="1.1, -1.2") @RequestPart(value="enum_query_double", required=false) Double enumQueryDouble, @RequestHeader("Accept") String accept) { // do some magic! diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/api/PetApi.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/api/PetApi.java index ee2d7ec0d4d..d9dc4d87b26 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/api/PetApi.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/api/PetApi.java @@ -71,7 +71,7 @@ public interface PetApi { @RequestMapping(value = "/pet/findByStatus", produces = { "application/xml", "application/json" }, method = RequestMethod.GET) - default ResponseEntity> findPetsByStatus( @NotNull @ApiParam(value = "Status values that need to be considered for filter", required = true, allowableValues = "available, pending, sold") @RequestParam(value = "status", required = true) List status, @RequestHeader("Accept") String accept) throws IOException { + default 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, @RequestHeader("Accept") String accept) throws IOException { // do some magic! return new ResponseEntity>(HttpStatus.OK); } @@ -89,7 +89,7 @@ public interface PetApi { @RequestMapping(value = "/pet/findByTags", produces = { "application/xml", "application/json" }, method = RequestMethod.GET) - default ResponseEntity> findPetsByTags( @NotNull @ApiParam(value = "Tags to filter by", required = true) @RequestParam(value = "tags", required = true) List tags, @RequestHeader("Accept") String accept) throws IOException { + default ResponseEntity> findPetsByTags( @NotNull@ApiParam(value = "Tags to filter by", required = true) @RequestParam(value = "tags", required = true) List tags, @RequestHeader("Accept") String accept) throws IOException { // do some magic! return new ResponseEntity>(HttpStatus.OK); } diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/api/PetApiController.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/api/PetApiController.java index fc90db0b3da..878e12f1aff 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/api/PetApiController.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/api/PetApiController.java @@ -45,13 +45,13 @@ public class PetApiController implements PetApi { return delegate.deletePet(petId, apiKey); } - 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, + 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, @RequestHeader("Accept") String accept) throws IOException { // do some magic! return delegate.findPetsByStatus(status); } - public ResponseEntity> findPetsByTags( @NotNull @ApiParam(value = "Tags to filter by", required = true) @RequestParam(value = "tags", required = true) List tags, + public ResponseEntity> findPetsByTags( @NotNull@ApiParam(value = "Tags to filter by", required = true) @RequestParam(value = "tags", required = true) List tags, @RequestHeader("Accept") String accept) throws IOException { // do some magic! return delegate.findPetsByTags(tags); diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/api/UserApi.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/api/UserApi.java index d840f8ef591..6642dec5ecf 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/api/UserApi.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/api/UserApi.java @@ -93,7 +93,7 @@ public interface UserApi { @RequestMapping(value = "/user/login", produces = { "application/xml", "application/json" }, method = RequestMethod.GET) - default ResponseEntity loginUser( @NotNull @ApiParam(value = "The user name for login", required = true) @RequestParam(value = "username", required = true) String username, @NotNull @ApiParam(value = "The password for login in clear text", required = true) @RequestParam(value = "password", required = true) String password, @RequestHeader("Accept") String accept) throws IOException { + default ResponseEntity loginUser( @NotNull@ApiParam(value = "The user name for login", required = true) @RequestParam(value = "username", required = true) String username, @NotNull@ApiParam(value = "The password for login in clear text", required = true) @RequestParam(value = "password", required = true) String password, @RequestHeader("Accept") String accept) throws IOException { // do some magic! return new ResponseEntity(HttpStatus.OK); } diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/api/UserApiController.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/api/UserApiController.java index 952f6bae678..1b2ac4d2a4a 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/api/UserApiController.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/api/UserApiController.java @@ -61,8 +61,8 @@ public class UserApiController implements UserApi { return delegate.getUserByName(username); } - public ResponseEntity loginUser( @NotNull @ApiParam(value = "The user name for login", required = true) @RequestParam(value = "username", required = true) String username, - @NotNull @ApiParam(value = "The password for login in clear text", required = true) @RequestParam(value = "password", required = true) String password, + public ResponseEntity loginUser( @NotNull@ApiParam(value = "The user name for login", required = true) @RequestParam(value = "username", required = true) String username, + @NotNull@ApiParam(value = "The password for login in clear text", required = true) @RequestParam(value = "password", required = true) String password, @RequestHeader("Accept") String accept) throws IOException { // do some magic! return delegate.loginUser(username, password); diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/AdditionalPropertiesClass.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/AdditionalPropertiesClass.java index f4cfcadae51..80be4236b0d 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/AdditionalPropertiesClass.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/AdditionalPropertiesClass.java @@ -8,7 +8,9 @@ import io.swagger.annotations.ApiModelProperty; import java.util.HashMap; import java.util.List; import java.util.Map; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * AdditionalPropertiesClass */ @@ -38,6 +40,8 @@ public class AdditionalPropertiesClass { * @return mapProperty **/ @ApiModelProperty(value = "") + + @Valid public Map getMapProperty() { return mapProperty; } @@ -64,6 +68,8 @@ public class AdditionalPropertiesClass { * @return mapOfMapProperty **/ @ApiModelProperty(value = "") + + @Valid public Map> getMapOfMapProperty() { return mapOfMapProperty; } diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/Animal.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/Animal.java index a218f0b5542..bc957d1c803 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/Animal.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/Animal.java @@ -7,7 +7,9 @@ import com.fasterxml.jackson.annotation.JsonSubTypes; import com.fasterxml.jackson.annotation.JsonTypeInfo; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * Animal */ @@ -35,6 +37,8 @@ public class Animal { **/ @ApiModelProperty(required = true, value = "") @NotNull + + @Valid public String getClassName() { return className; } @@ -53,6 +57,8 @@ public class Animal { * @return color **/ @ApiModelProperty(value = "") + + @Valid public String getColor() { return color; } diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/AnimalFarm.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/AnimalFarm.java index 33dc04699af..9fa4159f203 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/AnimalFarm.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/AnimalFarm.java @@ -4,7 +4,9 @@ import java.util.Objects; import io.swagger.model.Animal; import java.util.ArrayList; import java.util.List; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * AnimalFarm */ diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/ArrayOfArrayOfNumberOnly.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/ArrayOfArrayOfNumberOnly.java index 8f975d8feda..f9dca7d60b5 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/ArrayOfArrayOfNumberOnly.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/ArrayOfArrayOfNumberOnly.java @@ -8,7 +8,9 @@ import io.swagger.annotations.ApiModelProperty; import java.math.BigDecimal; import java.util.ArrayList; import java.util.List; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * ArrayOfArrayOfNumberOnly */ @@ -35,6 +37,8 @@ public class ArrayOfArrayOfNumberOnly { * @return arrayArrayNumber **/ @ApiModelProperty(value = "") + + @Valid public List> getArrayArrayNumber() { return arrayArrayNumber; } diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/ArrayOfNumberOnly.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/ArrayOfNumberOnly.java index 2c556008554..e9c8a313be0 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/ArrayOfNumberOnly.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/ArrayOfNumberOnly.java @@ -8,7 +8,9 @@ import io.swagger.annotations.ApiModelProperty; import java.math.BigDecimal; import java.util.ArrayList; import java.util.List; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * ArrayOfNumberOnly */ @@ -35,6 +37,8 @@ public class ArrayOfNumberOnly { * @return arrayNumber **/ @ApiModelProperty(value = "") + + @Valid public List getArrayNumber() { return arrayNumber; } diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/ArrayTest.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/ArrayTest.java index 664e319cd35..78c35d3c63a 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/ArrayTest.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/ArrayTest.java @@ -8,7 +8,9 @@ import io.swagger.annotations.ApiModelProperty; import io.swagger.model.ReadOnlyFirst; import java.util.ArrayList; import java.util.List; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * ArrayTest */ @@ -41,6 +43,8 @@ public class ArrayTest { * @return arrayOfString **/ @ApiModelProperty(value = "") + + @Valid public List getArrayOfString() { return arrayOfString; } @@ -67,6 +71,8 @@ public class ArrayTest { * @return arrayArrayOfInteger **/ @ApiModelProperty(value = "") + + @Valid public List> getArrayArrayOfInteger() { return arrayArrayOfInteger; } @@ -93,6 +99,8 @@ public class ArrayTest { * @return arrayArrayOfModel **/ @ApiModelProperty(value = "") + + @Valid public List> getArrayArrayOfModel() { return arrayArrayOfModel; } diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/Capitalization.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/Capitalization.java index d7ad5642ccf..93533c28822 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/Capitalization.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/Capitalization.java @@ -5,7 +5,9 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * Capitalization */ @@ -39,6 +41,8 @@ public class Capitalization { * @return smallCamel **/ @ApiModelProperty(value = "") + + @Valid public String getSmallCamel() { return smallCamel; } @@ -57,6 +61,8 @@ public class Capitalization { * @return capitalCamel **/ @ApiModelProperty(value = "") + + @Valid public String getCapitalCamel() { return capitalCamel; } @@ -75,6 +81,8 @@ public class Capitalization { * @return smallSnake **/ @ApiModelProperty(value = "") + + @Valid public String getSmallSnake() { return smallSnake; } @@ -93,6 +101,8 @@ public class Capitalization { * @return capitalSnake **/ @ApiModelProperty(value = "") + + @Valid public String getCapitalSnake() { return capitalSnake; } @@ -111,6 +121,8 @@ public class Capitalization { * @return scAETHFlowPoints **/ @ApiModelProperty(value = "") + + @Valid public String getScAETHFlowPoints() { return scAETHFlowPoints; } @@ -129,6 +141,8 @@ public class Capitalization { * @return ATT_NAME **/ @ApiModelProperty(value = "Name of the pet ") + + @Valid public String getATTNAME() { return ATT_NAME; } diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/Cat.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/Cat.java index 747e5dc0c7e..edcbc354be6 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/Cat.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/Cat.java @@ -6,7 +6,9 @@ import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import io.swagger.model.Animal; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * Cat */ @@ -25,6 +27,8 @@ public class Cat extends Animal { * @return declawed **/ @ApiModelProperty(value = "") + + @Valid public Boolean getDeclawed() { return declawed; } diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/Category.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/Category.java index 9629da6500e..6dd9cb7a2ad 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/Category.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/Category.java @@ -5,7 +5,9 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * Category */ @@ -27,6 +29,8 @@ public class Category { * @return id **/ @ApiModelProperty(value = "") + + @Valid public Long getId() { return id; } @@ -45,6 +49,8 @@ public class Category { * @return name **/ @ApiModelProperty(value = "") + + @Valid public String getName() { return name; } diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/ClassModel.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/ClassModel.java index d69acffefa8..6a6379f5b60 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/ClassModel.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/ClassModel.java @@ -5,7 +5,9 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * Model for testing model with \"_class\" property */ @@ -25,6 +27,8 @@ public class ClassModel { * @return propertyClass **/ @ApiModelProperty(value = "") + + @Valid public String getPropertyClass() { return propertyClass; } diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/Client.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/Client.java index f9cec5a225e..3b8d16cabf2 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/Client.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/Client.java @@ -5,7 +5,9 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * Client */ @@ -24,6 +26,8 @@ public class Client { * @return client **/ @ApiModelProperty(value = "") + + @Valid public String getClient() { return client; } diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/Dog.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/Dog.java index 9057e840fc3..513131a9fa7 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/Dog.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/Dog.java @@ -6,7 +6,9 @@ import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import io.swagger.model.Animal; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * Dog */ @@ -25,6 +27,8 @@ public class Dog extends Animal { * @return breed **/ @ApiModelProperty(value = "") + + @Valid public String getBreed() { return breed; } diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/EnumArrays.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/EnumArrays.java index f904035e482..bbf4a3036e9 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/EnumArrays.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/EnumArrays.java @@ -8,7 +8,9 @@ import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import java.util.ArrayList; import java.util.List; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * EnumArrays */ @@ -92,6 +94,8 @@ public class EnumArrays { * @return justSymbol **/ @ApiModelProperty(value = "") + + @Valid public JustSymbolEnum getJustSymbol() { return justSymbol; } @@ -118,6 +122,8 @@ public class EnumArrays { * @return arrayEnum **/ @ApiModelProperty(value = "") + + @Valid public List getArrayEnum() { return arrayEnum; } diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/EnumClass.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/EnumClass.java index cdfc0933c3e..4cfbe4b9fcf 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/EnumClass.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/EnumClass.java @@ -2,7 +2,9 @@ package io.swagger.model; import java.util.Objects; import com.fasterxml.jackson.annotation.JsonValue; +import javax.validation.Valid; import javax.validation.constraints.*; + import com.fasterxml.jackson.annotation.JsonCreator; /** diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/EnumTest.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/EnumTest.java index 9f2a0275a6a..c7e4793cdf7 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/EnumTest.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/EnumTest.java @@ -7,7 +7,9 @@ import com.fasterxml.jackson.annotation.JsonValue; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import io.swagger.model.OuterEnum; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * EnumTest */ @@ -130,6 +132,8 @@ public class EnumTest { * @return enumString **/ @ApiModelProperty(value = "") + + @Valid public EnumStringEnum getEnumString() { return enumString; } @@ -148,6 +152,8 @@ public class EnumTest { * @return enumInteger **/ @ApiModelProperty(value = "") + + @Valid public EnumIntegerEnum getEnumInteger() { return enumInteger; } @@ -166,6 +172,8 @@ public class EnumTest { * @return enumNumber **/ @ApiModelProperty(value = "") + + @Valid public EnumNumberEnum getEnumNumber() { return enumNumber; } @@ -184,6 +192,8 @@ public class EnumTest { * @return outerEnum **/ @ApiModelProperty(value = "") + + @Valid public OuterEnum getOuterEnum() { return outerEnum; } diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/FormatTest.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/FormatTest.java index c6d568be7ed..f63a8de2c15 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/FormatTest.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/FormatTest.java @@ -9,7 +9,9 @@ import java.math.BigDecimal; import java.time.LocalDate; import java.time.OffsetDateTime; import java.util.UUID; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * FormatTest */ @@ -66,7 +68,9 @@ public class FormatTest { * @return integer **/ @ApiModelProperty(value = "") - @Min(10) @Max(100) public Integer getInteger() { + @Min(10) @Max(100) + @Valid + public Integer getInteger() { return integer; } @@ -86,7 +90,9 @@ public class FormatTest { * @return int32 **/ @ApiModelProperty(value = "") - @Min(20) @Max(200) public Integer getInt32() { + @Min(20) @Max(200) + @Valid + public Integer getInt32() { return int32; } @@ -104,6 +110,8 @@ public class FormatTest { * @return int64 **/ @ApiModelProperty(value = "") + + @Valid public Long getInt64() { return int64; } @@ -125,7 +133,9 @@ public class FormatTest { **/ @ApiModelProperty(required = true, value = "") @NotNull - @DecimalMin("32.1") @DecimalMax("543.2") public BigDecimal getNumber() { + @DecimalMin("32.1") @DecimalMax("543.2") + @Valid + public BigDecimal getNumber() { return number; } @@ -145,7 +155,9 @@ public class FormatTest { * @return _float **/ @ApiModelProperty(value = "") - @DecimalMin("54.3") @DecimalMax("987.6") public Float getFloat() { + @DecimalMin("54.3") @DecimalMax("987.6") + @Valid + public Float getFloat() { return _float; } @@ -165,7 +177,9 @@ public class FormatTest { * @return _double **/ @ApiModelProperty(value = "") - @DecimalMin("67.8") @DecimalMax("123.4") public Double getDouble() { + @DecimalMin("67.8") @DecimalMax("123.4") + @Valid + public Double getDouble() { return _double; } @@ -183,7 +197,9 @@ public class FormatTest { * @return string **/ @ApiModelProperty(value = "") - @Pattern(regexp="/[a-z]/i") public String getString() { + @Pattern(regexp="/[a-z]/i") + @Valid + public String getString() { return string; } @@ -202,6 +218,8 @@ public class FormatTest { **/ @ApiModelProperty(required = true, value = "") @NotNull + + @Valid public byte[] getByte() { return _byte; } @@ -220,6 +238,8 @@ public class FormatTest { * @return binary **/ @ApiModelProperty(value = "") + + @Valid public byte[] getBinary() { return binary; } @@ -239,6 +259,8 @@ public class FormatTest { **/ @ApiModelProperty(required = true, value = "") @NotNull + + @Valid public LocalDate getDate() { return date; } @@ -257,6 +279,8 @@ public class FormatTest { * @return dateTime **/ @ApiModelProperty(value = "") + + @Valid public OffsetDateTime getDateTime() { return dateTime; } @@ -275,6 +299,8 @@ public class FormatTest { * @return uuid **/ @ApiModelProperty(value = "") + + @Valid public UUID getUuid() { return uuid; } @@ -294,7 +320,9 @@ public class FormatTest { **/ @ApiModelProperty(required = true, value = "") @NotNull - @Size(min=10,max=64) public String getPassword() { + @Size(min=10,max=64) + @Valid + public String getPassword() { return password; } diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/HasOnlyReadOnly.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/HasOnlyReadOnly.java index a26492e4912..0f8b608e261 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/HasOnlyReadOnly.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/HasOnlyReadOnly.java @@ -5,7 +5,9 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * HasOnlyReadOnly */ @@ -27,6 +29,8 @@ public class HasOnlyReadOnly { * @return bar **/ @ApiModelProperty(readOnly = true, value = "") + + @Valid public String getBar() { return bar; } @@ -45,6 +49,8 @@ public class HasOnlyReadOnly { * @return foo **/ @ApiModelProperty(readOnly = true, value = "") + + @Valid public String getFoo() { return foo; } diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/MapTest.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/MapTest.java index 434c3a8f1b5..1530a53f53f 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/MapTest.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/MapTest.java @@ -9,7 +9,9 @@ import io.swagger.annotations.ApiModelProperty; import java.util.HashMap; import java.util.List; import java.util.Map; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * MapTest */ @@ -70,6 +72,8 @@ public class MapTest { * @return mapMapOfString **/ @ApiModelProperty(value = "") + + @Valid public Map> getMapMapOfString() { return mapMapOfString; } @@ -96,6 +100,8 @@ public class MapTest { * @return mapOfEnumString **/ @ApiModelProperty(value = "") + + @Valid public Map getMapOfEnumString() { return mapOfEnumString; } diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/MixedPropertiesAndAdditionalPropertiesClass.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/MixedPropertiesAndAdditionalPropertiesClass.java index 727205e40f9..eafbcb4ecb8 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/MixedPropertiesAndAdditionalPropertiesClass.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/MixedPropertiesAndAdditionalPropertiesClass.java @@ -11,7 +11,9 @@ import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.UUID; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * MixedPropertiesAndAdditionalPropertiesClass */ @@ -36,6 +38,8 @@ public class MixedPropertiesAndAdditionalPropertiesClass { * @return uuid **/ @ApiModelProperty(value = "") + + @Valid public UUID getUuid() { return uuid; } @@ -54,6 +58,8 @@ public class MixedPropertiesAndAdditionalPropertiesClass { * @return dateTime **/ @ApiModelProperty(value = "") + + @Valid public OffsetDateTime getDateTime() { return dateTime; } @@ -80,6 +86,8 @@ public class MixedPropertiesAndAdditionalPropertiesClass { * @return map **/ @ApiModelProperty(value = "") + + @Valid public Map getMap() { return map; } diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/Model200Response.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/Model200Response.java index 4d47f6c03c9..97349fef05c 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/Model200Response.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/Model200Response.java @@ -5,7 +5,9 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * Model for testing model name starting with number */ @@ -28,6 +30,8 @@ public class Model200Response { * @return name **/ @ApiModelProperty(value = "") + + @Valid public Integer getName() { return name; } @@ -46,6 +50,8 @@ public class Model200Response { * @return propertyClass **/ @ApiModelProperty(value = "") + + @Valid public String getPropertyClass() { return propertyClass; } diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/ModelApiResponse.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/ModelApiResponse.java index 36da9b20d9d..c8882b3b1e2 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/ModelApiResponse.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/ModelApiResponse.java @@ -5,7 +5,9 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * ModelApiResponse */ @@ -30,6 +32,8 @@ public class ModelApiResponse { * @return code **/ @ApiModelProperty(value = "") + + @Valid public Integer getCode() { return code; } @@ -48,6 +52,8 @@ public class ModelApiResponse { * @return type **/ @ApiModelProperty(value = "") + + @Valid public String getType() { return type; } @@ -66,6 +72,8 @@ public class ModelApiResponse { * @return message **/ @ApiModelProperty(value = "") + + @Valid public String getMessage() { return message; } diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/ModelReturn.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/ModelReturn.java index 7ffc24a0144..7018d7de09c 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/ModelReturn.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/ModelReturn.java @@ -5,7 +5,9 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * Model for testing reserved words */ @@ -25,6 +27,8 @@ public class ModelReturn { * @return _return **/ @ApiModelProperty(value = "") + + @Valid public Integer getReturn() { return _return; } diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/Name.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/Name.java index 953199166ff..46069fdd14b 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/Name.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/Name.java @@ -5,7 +5,9 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * Model for testing model name same as property name */ @@ -35,6 +37,8 @@ public class Name { **/ @ApiModelProperty(required = true, value = "") @NotNull + + @Valid public Integer getName() { return name; } @@ -53,6 +57,8 @@ public class Name { * @return snakeCase **/ @ApiModelProperty(readOnly = true, value = "") + + @Valid public Integer getSnakeCase() { return snakeCase; } @@ -71,6 +77,8 @@ public class Name { * @return property **/ @ApiModelProperty(value = "") + + @Valid public String getProperty() { return property; } @@ -89,6 +97,8 @@ public class Name { * @return _123Number **/ @ApiModelProperty(readOnly = true, value = "") + + @Valid public Integer get123Number() { return _123Number; } diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/NumberOnly.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/NumberOnly.java index e6dbf3139e2..e243ecb429b 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/NumberOnly.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/NumberOnly.java @@ -6,7 +6,9 @@ import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import java.math.BigDecimal; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * NumberOnly */ @@ -25,6 +27,8 @@ public class NumberOnly { * @return justNumber **/ @ApiModelProperty(value = "") + + @Valid public BigDecimal getJustNumber() { return justNumber; } diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/Order.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/Order.java index d65ed713151..e1a5d94cc8f 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/Order.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/Order.java @@ -7,7 +7,9 @@ import com.fasterxml.jackson.annotation.JsonValue; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import java.time.OffsetDateTime; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * Order */ @@ -74,6 +76,8 @@ public class Order { * @return id **/ @ApiModelProperty(value = "") + + @Valid public Long getId() { return id; } @@ -92,6 +96,8 @@ public class Order { * @return petId **/ @ApiModelProperty(value = "") + + @Valid public Long getPetId() { return petId; } @@ -110,6 +116,8 @@ public class Order { * @return quantity **/ @ApiModelProperty(value = "") + + @Valid public Integer getQuantity() { return quantity; } @@ -128,6 +136,8 @@ public class Order { * @return shipDate **/ @ApiModelProperty(value = "") + + @Valid public OffsetDateTime getShipDate() { return shipDate; } @@ -146,6 +156,8 @@ public class Order { * @return status **/ @ApiModelProperty(value = "Order Status") + + @Valid public StatusEnum getStatus() { return status; } @@ -164,6 +176,8 @@ public class Order { * @return complete **/ @ApiModelProperty(value = "") + + @Valid public Boolean getComplete() { return complete; } diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/OuterEnum.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/OuterEnum.java index 5f0075e4457..f3c6d31fb86 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/OuterEnum.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/OuterEnum.java @@ -2,7 +2,9 @@ package io.swagger.model; import java.util.Objects; import com.fasterxml.jackson.annotation.JsonValue; +import javax.validation.Valid; import javax.validation.constraints.*; + import com.fasterxml.jackson.annotation.JsonCreator; /** diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/Pet.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/Pet.java index b013846b4d6..c84687b699f 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/Pet.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/Pet.java @@ -10,7 +10,9 @@ import io.swagger.model.Category; import io.swagger.model.Tag; import java.util.ArrayList; import java.util.List; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * Pet */ @@ -77,6 +79,8 @@ public class Pet { * @return id **/ @ApiModelProperty(value = "") + + @Valid public Long getId() { return id; } @@ -95,6 +99,8 @@ public class Pet { * @return category **/ @ApiModelProperty(value = "") + + @Valid public Category getCategory() { return category; } @@ -114,6 +120,8 @@ public class Pet { **/ @ApiModelProperty(example = "doggie", required = true, value = "") @NotNull + + @Valid public String getName() { return name; } @@ -138,6 +146,8 @@ public class Pet { **/ @ApiModelProperty(required = true, value = "") @NotNull + + @Valid public List getPhotoUrls() { return photoUrls; } @@ -164,6 +174,8 @@ public class Pet { * @return tags **/ @ApiModelProperty(value = "") + + @Valid public List getTags() { return tags; } @@ -182,6 +194,8 @@ public class Pet { * @return status **/ @ApiModelProperty(value = "pet status in the store") + + @Valid public StatusEnum getStatus() { return status; } diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/ReadOnlyFirst.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/ReadOnlyFirst.java index 47700659fd2..8e79be0008d 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/ReadOnlyFirst.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/ReadOnlyFirst.java @@ -5,7 +5,9 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * ReadOnlyFirst */ @@ -27,6 +29,8 @@ public class ReadOnlyFirst { * @return bar **/ @ApiModelProperty(readOnly = true, value = "") + + @Valid public String getBar() { return bar; } @@ -45,6 +49,8 @@ public class ReadOnlyFirst { * @return baz **/ @ApiModelProperty(value = "") + + @Valid public String getBaz() { return baz; } diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/SpecialModelName.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/SpecialModelName.java index 880d70599b0..3cb7b04353c 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/SpecialModelName.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/SpecialModelName.java @@ -5,7 +5,9 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * SpecialModelName */ @@ -24,6 +26,8 @@ public class SpecialModelName { * @return specialPropertyName **/ @ApiModelProperty(value = "") + + @Valid public Long getSpecialPropertyName() { return specialPropertyName; } diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/Tag.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/Tag.java index 298085317a4..9f8f3a25234 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/Tag.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/Tag.java @@ -5,7 +5,9 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * Tag */ @@ -27,6 +29,8 @@ public class Tag { * @return id **/ @ApiModelProperty(value = "") + + @Valid public Long getId() { return id; } @@ -45,6 +49,8 @@ public class Tag { * @return name **/ @ApiModelProperty(value = "") + + @Valid public String getName() { return name; } diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/User.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/User.java index 8e40f7e0594..501c556de27 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/User.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/User.java @@ -5,7 +5,9 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * User */ @@ -45,6 +47,8 @@ public class User { * @return id **/ @ApiModelProperty(value = "") + + @Valid public Long getId() { return id; } @@ -63,6 +67,8 @@ public class User { * @return username **/ @ApiModelProperty(value = "") + + @Valid public String getUsername() { return username; } @@ -81,6 +87,8 @@ public class User { * @return firstName **/ @ApiModelProperty(value = "") + + @Valid public String getFirstName() { return firstName; } @@ -99,6 +107,8 @@ public class User { * @return lastName **/ @ApiModelProperty(value = "") + + @Valid public String getLastName() { return lastName; } @@ -117,6 +127,8 @@ public class User { * @return email **/ @ApiModelProperty(value = "") + + @Valid public String getEmail() { return email; } @@ -135,6 +147,8 @@ public class User { * @return password **/ @ApiModelProperty(value = "") + + @Valid public String getPassword() { return password; } @@ -153,6 +167,8 @@ public class User { * @return phone **/ @ApiModelProperty(value = "") + + @Valid public String getPhone() { return phone; } @@ -171,6 +187,8 @@ public class User { * @return userStatus **/ @ApiModelProperty(value = "User Status") + + @Valid public Integer getUserStatus() { return userStatus; } diff --git a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/api/FakeApi.java b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/api/FakeApi.java index 890a18bec96..f6093ba101c 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/api/FakeApi.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/api/FakeApi.java @@ -55,6 +55,6 @@ public interface FakeApi { produces = { "*/*" }, consumes = { "*/*" }, method = RequestMethod.GET) - ResponseEntity testEnumParameters(@ApiParam(value = "Form parameter enum test (string array)", allowableValues=">, $") @RequestPart(value="enum_form_string_array", required=false) List enumFormStringArray,@ApiParam(value = "Form parameter enum test (string)", allowableValues="_abc, -efg, (xyz)", defaultValue="-efg") @RequestPart(value="enum_form_string", required=false) String enumFormString,@ApiParam(value = "Header parameter enum test (string array)" , allowableValues=">, $") @RequestHeader(value="enum_header_string_array", required=false) List enumHeaderStringArray,@ApiParam(value = "Header parameter enum test (string)" , allowableValues="_abc, -efg, (xyz)", defaultValue="-efg") @RequestHeader(value="enum_header_string", required=false) String enumHeaderString, @ApiParam(value = "Query parameter enum test (string array)", allowableValues = ">, $") @RequestParam(value = "enum_query_string_array", required = false) List enumQueryStringArray, @ApiParam(value = "Query parameter enum test (string)", allowableValues = "_abc, -efg, (xyz)", defaultValue = "-efg") @RequestParam(value = "enum_query_string", required = false, defaultValue="-efg") String enumQueryString, @ApiParam(value = "Query parameter enum test (double)", allowableValues = "1, -2") @RequestParam(value = "enum_query_integer", required = false) Integer enumQueryInteger,@ApiParam(value = "Query parameter enum test (double)", allowableValues="1.1, -1.2") @RequestPart(value="enum_query_double", required=false) Double enumQueryDouble, @RequestHeader("Accept") String accept); + ResponseEntity testEnumParameters(@ApiParam(value = "Form parameter enum test (string array)", allowableValues=">, $") @RequestPart(value="enum_form_string_array", required=false) List enumFormStringArray,@ApiParam(value = "Form parameter enum test (string)", allowableValues="_abc, -efg, (xyz)", defaultValue="-efg") @RequestPart(value="enum_form_string", required=false) String enumFormString,@ApiParam(value = "Header parameter enum test (string array)" , allowableValues=">, $") @RequestHeader(value="enum_header_string_array", required=false) List enumHeaderStringArray,@ApiParam(value = "Header parameter enum test (string)" , allowableValues="_abc, -efg, (xyz)", defaultValue="-efg") @RequestHeader(value="enum_header_string", required=false) String enumHeaderString,@ApiParam(value = "Query parameter enum test (string array)", allowableValues = ">, $") @RequestParam(value = "enum_query_string_array", required = false) List enumQueryStringArray,@ApiParam(value = "Query parameter enum test (string)", allowableValues = "_abc, -efg, (xyz)", defaultValue = "-efg") @RequestParam(value = "enum_query_string", required = false, defaultValue="-efg") String enumQueryString,@ApiParam(value = "Query parameter enum test (double)", allowableValues = "1, -2") @RequestParam(value = "enum_query_integer", required = false) Integer enumQueryInteger,@ApiParam(value = "Query parameter enum test (double)", allowableValues="1.1, -1.2") @RequestPart(value="enum_query_double", required=false) Double enumQueryDouble, @RequestHeader("Accept") String accept); } diff --git a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/api/FakeApiController.java b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/api/FakeApiController.java index 7cebf02df47..c0ef70d6575 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/api/FakeApiController.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/api/FakeApiController.java @@ -62,9 +62,9 @@ public class FakeApiController implements FakeApi { @ApiParam(value = "Form parameter enum test (string)", allowableValues="_abc, -efg, (xyz)", defaultValue="-efg") @RequestPart(value="enum_form_string", required=false) String enumFormString, @ApiParam(value = "Header parameter enum test (string array)" , allowableValues=">, $") @RequestHeader(value="enum_header_string_array", required=false) List enumHeaderStringArray, @ApiParam(value = "Header parameter enum test (string)" , allowableValues="_abc, -efg, (xyz)", defaultValue="-efg") @RequestHeader(value="enum_header_string", required=false) String enumHeaderString, - @ApiParam(value = "Query parameter enum test (string array)", allowableValues = ">, $") @RequestParam(value = "enum_query_string_array", required = false) List enumQueryStringArray, - @ApiParam(value = "Query parameter enum test (string)", allowableValues = "_abc, -efg, (xyz)", defaultValue = "-efg") @RequestParam(value = "enum_query_string", required = false, defaultValue="-efg") String enumQueryString, - @ApiParam(value = "Query parameter enum test (double)", allowableValues = "1, -2") @RequestParam(value = "enum_query_integer", required = false) Integer enumQueryInteger, + @ApiParam(value = "Query parameter enum test (string array)", allowableValues = ">, $") @RequestParam(value = "enum_query_string_array", required = false) List enumQueryStringArray, + @ApiParam(value = "Query parameter enum test (string)", allowableValues = "_abc, -efg, (xyz)", defaultValue = "-efg") @RequestParam(value = "enum_query_string", required = false, defaultValue="-efg") String enumQueryString, + @ApiParam(value = "Query parameter enum test (double)", allowableValues = "1, -2") @RequestParam(value = "enum_query_integer", required = false) Integer enumQueryInteger, @ApiParam(value = "Query parameter enum test (double)", allowableValues="1.1, -1.2") @RequestPart(value="enum_query_double", required=false) Double enumQueryDouble, @RequestHeader("Accept") String accept) { // do some magic! diff --git a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/api/PetApi.java b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/api/PetApi.java index 5816fb5b92e..1227aedbbd7 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/api/PetApi.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/api/PetApi.java @@ -64,7 +64,7 @@ public interface PetApi { @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, @RequestHeader("Accept") String accept) throws IOException; + 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, @RequestHeader("Accept") String accept) throws IOException; @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 = { @@ -79,7 +79,7 @@ public interface PetApi { @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, @RequestHeader("Accept") String accept) throws IOException; + ResponseEntity> findPetsByTags( @NotNull@ApiParam(value = "Tags to filter by", required = true) @RequestParam(value = "tags", required = true) List tags, @RequestHeader("Accept") String accept) throws IOException; @ApiOperation(value = "Find pet by ID", notes = "Returns a single pet", response = Pet.class, authorizations = { diff --git a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/api/PetApiController.java b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/api/PetApiController.java index fc90db0b3da..878e12f1aff 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/api/PetApiController.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/api/PetApiController.java @@ -45,13 +45,13 @@ public class PetApiController implements PetApi { return delegate.deletePet(petId, apiKey); } - 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, + 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, @RequestHeader("Accept") String accept) throws IOException { // do some magic! return delegate.findPetsByStatus(status); } - public ResponseEntity> findPetsByTags( @NotNull @ApiParam(value = "Tags to filter by", required = true) @RequestParam(value = "tags", required = true) List tags, + public ResponseEntity> findPetsByTags( @NotNull@ApiParam(value = "Tags to filter by", required = true) @RequestParam(value = "tags", required = true) List tags, @RequestHeader("Accept") String accept) throws IOException { // do some magic! return delegate.findPetsByTags(tags); diff --git a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/api/UserApi.java b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/api/UserApi.java index 53899d1eddd..adc0d21d30b 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/api/UserApi.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/api/UserApi.java @@ -77,7 +77,7 @@ public interface UserApi { @RequestMapping(value = "/user/login", produces = { "application/xml", "application/json" }, method = RequestMethod.GET) - ResponseEntity loginUser( @NotNull @ApiParam(value = "The user name for login", required = true) @RequestParam(value = "username", required = true) String username, @NotNull @ApiParam(value = "The password for login in clear text", required = true) @RequestParam(value = "password", required = true) String password, @RequestHeader("Accept") String accept) throws IOException; + ResponseEntity loginUser( @NotNull@ApiParam(value = "The user name for login", required = true) @RequestParam(value = "username", required = true) String username, @NotNull@ApiParam(value = "The password for login in clear text", required = true) @RequestParam(value = "password", required = true) String password, @RequestHeader("Accept") String accept) throws IOException; @ApiOperation(value = "Logs out current logged in user session", notes = "", response = Void.class, tags={ "user", }) diff --git a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/api/UserApiController.java b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/api/UserApiController.java index 952f6bae678..1b2ac4d2a4a 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/api/UserApiController.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/api/UserApiController.java @@ -61,8 +61,8 @@ public class UserApiController implements UserApi { return delegate.getUserByName(username); } - public ResponseEntity loginUser( @NotNull @ApiParam(value = "The user name for login", required = true) @RequestParam(value = "username", required = true) String username, - @NotNull @ApiParam(value = "The password for login in clear text", required = true) @RequestParam(value = "password", required = true) String password, + public ResponseEntity loginUser( @NotNull@ApiParam(value = "The user name for login", required = true) @RequestParam(value = "username", required = true) String username, + @NotNull@ApiParam(value = "The password for login in clear text", required = true) @RequestParam(value = "password", required = true) String password, @RequestHeader("Accept") String accept) throws IOException { // do some magic! return delegate.loginUser(username, password); diff --git a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/AdditionalPropertiesClass.java b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/AdditionalPropertiesClass.java index f4cfcadae51..80be4236b0d 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/AdditionalPropertiesClass.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/AdditionalPropertiesClass.java @@ -8,7 +8,9 @@ import io.swagger.annotations.ApiModelProperty; import java.util.HashMap; import java.util.List; import java.util.Map; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * AdditionalPropertiesClass */ @@ -38,6 +40,8 @@ public class AdditionalPropertiesClass { * @return mapProperty **/ @ApiModelProperty(value = "") + + @Valid public Map getMapProperty() { return mapProperty; } @@ -64,6 +68,8 @@ public class AdditionalPropertiesClass { * @return mapOfMapProperty **/ @ApiModelProperty(value = "") + + @Valid public Map> getMapOfMapProperty() { return mapOfMapProperty; } diff --git a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/Animal.java b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/Animal.java index a218f0b5542..bc957d1c803 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/Animal.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/Animal.java @@ -7,7 +7,9 @@ import com.fasterxml.jackson.annotation.JsonSubTypes; import com.fasterxml.jackson.annotation.JsonTypeInfo; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * Animal */ @@ -35,6 +37,8 @@ public class Animal { **/ @ApiModelProperty(required = true, value = "") @NotNull + + @Valid public String getClassName() { return className; } @@ -53,6 +57,8 @@ public class Animal { * @return color **/ @ApiModelProperty(value = "") + + @Valid public String getColor() { return color; } diff --git a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/AnimalFarm.java b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/AnimalFarm.java index 33dc04699af..9fa4159f203 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/AnimalFarm.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/AnimalFarm.java @@ -4,7 +4,9 @@ import java.util.Objects; import io.swagger.model.Animal; import java.util.ArrayList; import java.util.List; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * AnimalFarm */ diff --git a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/ArrayOfArrayOfNumberOnly.java b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/ArrayOfArrayOfNumberOnly.java index 8f975d8feda..f9dca7d60b5 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/ArrayOfArrayOfNumberOnly.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/ArrayOfArrayOfNumberOnly.java @@ -8,7 +8,9 @@ import io.swagger.annotations.ApiModelProperty; import java.math.BigDecimal; import java.util.ArrayList; import java.util.List; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * ArrayOfArrayOfNumberOnly */ @@ -35,6 +37,8 @@ public class ArrayOfArrayOfNumberOnly { * @return arrayArrayNumber **/ @ApiModelProperty(value = "") + + @Valid public List> getArrayArrayNumber() { return arrayArrayNumber; } diff --git a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/ArrayOfNumberOnly.java b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/ArrayOfNumberOnly.java index 2c556008554..e9c8a313be0 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/ArrayOfNumberOnly.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/ArrayOfNumberOnly.java @@ -8,7 +8,9 @@ import io.swagger.annotations.ApiModelProperty; import java.math.BigDecimal; import java.util.ArrayList; import java.util.List; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * ArrayOfNumberOnly */ @@ -35,6 +37,8 @@ public class ArrayOfNumberOnly { * @return arrayNumber **/ @ApiModelProperty(value = "") + + @Valid public List getArrayNumber() { return arrayNumber; } diff --git a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/ArrayTest.java b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/ArrayTest.java index 664e319cd35..78c35d3c63a 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/ArrayTest.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/ArrayTest.java @@ -8,7 +8,9 @@ import io.swagger.annotations.ApiModelProperty; import io.swagger.model.ReadOnlyFirst; import java.util.ArrayList; import java.util.List; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * ArrayTest */ @@ -41,6 +43,8 @@ public class ArrayTest { * @return arrayOfString **/ @ApiModelProperty(value = "") + + @Valid public List getArrayOfString() { return arrayOfString; } @@ -67,6 +71,8 @@ public class ArrayTest { * @return arrayArrayOfInteger **/ @ApiModelProperty(value = "") + + @Valid public List> getArrayArrayOfInteger() { return arrayArrayOfInteger; } @@ -93,6 +99,8 @@ public class ArrayTest { * @return arrayArrayOfModel **/ @ApiModelProperty(value = "") + + @Valid public List> getArrayArrayOfModel() { return arrayArrayOfModel; } diff --git a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/Capitalization.java b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/Capitalization.java index d7ad5642ccf..93533c28822 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/Capitalization.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/Capitalization.java @@ -5,7 +5,9 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * Capitalization */ @@ -39,6 +41,8 @@ public class Capitalization { * @return smallCamel **/ @ApiModelProperty(value = "") + + @Valid public String getSmallCamel() { return smallCamel; } @@ -57,6 +61,8 @@ public class Capitalization { * @return capitalCamel **/ @ApiModelProperty(value = "") + + @Valid public String getCapitalCamel() { return capitalCamel; } @@ -75,6 +81,8 @@ public class Capitalization { * @return smallSnake **/ @ApiModelProperty(value = "") + + @Valid public String getSmallSnake() { return smallSnake; } @@ -93,6 +101,8 @@ public class Capitalization { * @return capitalSnake **/ @ApiModelProperty(value = "") + + @Valid public String getCapitalSnake() { return capitalSnake; } @@ -111,6 +121,8 @@ public class Capitalization { * @return scAETHFlowPoints **/ @ApiModelProperty(value = "") + + @Valid public String getScAETHFlowPoints() { return scAETHFlowPoints; } @@ -129,6 +141,8 @@ public class Capitalization { * @return ATT_NAME **/ @ApiModelProperty(value = "Name of the pet ") + + @Valid public String getATTNAME() { return ATT_NAME; } diff --git a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/Cat.java b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/Cat.java index 747e5dc0c7e..edcbc354be6 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/Cat.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/Cat.java @@ -6,7 +6,9 @@ import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import io.swagger.model.Animal; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * Cat */ @@ -25,6 +27,8 @@ public class Cat extends Animal { * @return declawed **/ @ApiModelProperty(value = "") + + @Valid public Boolean getDeclawed() { return declawed; } diff --git a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/Category.java b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/Category.java index 9629da6500e..6dd9cb7a2ad 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/Category.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/Category.java @@ -5,7 +5,9 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * Category */ @@ -27,6 +29,8 @@ public class Category { * @return id **/ @ApiModelProperty(value = "") + + @Valid public Long getId() { return id; } @@ -45,6 +49,8 @@ public class Category { * @return name **/ @ApiModelProperty(value = "") + + @Valid public String getName() { return name; } diff --git a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/ClassModel.java b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/ClassModel.java index d69acffefa8..6a6379f5b60 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/ClassModel.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/ClassModel.java @@ -5,7 +5,9 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * Model for testing model with \"_class\" property */ @@ -25,6 +27,8 @@ public class ClassModel { * @return propertyClass **/ @ApiModelProperty(value = "") + + @Valid public String getPropertyClass() { return propertyClass; } diff --git a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/Client.java b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/Client.java index f9cec5a225e..3b8d16cabf2 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/Client.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/Client.java @@ -5,7 +5,9 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * Client */ @@ -24,6 +26,8 @@ public class Client { * @return client **/ @ApiModelProperty(value = "") + + @Valid public String getClient() { return client; } diff --git a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/Dog.java b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/Dog.java index 9057e840fc3..513131a9fa7 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/Dog.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/Dog.java @@ -6,7 +6,9 @@ import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import io.swagger.model.Animal; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * Dog */ @@ -25,6 +27,8 @@ public class Dog extends Animal { * @return breed **/ @ApiModelProperty(value = "") + + @Valid public String getBreed() { return breed; } diff --git a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/EnumArrays.java b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/EnumArrays.java index f904035e482..bbf4a3036e9 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/EnumArrays.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/EnumArrays.java @@ -8,7 +8,9 @@ import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import java.util.ArrayList; import java.util.List; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * EnumArrays */ @@ -92,6 +94,8 @@ public class EnumArrays { * @return justSymbol **/ @ApiModelProperty(value = "") + + @Valid public JustSymbolEnum getJustSymbol() { return justSymbol; } @@ -118,6 +122,8 @@ public class EnumArrays { * @return arrayEnum **/ @ApiModelProperty(value = "") + + @Valid public List getArrayEnum() { return arrayEnum; } diff --git a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/EnumClass.java b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/EnumClass.java index cdfc0933c3e..4cfbe4b9fcf 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/EnumClass.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/EnumClass.java @@ -2,7 +2,9 @@ package io.swagger.model; import java.util.Objects; import com.fasterxml.jackson.annotation.JsonValue; +import javax.validation.Valid; import javax.validation.constraints.*; + import com.fasterxml.jackson.annotation.JsonCreator; /** diff --git a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/EnumTest.java b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/EnumTest.java index 9f2a0275a6a..c7e4793cdf7 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/EnumTest.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/EnumTest.java @@ -7,7 +7,9 @@ import com.fasterxml.jackson.annotation.JsonValue; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import io.swagger.model.OuterEnum; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * EnumTest */ @@ -130,6 +132,8 @@ public class EnumTest { * @return enumString **/ @ApiModelProperty(value = "") + + @Valid public EnumStringEnum getEnumString() { return enumString; } @@ -148,6 +152,8 @@ public class EnumTest { * @return enumInteger **/ @ApiModelProperty(value = "") + + @Valid public EnumIntegerEnum getEnumInteger() { return enumInteger; } @@ -166,6 +172,8 @@ public class EnumTest { * @return enumNumber **/ @ApiModelProperty(value = "") + + @Valid public EnumNumberEnum getEnumNumber() { return enumNumber; } @@ -184,6 +192,8 @@ public class EnumTest { * @return outerEnum **/ @ApiModelProperty(value = "") + + @Valid public OuterEnum getOuterEnum() { return outerEnum; } diff --git a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/FormatTest.java b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/FormatTest.java index 0f144806e9e..2aaa5179f61 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/FormatTest.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/FormatTest.java @@ -9,7 +9,9 @@ import java.math.BigDecimal; import java.util.UUID; import org.threeten.bp.LocalDate; import org.threeten.bp.OffsetDateTime; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * FormatTest */ @@ -66,7 +68,9 @@ public class FormatTest { * @return integer **/ @ApiModelProperty(value = "") - @Min(10) @Max(100) public Integer getInteger() { + @Min(10) @Max(100) + @Valid + public Integer getInteger() { return integer; } @@ -86,7 +90,9 @@ public class FormatTest { * @return int32 **/ @ApiModelProperty(value = "") - @Min(20) @Max(200) public Integer getInt32() { + @Min(20) @Max(200) + @Valid + public Integer getInt32() { return int32; } @@ -104,6 +110,8 @@ public class FormatTest { * @return int64 **/ @ApiModelProperty(value = "") + + @Valid public Long getInt64() { return int64; } @@ -125,7 +133,9 @@ public class FormatTest { **/ @ApiModelProperty(required = true, value = "") @NotNull - @DecimalMin("32.1") @DecimalMax("543.2") public BigDecimal getNumber() { + @DecimalMin("32.1") @DecimalMax("543.2") + @Valid + public BigDecimal getNumber() { return number; } @@ -145,7 +155,9 @@ public class FormatTest { * @return _float **/ @ApiModelProperty(value = "") - @DecimalMin("54.3") @DecimalMax("987.6") public Float getFloat() { + @DecimalMin("54.3") @DecimalMax("987.6") + @Valid + public Float getFloat() { return _float; } @@ -165,7 +177,9 @@ public class FormatTest { * @return _double **/ @ApiModelProperty(value = "") - @DecimalMin("67.8") @DecimalMax("123.4") public Double getDouble() { + @DecimalMin("67.8") @DecimalMax("123.4") + @Valid + public Double getDouble() { return _double; } @@ -183,7 +197,9 @@ public class FormatTest { * @return string **/ @ApiModelProperty(value = "") - @Pattern(regexp="/[a-z]/i") public String getString() { + @Pattern(regexp="/[a-z]/i") + @Valid + public String getString() { return string; } @@ -202,6 +218,8 @@ public class FormatTest { **/ @ApiModelProperty(required = true, value = "") @NotNull + + @Valid public byte[] getByte() { return _byte; } @@ -220,6 +238,8 @@ public class FormatTest { * @return binary **/ @ApiModelProperty(value = "") + + @Valid public byte[] getBinary() { return binary; } @@ -239,6 +259,8 @@ public class FormatTest { **/ @ApiModelProperty(required = true, value = "") @NotNull + + @Valid public LocalDate getDate() { return date; } @@ -257,6 +279,8 @@ public class FormatTest { * @return dateTime **/ @ApiModelProperty(value = "") + + @Valid public OffsetDateTime getDateTime() { return dateTime; } @@ -275,6 +299,8 @@ public class FormatTest { * @return uuid **/ @ApiModelProperty(value = "") + + @Valid public UUID getUuid() { return uuid; } @@ -294,7 +320,9 @@ public class FormatTest { **/ @ApiModelProperty(required = true, value = "") @NotNull - @Size(min=10,max=64) public String getPassword() { + @Size(min=10,max=64) + @Valid + public String getPassword() { return password; } diff --git a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/HasOnlyReadOnly.java b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/HasOnlyReadOnly.java index a26492e4912..0f8b608e261 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/HasOnlyReadOnly.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/HasOnlyReadOnly.java @@ -5,7 +5,9 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * HasOnlyReadOnly */ @@ -27,6 +29,8 @@ public class HasOnlyReadOnly { * @return bar **/ @ApiModelProperty(readOnly = true, value = "") + + @Valid public String getBar() { return bar; } @@ -45,6 +49,8 @@ public class HasOnlyReadOnly { * @return foo **/ @ApiModelProperty(readOnly = true, value = "") + + @Valid public String getFoo() { return foo; } diff --git a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/MapTest.java b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/MapTest.java index 434c3a8f1b5..1530a53f53f 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/MapTest.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/MapTest.java @@ -9,7 +9,9 @@ import io.swagger.annotations.ApiModelProperty; import java.util.HashMap; import java.util.List; import java.util.Map; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * MapTest */ @@ -70,6 +72,8 @@ public class MapTest { * @return mapMapOfString **/ @ApiModelProperty(value = "") + + @Valid public Map> getMapMapOfString() { return mapMapOfString; } @@ -96,6 +100,8 @@ public class MapTest { * @return mapOfEnumString **/ @ApiModelProperty(value = "") + + @Valid public Map getMapOfEnumString() { return mapOfEnumString; } diff --git a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/MixedPropertiesAndAdditionalPropertiesClass.java b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/MixedPropertiesAndAdditionalPropertiesClass.java index d9f452920f9..21cb67378eb 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/MixedPropertiesAndAdditionalPropertiesClass.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/MixedPropertiesAndAdditionalPropertiesClass.java @@ -11,7 +11,9 @@ import java.util.List; import java.util.Map; import java.util.UUID; import org.threeten.bp.OffsetDateTime; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * MixedPropertiesAndAdditionalPropertiesClass */ @@ -36,6 +38,8 @@ public class MixedPropertiesAndAdditionalPropertiesClass { * @return uuid **/ @ApiModelProperty(value = "") + + @Valid public UUID getUuid() { return uuid; } @@ -54,6 +58,8 @@ public class MixedPropertiesAndAdditionalPropertiesClass { * @return dateTime **/ @ApiModelProperty(value = "") + + @Valid public OffsetDateTime getDateTime() { return dateTime; } @@ -80,6 +86,8 @@ public class MixedPropertiesAndAdditionalPropertiesClass { * @return map **/ @ApiModelProperty(value = "") + + @Valid public Map getMap() { return map; } diff --git a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/Model200Response.java b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/Model200Response.java index 4d47f6c03c9..97349fef05c 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/Model200Response.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/Model200Response.java @@ -5,7 +5,9 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * Model for testing model name starting with number */ @@ -28,6 +30,8 @@ public class Model200Response { * @return name **/ @ApiModelProperty(value = "") + + @Valid public Integer getName() { return name; } @@ -46,6 +50,8 @@ public class Model200Response { * @return propertyClass **/ @ApiModelProperty(value = "") + + @Valid public String getPropertyClass() { return propertyClass; } diff --git a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/ModelApiResponse.java b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/ModelApiResponse.java index 36da9b20d9d..c8882b3b1e2 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/ModelApiResponse.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/ModelApiResponse.java @@ -5,7 +5,9 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * ModelApiResponse */ @@ -30,6 +32,8 @@ public class ModelApiResponse { * @return code **/ @ApiModelProperty(value = "") + + @Valid public Integer getCode() { return code; } @@ -48,6 +52,8 @@ public class ModelApiResponse { * @return type **/ @ApiModelProperty(value = "") + + @Valid public String getType() { return type; } @@ -66,6 +72,8 @@ public class ModelApiResponse { * @return message **/ @ApiModelProperty(value = "") + + @Valid public String getMessage() { return message; } diff --git a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/ModelReturn.java b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/ModelReturn.java index 7ffc24a0144..7018d7de09c 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/ModelReturn.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/ModelReturn.java @@ -5,7 +5,9 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * Model for testing reserved words */ @@ -25,6 +27,8 @@ public class ModelReturn { * @return _return **/ @ApiModelProperty(value = "") + + @Valid public Integer getReturn() { return _return; } diff --git a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/Name.java b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/Name.java index 953199166ff..46069fdd14b 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/Name.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/Name.java @@ -5,7 +5,9 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * Model for testing model name same as property name */ @@ -35,6 +37,8 @@ public class Name { **/ @ApiModelProperty(required = true, value = "") @NotNull + + @Valid public Integer getName() { return name; } @@ -53,6 +57,8 @@ public class Name { * @return snakeCase **/ @ApiModelProperty(readOnly = true, value = "") + + @Valid public Integer getSnakeCase() { return snakeCase; } @@ -71,6 +77,8 @@ public class Name { * @return property **/ @ApiModelProperty(value = "") + + @Valid public String getProperty() { return property; } @@ -89,6 +97,8 @@ public class Name { * @return _123Number **/ @ApiModelProperty(readOnly = true, value = "") + + @Valid public Integer get123Number() { return _123Number; } diff --git a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/NumberOnly.java b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/NumberOnly.java index e6dbf3139e2..e243ecb429b 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/NumberOnly.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/NumberOnly.java @@ -6,7 +6,9 @@ import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import java.math.BigDecimal; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * NumberOnly */ @@ -25,6 +27,8 @@ public class NumberOnly { * @return justNumber **/ @ApiModelProperty(value = "") + + @Valid public BigDecimal getJustNumber() { return justNumber; } diff --git a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/Order.java b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/Order.java index c5381d2fa7e..3ba7e5a0a85 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/Order.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/Order.java @@ -7,7 +7,9 @@ import com.fasterxml.jackson.annotation.JsonValue; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import org.threeten.bp.OffsetDateTime; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * Order */ @@ -74,6 +76,8 @@ public class Order { * @return id **/ @ApiModelProperty(value = "") + + @Valid public Long getId() { return id; } @@ -92,6 +96,8 @@ public class Order { * @return petId **/ @ApiModelProperty(value = "") + + @Valid public Long getPetId() { return petId; } @@ -110,6 +116,8 @@ public class Order { * @return quantity **/ @ApiModelProperty(value = "") + + @Valid public Integer getQuantity() { return quantity; } @@ -128,6 +136,8 @@ public class Order { * @return shipDate **/ @ApiModelProperty(value = "") + + @Valid public OffsetDateTime getShipDate() { return shipDate; } @@ -146,6 +156,8 @@ public class Order { * @return status **/ @ApiModelProperty(value = "Order Status") + + @Valid public StatusEnum getStatus() { return status; } @@ -164,6 +176,8 @@ public class Order { * @return complete **/ @ApiModelProperty(value = "") + + @Valid public Boolean getComplete() { return complete; } diff --git a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/OuterEnum.java b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/OuterEnum.java index 5f0075e4457..f3c6d31fb86 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/OuterEnum.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/OuterEnum.java @@ -2,7 +2,9 @@ package io.swagger.model; import java.util.Objects; import com.fasterxml.jackson.annotation.JsonValue; +import javax.validation.Valid; import javax.validation.constraints.*; + import com.fasterxml.jackson.annotation.JsonCreator; /** diff --git a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/Pet.java b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/Pet.java index b013846b4d6..c84687b699f 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/Pet.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/Pet.java @@ -10,7 +10,9 @@ import io.swagger.model.Category; import io.swagger.model.Tag; import java.util.ArrayList; import java.util.List; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * Pet */ @@ -77,6 +79,8 @@ public class Pet { * @return id **/ @ApiModelProperty(value = "") + + @Valid public Long getId() { return id; } @@ -95,6 +99,8 @@ public class Pet { * @return category **/ @ApiModelProperty(value = "") + + @Valid public Category getCategory() { return category; } @@ -114,6 +120,8 @@ public class Pet { **/ @ApiModelProperty(example = "doggie", required = true, value = "") @NotNull + + @Valid public String getName() { return name; } @@ -138,6 +146,8 @@ public class Pet { **/ @ApiModelProperty(required = true, value = "") @NotNull + + @Valid public List getPhotoUrls() { return photoUrls; } @@ -164,6 +174,8 @@ public class Pet { * @return tags **/ @ApiModelProperty(value = "") + + @Valid public List getTags() { return tags; } @@ -182,6 +194,8 @@ public class Pet { * @return status **/ @ApiModelProperty(value = "pet status in the store") + + @Valid public StatusEnum getStatus() { return status; } diff --git a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/ReadOnlyFirst.java b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/ReadOnlyFirst.java index 47700659fd2..8e79be0008d 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/ReadOnlyFirst.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/ReadOnlyFirst.java @@ -5,7 +5,9 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * ReadOnlyFirst */ @@ -27,6 +29,8 @@ public class ReadOnlyFirst { * @return bar **/ @ApiModelProperty(readOnly = true, value = "") + + @Valid public String getBar() { return bar; } @@ -45,6 +49,8 @@ public class ReadOnlyFirst { * @return baz **/ @ApiModelProperty(value = "") + + @Valid public String getBaz() { return baz; } diff --git a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/SpecialModelName.java b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/SpecialModelName.java index 880d70599b0..3cb7b04353c 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/SpecialModelName.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/SpecialModelName.java @@ -5,7 +5,9 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * SpecialModelName */ @@ -24,6 +26,8 @@ public class SpecialModelName { * @return specialPropertyName **/ @ApiModelProperty(value = "") + + @Valid public Long getSpecialPropertyName() { return specialPropertyName; } diff --git a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/Tag.java b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/Tag.java index 298085317a4..9f8f3a25234 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/Tag.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/Tag.java @@ -5,7 +5,9 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * Tag */ @@ -27,6 +29,8 @@ public class Tag { * @return id **/ @ApiModelProperty(value = "") + + @Valid public Long getId() { return id; } @@ -45,6 +49,8 @@ public class Tag { * @return name **/ @ApiModelProperty(value = "") + + @Valid public String getName() { return name; } diff --git a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/User.java b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/User.java index 8e40f7e0594..501c556de27 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/User.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/User.java @@ -5,7 +5,9 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * User */ @@ -45,6 +47,8 @@ public class User { * @return id **/ @ApiModelProperty(value = "") + + @Valid public Long getId() { return id; } @@ -63,6 +67,8 @@ public class User { * @return username **/ @ApiModelProperty(value = "") + + @Valid public String getUsername() { return username; } @@ -81,6 +87,8 @@ public class User { * @return firstName **/ @ApiModelProperty(value = "") + + @Valid public String getFirstName() { return firstName; } @@ -99,6 +107,8 @@ public class User { * @return lastName **/ @ApiModelProperty(value = "") + + @Valid public String getLastName() { return lastName; } @@ -117,6 +127,8 @@ public class User { * @return email **/ @ApiModelProperty(value = "") + + @Valid public String getEmail() { return email; } @@ -135,6 +147,8 @@ public class User { * @return password **/ @ApiModelProperty(value = "") + + @Valid public String getPassword() { return password; } @@ -153,6 +167,8 @@ public class User { * @return phone **/ @ApiModelProperty(value = "") + + @Valid public String getPhone() { return phone; } @@ -171,6 +187,8 @@ public class User { * @return userStatus **/ @ApiModelProperty(value = "User Status") + + @Valid public Integer getUserStatus() { return userStatus; } diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/api/FakeApi.java b/samples/server/petstore/springboot/src/main/java/io/swagger/api/FakeApi.java index 890a18bec96..f6093ba101c 100644 --- a/samples/server/petstore/springboot/src/main/java/io/swagger/api/FakeApi.java +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/api/FakeApi.java @@ -55,6 +55,6 @@ public interface FakeApi { produces = { "*/*" }, consumes = { "*/*" }, method = RequestMethod.GET) - ResponseEntity testEnumParameters(@ApiParam(value = "Form parameter enum test (string array)", allowableValues=">, $") @RequestPart(value="enum_form_string_array", required=false) List enumFormStringArray,@ApiParam(value = "Form parameter enum test (string)", allowableValues="_abc, -efg, (xyz)", defaultValue="-efg") @RequestPart(value="enum_form_string", required=false) String enumFormString,@ApiParam(value = "Header parameter enum test (string array)" , allowableValues=">, $") @RequestHeader(value="enum_header_string_array", required=false) List enumHeaderStringArray,@ApiParam(value = "Header parameter enum test (string)" , allowableValues="_abc, -efg, (xyz)", defaultValue="-efg") @RequestHeader(value="enum_header_string", required=false) String enumHeaderString, @ApiParam(value = "Query parameter enum test (string array)", allowableValues = ">, $") @RequestParam(value = "enum_query_string_array", required = false) List enumQueryStringArray, @ApiParam(value = "Query parameter enum test (string)", allowableValues = "_abc, -efg, (xyz)", defaultValue = "-efg") @RequestParam(value = "enum_query_string", required = false, defaultValue="-efg") String enumQueryString, @ApiParam(value = "Query parameter enum test (double)", allowableValues = "1, -2") @RequestParam(value = "enum_query_integer", required = false) Integer enumQueryInteger,@ApiParam(value = "Query parameter enum test (double)", allowableValues="1.1, -1.2") @RequestPart(value="enum_query_double", required=false) Double enumQueryDouble, @RequestHeader("Accept") String accept); + ResponseEntity testEnumParameters(@ApiParam(value = "Form parameter enum test (string array)", allowableValues=">, $") @RequestPart(value="enum_form_string_array", required=false) List enumFormStringArray,@ApiParam(value = "Form parameter enum test (string)", allowableValues="_abc, -efg, (xyz)", defaultValue="-efg") @RequestPart(value="enum_form_string", required=false) String enumFormString,@ApiParam(value = "Header parameter enum test (string array)" , allowableValues=">, $") @RequestHeader(value="enum_header_string_array", required=false) List enumHeaderStringArray,@ApiParam(value = "Header parameter enum test (string)" , allowableValues="_abc, -efg, (xyz)", defaultValue="-efg") @RequestHeader(value="enum_header_string", required=false) String enumHeaderString,@ApiParam(value = "Query parameter enum test (string array)", allowableValues = ">, $") @RequestParam(value = "enum_query_string_array", required = false) List enumQueryStringArray,@ApiParam(value = "Query parameter enum test (string)", allowableValues = "_abc, -efg, (xyz)", defaultValue = "-efg") @RequestParam(value = "enum_query_string", required = false, defaultValue="-efg") String enumQueryString,@ApiParam(value = "Query parameter enum test (double)", allowableValues = "1, -2") @RequestParam(value = "enum_query_integer", required = false) Integer enumQueryInteger,@ApiParam(value = "Query parameter enum test (double)", allowableValues="1.1, -1.2") @RequestPart(value="enum_query_double", required=false) Double enumQueryDouble, @RequestHeader("Accept") String accept); } diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/api/FakeApiController.java b/samples/server/petstore/springboot/src/main/java/io/swagger/api/FakeApiController.java index 63f3e243be6..dc01cc55727 100644 --- a/samples/server/petstore/springboot/src/main/java/io/swagger/api/FakeApiController.java +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/api/FakeApiController.java @@ -62,9 +62,9 @@ public class FakeApiController implements FakeApi { @ApiParam(value = "Form parameter enum test (string)", allowableValues="_abc, -efg, (xyz)", defaultValue="-efg") @RequestPart(value="enum_form_string", required=false) String enumFormString, @ApiParam(value = "Header parameter enum test (string array)" , allowableValues=">, $") @RequestHeader(value="enum_header_string_array", required=false) List enumHeaderStringArray, @ApiParam(value = "Header parameter enum test (string)" , allowableValues="_abc, -efg, (xyz)", defaultValue="-efg") @RequestHeader(value="enum_header_string", required=false) String enumHeaderString, - @ApiParam(value = "Query parameter enum test (string array)", allowableValues = ">, $") @RequestParam(value = "enum_query_string_array", required = false) List enumQueryStringArray, - @ApiParam(value = "Query parameter enum test (string)", allowableValues = "_abc, -efg, (xyz)", defaultValue = "-efg") @RequestParam(value = "enum_query_string", required = false, defaultValue="-efg") String enumQueryString, - @ApiParam(value = "Query parameter enum test (double)", allowableValues = "1, -2") @RequestParam(value = "enum_query_integer", required = false) Integer enumQueryInteger, + @ApiParam(value = "Query parameter enum test (string array)", allowableValues = ">, $") @RequestParam(value = "enum_query_string_array", required = false) List enumQueryStringArray, + @ApiParam(value = "Query parameter enum test (string)", allowableValues = "_abc, -efg, (xyz)", defaultValue = "-efg") @RequestParam(value = "enum_query_string", required = false, defaultValue="-efg") String enumQueryString, + @ApiParam(value = "Query parameter enum test (double)", allowableValues = "1, -2") @RequestParam(value = "enum_query_integer", required = false) Integer enumQueryInteger, @ApiParam(value = "Query parameter enum test (double)", allowableValues="1.1, -1.2") @RequestPart(value="enum_query_double", required=false) Double enumQueryDouble, @RequestHeader("Accept") String accept) { // do some magic! diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/api/PetApi.java b/samples/server/petstore/springboot/src/main/java/io/swagger/api/PetApi.java index 5816fb5b92e..1227aedbbd7 100644 --- a/samples/server/petstore/springboot/src/main/java/io/swagger/api/PetApi.java +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/api/PetApi.java @@ -64,7 +64,7 @@ public interface PetApi { @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, @RequestHeader("Accept") String accept) throws IOException; + 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, @RequestHeader("Accept") String accept) throws IOException; @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 = { @@ -79,7 +79,7 @@ public interface PetApi { @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, @RequestHeader("Accept") String accept) throws IOException; + ResponseEntity> findPetsByTags( @NotNull@ApiParam(value = "Tags to filter by", required = true) @RequestParam(value = "tags", required = true) List tags, @RequestHeader("Accept") String accept) throws IOException; @ApiOperation(value = "Find pet by ID", notes = "Returns a single pet", response = Pet.class, authorizations = { diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/api/PetApiController.java b/samples/server/petstore/springboot/src/main/java/io/swagger/api/PetApiController.java index 220aa32691d..7fc193be9c5 100644 --- a/samples/server/petstore/springboot/src/main/java/io/swagger/api/PetApiController.java +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/api/PetApiController.java @@ -38,7 +38,7 @@ public class PetApiController implements PetApi { 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, + 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, @RequestHeader("Accept") String accept) throws IOException { // do some magic! @@ -55,7 +55,7 @@ public class PetApiController implements PetApi { return new ResponseEntity>(HttpStatus.OK); } - public ResponseEntity> findPetsByTags( @NotNull @ApiParam(value = "Tags to filter by", required = true) @RequestParam(value = "tags", required = true) List tags, + public ResponseEntity> findPetsByTags( @NotNull@ApiParam(value = "Tags to filter by", required = true) @RequestParam(value = "tags", required = true) List tags, @RequestHeader("Accept") String accept) throws IOException { // do some magic! diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/api/UserApi.java b/samples/server/petstore/springboot/src/main/java/io/swagger/api/UserApi.java index 53899d1eddd..adc0d21d30b 100644 --- a/samples/server/petstore/springboot/src/main/java/io/swagger/api/UserApi.java +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/api/UserApi.java @@ -77,7 +77,7 @@ public interface UserApi { @RequestMapping(value = "/user/login", produces = { "application/xml", "application/json" }, method = RequestMethod.GET) - ResponseEntity loginUser( @NotNull @ApiParam(value = "The user name for login", required = true) @RequestParam(value = "username", required = true) String username, @NotNull @ApiParam(value = "The password for login in clear text", required = true) @RequestParam(value = "password", required = true) String password, @RequestHeader("Accept") String accept) throws IOException; + ResponseEntity loginUser( @NotNull@ApiParam(value = "The user name for login", required = true) @RequestParam(value = "username", required = true) String username, @NotNull@ApiParam(value = "The password for login in clear text", required = true) @RequestParam(value = "password", required = true) String password, @RequestHeader("Accept") String accept) throws IOException; @ApiOperation(value = "Logs out current logged in user session", notes = "", response = Void.class, tags={ "user", }) diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/api/UserApiController.java b/samples/server/petstore/springboot/src/main/java/io/swagger/api/UserApiController.java index d8cac8d5eb8..8188aeaeb8d 100644 --- a/samples/server/petstore/springboot/src/main/java/io/swagger/api/UserApiController.java +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/api/UserApiController.java @@ -65,8 +65,8 @@ public class UserApiController implements UserApi { return new ResponseEntity(HttpStatus.OK); } - public ResponseEntity loginUser( @NotNull @ApiParam(value = "The user name for login", required = true) @RequestParam(value = "username", required = true) String username, - @NotNull @ApiParam(value = "The password for login in clear text", required = true) @RequestParam(value = "password", required = true) String password, + public ResponseEntity loginUser( @NotNull@ApiParam(value = "The user name for login", required = true) @RequestParam(value = "username", required = true) String username, + @NotNull@ApiParam(value = "The password for login in clear text", required = true) @RequestParam(value = "password", required = true) String password, @RequestHeader("Accept") String accept) throws IOException { // do some magic! diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/model/AdditionalPropertiesClass.java b/samples/server/petstore/springboot/src/main/java/io/swagger/model/AdditionalPropertiesClass.java index f4cfcadae51..80be4236b0d 100644 --- a/samples/server/petstore/springboot/src/main/java/io/swagger/model/AdditionalPropertiesClass.java +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/model/AdditionalPropertiesClass.java @@ -8,7 +8,9 @@ import io.swagger.annotations.ApiModelProperty; import java.util.HashMap; import java.util.List; import java.util.Map; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * AdditionalPropertiesClass */ @@ -38,6 +40,8 @@ public class AdditionalPropertiesClass { * @return mapProperty **/ @ApiModelProperty(value = "") + + @Valid public Map getMapProperty() { return mapProperty; } @@ -64,6 +68,8 @@ public class AdditionalPropertiesClass { * @return mapOfMapProperty **/ @ApiModelProperty(value = "") + + @Valid public Map> getMapOfMapProperty() { return mapOfMapProperty; } diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/model/Animal.java b/samples/server/petstore/springboot/src/main/java/io/swagger/model/Animal.java index a218f0b5542..bc957d1c803 100644 --- a/samples/server/petstore/springboot/src/main/java/io/swagger/model/Animal.java +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/model/Animal.java @@ -7,7 +7,9 @@ import com.fasterxml.jackson.annotation.JsonSubTypes; import com.fasterxml.jackson.annotation.JsonTypeInfo; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * Animal */ @@ -35,6 +37,8 @@ public class Animal { **/ @ApiModelProperty(required = true, value = "") @NotNull + + @Valid public String getClassName() { return className; } @@ -53,6 +57,8 @@ public class Animal { * @return color **/ @ApiModelProperty(value = "") + + @Valid public String getColor() { return color; } diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/model/AnimalFarm.java b/samples/server/petstore/springboot/src/main/java/io/swagger/model/AnimalFarm.java index 33dc04699af..9fa4159f203 100644 --- a/samples/server/petstore/springboot/src/main/java/io/swagger/model/AnimalFarm.java +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/model/AnimalFarm.java @@ -4,7 +4,9 @@ import java.util.Objects; import io.swagger.model.Animal; import java.util.ArrayList; import java.util.List; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * AnimalFarm */ diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/model/ArrayOfArrayOfNumberOnly.java b/samples/server/petstore/springboot/src/main/java/io/swagger/model/ArrayOfArrayOfNumberOnly.java index 8f975d8feda..f9dca7d60b5 100644 --- a/samples/server/petstore/springboot/src/main/java/io/swagger/model/ArrayOfArrayOfNumberOnly.java +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/model/ArrayOfArrayOfNumberOnly.java @@ -8,7 +8,9 @@ import io.swagger.annotations.ApiModelProperty; import java.math.BigDecimal; import java.util.ArrayList; import java.util.List; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * ArrayOfArrayOfNumberOnly */ @@ -35,6 +37,8 @@ public class ArrayOfArrayOfNumberOnly { * @return arrayArrayNumber **/ @ApiModelProperty(value = "") + + @Valid public List> getArrayArrayNumber() { return arrayArrayNumber; } diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/model/ArrayOfNumberOnly.java b/samples/server/petstore/springboot/src/main/java/io/swagger/model/ArrayOfNumberOnly.java index 2c556008554..e9c8a313be0 100644 --- a/samples/server/petstore/springboot/src/main/java/io/swagger/model/ArrayOfNumberOnly.java +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/model/ArrayOfNumberOnly.java @@ -8,7 +8,9 @@ import io.swagger.annotations.ApiModelProperty; import java.math.BigDecimal; import java.util.ArrayList; import java.util.List; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * ArrayOfNumberOnly */ @@ -35,6 +37,8 @@ public class ArrayOfNumberOnly { * @return arrayNumber **/ @ApiModelProperty(value = "") + + @Valid public List getArrayNumber() { return arrayNumber; } diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/model/ArrayTest.java b/samples/server/petstore/springboot/src/main/java/io/swagger/model/ArrayTest.java index 664e319cd35..78c35d3c63a 100644 --- a/samples/server/petstore/springboot/src/main/java/io/swagger/model/ArrayTest.java +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/model/ArrayTest.java @@ -8,7 +8,9 @@ import io.swagger.annotations.ApiModelProperty; import io.swagger.model.ReadOnlyFirst; import java.util.ArrayList; import java.util.List; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * ArrayTest */ @@ -41,6 +43,8 @@ public class ArrayTest { * @return arrayOfString **/ @ApiModelProperty(value = "") + + @Valid public List getArrayOfString() { return arrayOfString; } @@ -67,6 +71,8 @@ public class ArrayTest { * @return arrayArrayOfInteger **/ @ApiModelProperty(value = "") + + @Valid public List> getArrayArrayOfInteger() { return arrayArrayOfInteger; } @@ -93,6 +99,8 @@ public class ArrayTest { * @return arrayArrayOfModel **/ @ApiModelProperty(value = "") + + @Valid public List> getArrayArrayOfModel() { return arrayArrayOfModel; } diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/model/Capitalization.java b/samples/server/petstore/springboot/src/main/java/io/swagger/model/Capitalization.java index d7ad5642ccf..93533c28822 100644 --- a/samples/server/petstore/springboot/src/main/java/io/swagger/model/Capitalization.java +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/model/Capitalization.java @@ -5,7 +5,9 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * Capitalization */ @@ -39,6 +41,8 @@ public class Capitalization { * @return smallCamel **/ @ApiModelProperty(value = "") + + @Valid public String getSmallCamel() { return smallCamel; } @@ -57,6 +61,8 @@ public class Capitalization { * @return capitalCamel **/ @ApiModelProperty(value = "") + + @Valid public String getCapitalCamel() { return capitalCamel; } @@ -75,6 +81,8 @@ public class Capitalization { * @return smallSnake **/ @ApiModelProperty(value = "") + + @Valid public String getSmallSnake() { return smallSnake; } @@ -93,6 +101,8 @@ public class Capitalization { * @return capitalSnake **/ @ApiModelProperty(value = "") + + @Valid public String getCapitalSnake() { return capitalSnake; } @@ -111,6 +121,8 @@ public class Capitalization { * @return scAETHFlowPoints **/ @ApiModelProperty(value = "") + + @Valid public String getScAETHFlowPoints() { return scAETHFlowPoints; } @@ -129,6 +141,8 @@ public class Capitalization { * @return ATT_NAME **/ @ApiModelProperty(value = "Name of the pet ") + + @Valid public String getATTNAME() { return ATT_NAME; } diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/model/Cat.java b/samples/server/petstore/springboot/src/main/java/io/swagger/model/Cat.java index 747e5dc0c7e..edcbc354be6 100644 --- a/samples/server/petstore/springboot/src/main/java/io/swagger/model/Cat.java +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/model/Cat.java @@ -6,7 +6,9 @@ import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import io.swagger.model.Animal; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * Cat */ @@ -25,6 +27,8 @@ public class Cat extends Animal { * @return declawed **/ @ApiModelProperty(value = "") + + @Valid public Boolean getDeclawed() { return declawed; } diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/model/Category.java b/samples/server/petstore/springboot/src/main/java/io/swagger/model/Category.java index 9629da6500e..6dd9cb7a2ad 100644 --- a/samples/server/petstore/springboot/src/main/java/io/swagger/model/Category.java +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/model/Category.java @@ -5,7 +5,9 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * Category */ @@ -27,6 +29,8 @@ public class Category { * @return id **/ @ApiModelProperty(value = "") + + @Valid public Long getId() { return id; } @@ -45,6 +49,8 @@ public class Category { * @return name **/ @ApiModelProperty(value = "") + + @Valid public String getName() { return name; } diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/model/ClassModel.java b/samples/server/petstore/springboot/src/main/java/io/swagger/model/ClassModel.java index d69acffefa8..6a6379f5b60 100644 --- a/samples/server/petstore/springboot/src/main/java/io/swagger/model/ClassModel.java +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/model/ClassModel.java @@ -5,7 +5,9 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * Model for testing model with \"_class\" property */ @@ -25,6 +27,8 @@ public class ClassModel { * @return propertyClass **/ @ApiModelProperty(value = "") + + @Valid public String getPropertyClass() { return propertyClass; } diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/model/Client.java b/samples/server/petstore/springboot/src/main/java/io/swagger/model/Client.java index f9cec5a225e..3b8d16cabf2 100644 --- a/samples/server/petstore/springboot/src/main/java/io/swagger/model/Client.java +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/model/Client.java @@ -5,7 +5,9 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * Client */ @@ -24,6 +26,8 @@ public class Client { * @return client **/ @ApiModelProperty(value = "") + + @Valid public String getClient() { return client; } diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/model/Dog.java b/samples/server/petstore/springboot/src/main/java/io/swagger/model/Dog.java index 9057e840fc3..513131a9fa7 100644 --- a/samples/server/petstore/springboot/src/main/java/io/swagger/model/Dog.java +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/model/Dog.java @@ -6,7 +6,9 @@ import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import io.swagger.model.Animal; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * Dog */ @@ -25,6 +27,8 @@ public class Dog extends Animal { * @return breed **/ @ApiModelProperty(value = "") + + @Valid public String getBreed() { return breed; } diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/model/EnumArrays.java b/samples/server/petstore/springboot/src/main/java/io/swagger/model/EnumArrays.java index f904035e482..bbf4a3036e9 100644 --- a/samples/server/petstore/springboot/src/main/java/io/swagger/model/EnumArrays.java +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/model/EnumArrays.java @@ -8,7 +8,9 @@ import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import java.util.ArrayList; import java.util.List; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * EnumArrays */ @@ -92,6 +94,8 @@ public class EnumArrays { * @return justSymbol **/ @ApiModelProperty(value = "") + + @Valid public JustSymbolEnum getJustSymbol() { return justSymbol; } @@ -118,6 +122,8 @@ public class EnumArrays { * @return arrayEnum **/ @ApiModelProperty(value = "") + + @Valid public List getArrayEnum() { return arrayEnum; } diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/model/EnumClass.java b/samples/server/petstore/springboot/src/main/java/io/swagger/model/EnumClass.java index cdfc0933c3e..4cfbe4b9fcf 100644 --- a/samples/server/petstore/springboot/src/main/java/io/swagger/model/EnumClass.java +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/model/EnumClass.java @@ -2,7 +2,9 @@ package io.swagger.model; import java.util.Objects; import com.fasterxml.jackson.annotation.JsonValue; +import javax.validation.Valid; import javax.validation.constraints.*; + import com.fasterxml.jackson.annotation.JsonCreator; /** diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/model/EnumTest.java b/samples/server/petstore/springboot/src/main/java/io/swagger/model/EnumTest.java index 9f2a0275a6a..c7e4793cdf7 100644 --- a/samples/server/petstore/springboot/src/main/java/io/swagger/model/EnumTest.java +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/model/EnumTest.java @@ -7,7 +7,9 @@ import com.fasterxml.jackson.annotation.JsonValue; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import io.swagger.model.OuterEnum; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * EnumTest */ @@ -130,6 +132,8 @@ public class EnumTest { * @return enumString **/ @ApiModelProperty(value = "") + + @Valid public EnumStringEnum getEnumString() { return enumString; } @@ -148,6 +152,8 @@ public class EnumTest { * @return enumInteger **/ @ApiModelProperty(value = "") + + @Valid public EnumIntegerEnum getEnumInteger() { return enumInteger; } @@ -166,6 +172,8 @@ public class EnumTest { * @return enumNumber **/ @ApiModelProperty(value = "") + + @Valid public EnumNumberEnum getEnumNumber() { return enumNumber; } @@ -184,6 +192,8 @@ public class EnumTest { * @return outerEnum **/ @ApiModelProperty(value = "") + + @Valid public OuterEnum getOuterEnum() { return outerEnum; } diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/model/FormatTest.java b/samples/server/petstore/springboot/src/main/java/io/swagger/model/FormatTest.java index 0f144806e9e..2aaa5179f61 100644 --- a/samples/server/petstore/springboot/src/main/java/io/swagger/model/FormatTest.java +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/model/FormatTest.java @@ -9,7 +9,9 @@ import java.math.BigDecimal; import java.util.UUID; import org.threeten.bp.LocalDate; import org.threeten.bp.OffsetDateTime; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * FormatTest */ @@ -66,7 +68,9 @@ public class FormatTest { * @return integer **/ @ApiModelProperty(value = "") - @Min(10) @Max(100) public Integer getInteger() { + @Min(10) @Max(100) + @Valid + public Integer getInteger() { return integer; } @@ -86,7 +90,9 @@ public class FormatTest { * @return int32 **/ @ApiModelProperty(value = "") - @Min(20) @Max(200) public Integer getInt32() { + @Min(20) @Max(200) + @Valid + public Integer getInt32() { return int32; } @@ -104,6 +110,8 @@ public class FormatTest { * @return int64 **/ @ApiModelProperty(value = "") + + @Valid public Long getInt64() { return int64; } @@ -125,7 +133,9 @@ public class FormatTest { **/ @ApiModelProperty(required = true, value = "") @NotNull - @DecimalMin("32.1") @DecimalMax("543.2") public BigDecimal getNumber() { + @DecimalMin("32.1") @DecimalMax("543.2") + @Valid + public BigDecimal getNumber() { return number; } @@ -145,7 +155,9 @@ public class FormatTest { * @return _float **/ @ApiModelProperty(value = "") - @DecimalMin("54.3") @DecimalMax("987.6") public Float getFloat() { + @DecimalMin("54.3") @DecimalMax("987.6") + @Valid + public Float getFloat() { return _float; } @@ -165,7 +177,9 @@ public class FormatTest { * @return _double **/ @ApiModelProperty(value = "") - @DecimalMin("67.8") @DecimalMax("123.4") public Double getDouble() { + @DecimalMin("67.8") @DecimalMax("123.4") + @Valid + public Double getDouble() { return _double; } @@ -183,7 +197,9 @@ public class FormatTest { * @return string **/ @ApiModelProperty(value = "") - @Pattern(regexp="/[a-z]/i") public String getString() { + @Pattern(regexp="/[a-z]/i") + @Valid + public String getString() { return string; } @@ -202,6 +218,8 @@ public class FormatTest { **/ @ApiModelProperty(required = true, value = "") @NotNull + + @Valid public byte[] getByte() { return _byte; } @@ -220,6 +238,8 @@ public class FormatTest { * @return binary **/ @ApiModelProperty(value = "") + + @Valid public byte[] getBinary() { return binary; } @@ -239,6 +259,8 @@ public class FormatTest { **/ @ApiModelProperty(required = true, value = "") @NotNull + + @Valid public LocalDate getDate() { return date; } @@ -257,6 +279,8 @@ public class FormatTest { * @return dateTime **/ @ApiModelProperty(value = "") + + @Valid public OffsetDateTime getDateTime() { return dateTime; } @@ -275,6 +299,8 @@ public class FormatTest { * @return uuid **/ @ApiModelProperty(value = "") + + @Valid public UUID getUuid() { return uuid; } @@ -294,7 +320,9 @@ public class FormatTest { **/ @ApiModelProperty(required = true, value = "") @NotNull - @Size(min=10,max=64) public String getPassword() { + @Size(min=10,max=64) + @Valid + public String getPassword() { return password; } diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/model/HasOnlyReadOnly.java b/samples/server/petstore/springboot/src/main/java/io/swagger/model/HasOnlyReadOnly.java index a26492e4912..0f8b608e261 100644 --- a/samples/server/petstore/springboot/src/main/java/io/swagger/model/HasOnlyReadOnly.java +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/model/HasOnlyReadOnly.java @@ -5,7 +5,9 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * HasOnlyReadOnly */ @@ -27,6 +29,8 @@ public class HasOnlyReadOnly { * @return bar **/ @ApiModelProperty(readOnly = true, value = "") + + @Valid public String getBar() { return bar; } @@ -45,6 +49,8 @@ public class HasOnlyReadOnly { * @return foo **/ @ApiModelProperty(readOnly = true, value = "") + + @Valid public String getFoo() { return foo; } diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/model/MapTest.java b/samples/server/petstore/springboot/src/main/java/io/swagger/model/MapTest.java index 434c3a8f1b5..1530a53f53f 100644 --- a/samples/server/petstore/springboot/src/main/java/io/swagger/model/MapTest.java +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/model/MapTest.java @@ -9,7 +9,9 @@ import io.swagger.annotations.ApiModelProperty; import java.util.HashMap; import java.util.List; import java.util.Map; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * MapTest */ @@ -70,6 +72,8 @@ public class MapTest { * @return mapMapOfString **/ @ApiModelProperty(value = "") + + @Valid public Map> getMapMapOfString() { return mapMapOfString; } @@ -96,6 +100,8 @@ public class MapTest { * @return mapOfEnumString **/ @ApiModelProperty(value = "") + + @Valid public Map getMapOfEnumString() { return mapOfEnumString; } diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/model/MixedPropertiesAndAdditionalPropertiesClass.java b/samples/server/petstore/springboot/src/main/java/io/swagger/model/MixedPropertiesAndAdditionalPropertiesClass.java index d9f452920f9..21cb67378eb 100644 --- a/samples/server/petstore/springboot/src/main/java/io/swagger/model/MixedPropertiesAndAdditionalPropertiesClass.java +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/model/MixedPropertiesAndAdditionalPropertiesClass.java @@ -11,7 +11,9 @@ import java.util.List; import java.util.Map; import java.util.UUID; import org.threeten.bp.OffsetDateTime; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * MixedPropertiesAndAdditionalPropertiesClass */ @@ -36,6 +38,8 @@ public class MixedPropertiesAndAdditionalPropertiesClass { * @return uuid **/ @ApiModelProperty(value = "") + + @Valid public UUID getUuid() { return uuid; } @@ -54,6 +58,8 @@ public class MixedPropertiesAndAdditionalPropertiesClass { * @return dateTime **/ @ApiModelProperty(value = "") + + @Valid public OffsetDateTime getDateTime() { return dateTime; } @@ -80,6 +86,8 @@ public class MixedPropertiesAndAdditionalPropertiesClass { * @return map **/ @ApiModelProperty(value = "") + + @Valid public Map getMap() { return map; } diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/model/Model200Response.java b/samples/server/petstore/springboot/src/main/java/io/swagger/model/Model200Response.java index 4d47f6c03c9..97349fef05c 100644 --- a/samples/server/petstore/springboot/src/main/java/io/swagger/model/Model200Response.java +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/model/Model200Response.java @@ -5,7 +5,9 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * Model for testing model name starting with number */ @@ -28,6 +30,8 @@ public class Model200Response { * @return name **/ @ApiModelProperty(value = "") + + @Valid public Integer getName() { return name; } @@ -46,6 +50,8 @@ public class Model200Response { * @return propertyClass **/ @ApiModelProperty(value = "") + + @Valid public String getPropertyClass() { return propertyClass; } diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/model/ModelApiResponse.java b/samples/server/petstore/springboot/src/main/java/io/swagger/model/ModelApiResponse.java index 36da9b20d9d..c8882b3b1e2 100644 --- a/samples/server/petstore/springboot/src/main/java/io/swagger/model/ModelApiResponse.java +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/model/ModelApiResponse.java @@ -5,7 +5,9 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * ModelApiResponse */ @@ -30,6 +32,8 @@ public class ModelApiResponse { * @return code **/ @ApiModelProperty(value = "") + + @Valid public Integer getCode() { return code; } @@ -48,6 +52,8 @@ public class ModelApiResponse { * @return type **/ @ApiModelProperty(value = "") + + @Valid public String getType() { return type; } @@ -66,6 +72,8 @@ public class ModelApiResponse { * @return message **/ @ApiModelProperty(value = "") + + @Valid public String getMessage() { return message; } diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/model/ModelReturn.java b/samples/server/petstore/springboot/src/main/java/io/swagger/model/ModelReturn.java index 7ffc24a0144..7018d7de09c 100644 --- a/samples/server/petstore/springboot/src/main/java/io/swagger/model/ModelReturn.java +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/model/ModelReturn.java @@ -5,7 +5,9 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * Model for testing reserved words */ @@ -25,6 +27,8 @@ public class ModelReturn { * @return _return **/ @ApiModelProperty(value = "") + + @Valid public Integer getReturn() { return _return; } diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/model/Name.java b/samples/server/petstore/springboot/src/main/java/io/swagger/model/Name.java index 953199166ff..46069fdd14b 100644 --- a/samples/server/petstore/springboot/src/main/java/io/swagger/model/Name.java +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/model/Name.java @@ -5,7 +5,9 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * Model for testing model name same as property name */ @@ -35,6 +37,8 @@ public class Name { **/ @ApiModelProperty(required = true, value = "") @NotNull + + @Valid public Integer getName() { return name; } @@ -53,6 +57,8 @@ public class Name { * @return snakeCase **/ @ApiModelProperty(readOnly = true, value = "") + + @Valid public Integer getSnakeCase() { return snakeCase; } @@ -71,6 +77,8 @@ public class Name { * @return property **/ @ApiModelProperty(value = "") + + @Valid public String getProperty() { return property; } @@ -89,6 +97,8 @@ public class Name { * @return _123Number **/ @ApiModelProperty(readOnly = true, value = "") + + @Valid public Integer get123Number() { return _123Number; } diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/model/NumberOnly.java b/samples/server/petstore/springboot/src/main/java/io/swagger/model/NumberOnly.java index e6dbf3139e2..e243ecb429b 100644 --- a/samples/server/petstore/springboot/src/main/java/io/swagger/model/NumberOnly.java +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/model/NumberOnly.java @@ -6,7 +6,9 @@ import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import java.math.BigDecimal; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * NumberOnly */ @@ -25,6 +27,8 @@ public class NumberOnly { * @return justNumber **/ @ApiModelProperty(value = "") + + @Valid public BigDecimal getJustNumber() { return justNumber; } diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/model/Order.java b/samples/server/petstore/springboot/src/main/java/io/swagger/model/Order.java index c5381d2fa7e..3ba7e5a0a85 100644 --- a/samples/server/petstore/springboot/src/main/java/io/swagger/model/Order.java +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/model/Order.java @@ -7,7 +7,9 @@ import com.fasterxml.jackson.annotation.JsonValue; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import org.threeten.bp.OffsetDateTime; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * Order */ @@ -74,6 +76,8 @@ public class Order { * @return id **/ @ApiModelProperty(value = "") + + @Valid public Long getId() { return id; } @@ -92,6 +96,8 @@ public class Order { * @return petId **/ @ApiModelProperty(value = "") + + @Valid public Long getPetId() { return petId; } @@ -110,6 +116,8 @@ public class Order { * @return quantity **/ @ApiModelProperty(value = "") + + @Valid public Integer getQuantity() { return quantity; } @@ -128,6 +136,8 @@ public class Order { * @return shipDate **/ @ApiModelProperty(value = "") + + @Valid public OffsetDateTime getShipDate() { return shipDate; } @@ -146,6 +156,8 @@ public class Order { * @return status **/ @ApiModelProperty(value = "Order Status") + + @Valid public StatusEnum getStatus() { return status; } @@ -164,6 +176,8 @@ public class Order { * @return complete **/ @ApiModelProperty(value = "") + + @Valid public Boolean getComplete() { return complete; } diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/model/OuterEnum.java b/samples/server/petstore/springboot/src/main/java/io/swagger/model/OuterEnum.java index 5f0075e4457..f3c6d31fb86 100644 --- a/samples/server/petstore/springboot/src/main/java/io/swagger/model/OuterEnum.java +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/model/OuterEnum.java @@ -2,7 +2,9 @@ package io.swagger.model; import java.util.Objects; import com.fasterxml.jackson.annotation.JsonValue; +import javax.validation.Valid; import javax.validation.constraints.*; + import com.fasterxml.jackson.annotation.JsonCreator; /** diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/model/Pet.java b/samples/server/petstore/springboot/src/main/java/io/swagger/model/Pet.java index b013846b4d6..c84687b699f 100644 --- a/samples/server/petstore/springboot/src/main/java/io/swagger/model/Pet.java +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/model/Pet.java @@ -10,7 +10,9 @@ import io.swagger.model.Category; import io.swagger.model.Tag; import java.util.ArrayList; import java.util.List; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * Pet */ @@ -77,6 +79,8 @@ public class Pet { * @return id **/ @ApiModelProperty(value = "") + + @Valid public Long getId() { return id; } @@ -95,6 +99,8 @@ public class Pet { * @return category **/ @ApiModelProperty(value = "") + + @Valid public Category getCategory() { return category; } @@ -114,6 +120,8 @@ public class Pet { **/ @ApiModelProperty(example = "doggie", required = true, value = "") @NotNull + + @Valid public String getName() { return name; } @@ -138,6 +146,8 @@ public class Pet { **/ @ApiModelProperty(required = true, value = "") @NotNull + + @Valid public List getPhotoUrls() { return photoUrls; } @@ -164,6 +174,8 @@ public class Pet { * @return tags **/ @ApiModelProperty(value = "") + + @Valid public List getTags() { return tags; } @@ -182,6 +194,8 @@ public class Pet { * @return status **/ @ApiModelProperty(value = "pet status in the store") + + @Valid public StatusEnum getStatus() { return status; } diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/model/ReadOnlyFirst.java b/samples/server/petstore/springboot/src/main/java/io/swagger/model/ReadOnlyFirst.java index 47700659fd2..8e79be0008d 100644 --- a/samples/server/petstore/springboot/src/main/java/io/swagger/model/ReadOnlyFirst.java +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/model/ReadOnlyFirst.java @@ -5,7 +5,9 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * ReadOnlyFirst */ @@ -27,6 +29,8 @@ public class ReadOnlyFirst { * @return bar **/ @ApiModelProperty(readOnly = true, value = "") + + @Valid public String getBar() { return bar; } @@ -45,6 +49,8 @@ public class ReadOnlyFirst { * @return baz **/ @ApiModelProperty(value = "") + + @Valid public String getBaz() { return baz; } diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/model/SpecialModelName.java b/samples/server/petstore/springboot/src/main/java/io/swagger/model/SpecialModelName.java index 880d70599b0..3cb7b04353c 100644 --- a/samples/server/petstore/springboot/src/main/java/io/swagger/model/SpecialModelName.java +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/model/SpecialModelName.java @@ -5,7 +5,9 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * SpecialModelName */ @@ -24,6 +26,8 @@ public class SpecialModelName { * @return specialPropertyName **/ @ApiModelProperty(value = "") + + @Valid public Long getSpecialPropertyName() { return specialPropertyName; } diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/model/Tag.java b/samples/server/petstore/springboot/src/main/java/io/swagger/model/Tag.java index 298085317a4..9f8f3a25234 100644 --- a/samples/server/petstore/springboot/src/main/java/io/swagger/model/Tag.java +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/model/Tag.java @@ -5,7 +5,9 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * Tag */ @@ -27,6 +29,8 @@ public class Tag { * @return id **/ @ApiModelProperty(value = "") + + @Valid public Long getId() { return id; } @@ -45,6 +49,8 @@ public class Tag { * @return name **/ @ApiModelProperty(value = "") + + @Valid public String getName() { return name; } diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/model/User.java b/samples/server/petstore/springboot/src/main/java/io/swagger/model/User.java index 8e40f7e0594..501c556de27 100644 --- a/samples/server/petstore/springboot/src/main/java/io/swagger/model/User.java +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/model/User.java @@ -5,7 +5,9 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; +import javax.validation.Valid; import javax.validation.constraints.*; + /** * User */ @@ -45,6 +47,8 @@ public class User { * @return id **/ @ApiModelProperty(value = "") + + @Valid public Long getId() { return id; } @@ -63,6 +67,8 @@ public class User { * @return username **/ @ApiModelProperty(value = "") + + @Valid public String getUsername() { return username; } @@ -81,6 +87,8 @@ public class User { * @return firstName **/ @ApiModelProperty(value = "") + + @Valid public String getFirstName() { return firstName; } @@ -99,6 +107,8 @@ public class User { * @return lastName **/ @ApiModelProperty(value = "") + + @Valid public String getLastName() { return lastName; } @@ -117,6 +127,8 @@ public class User { * @return email **/ @ApiModelProperty(value = "") + + @Valid public String getEmail() { return email; } @@ -135,6 +147,8 @@ public class User { * @return password **/ @ApiModelProperty(value = "") + + @Valid public String getPassword() { return password; } @@ -153,6 +167,8 @@ public class User { * @return phone **/ @ApiModelProperty(value = "") + + @Valid public String getPhone() { return phone; } @@ -171,6 +187,8 @@ public class User { * @return userStatus **/ @ApiModelProperty(value = "User Status") + + @Valid public Integer getUserStatus() { return userStatus; }