From fc2b3d49ea3f33beafd6d4aa4ab53c3bc917217b Mon Sep 17 00:00:00 2001 From: Martin Brown Date: Mon, 24 Apr 2017 10:27:51 -0400 Subject: [PATCH 1/3] Issue 4632 (#4803) * Updated the Petstore samples * This change uses std::stringstream for string conversions instead of std::to_string(). Android doesn't yet support std::to_string(). This should fix #4632 --- .../cpprest/apiclient-source.mustache | 8 ++- .../cpprest/modelbase-source.mustache | 12 +++- samples/client/petstore/cpprest/ApiClient.cpp | 12 ++-- samples/client/petstore/cpprest/ApiClient.h | 4 +- .../petstore/cpprest/ApiConfiguration.cpp | 4 +- .../petstore/cpprest/ApiConfiguration.h | 4 +- .../client/petstore/cpprest/ApiException.cpp | 4 +- .../client/petstore/cpprest/ApiException.h | 4 +- .../client/petstore/cpprest/HttpContent.cpp | 4 +- samples/client/petstore/cpprest/HttpContent.h | 4 +- samples/client/petstore/cpprest/IHttpBody.h | 4 +- samples/client/petstore/cpprest/JsonBody.cpp | 4 +- samples/client/petstore/cpprest/JsonBody.h | 4 +- samples/client/petstore/cpprest/ModelBase.cpp | 16 ++++-- samples/client/petstore/cpprest/ModelBase.h | 4 +- .../petstore/cpprest/MultipartFormData.cpp | 4 +- .../petstore/cpprest/MultipartFormData.h | 4 +- .../client/petstore/cpprest/api/PetApi.cpp | 57 +++++-------------- samples/client/petstore/cpprest/api/PetApi.h | 21 ++++--- .../client/petstore/cpprest/api/StoreApi.cpp | 19 +++---- .../client/petstore/cpprest/api/StoreApi.h | 8 +-- .../client/petstore/cpprest/api/UserApi.cpp | 32 ++++------- samples/client/petstore/cpprest/api/UserApi.h | 14 ++--- .../petstore/cpprest/model/Category.cpp | 4 +- .../client/petstore/cpprest/model/Category.h | 8 +-- .../client/petstore/cpprest/model/Order.cpp | 4 +- samples/client/petstore/cpprest/model/Order.h | 8 +-- samples/client/petstore/cpprest/model/Pet.cpp | 4 +- samples/client/petstore/cpprest/model/Pet.h | 8 +-- samples/client/petstore/cpprest/model/Tag.cpp | 4 +- samples/client/petstore/cpprest/model/Tag.h | 8 +-- .../client/petstore/cpprest/model/User.cpp | 4 +- samples/client/petstore/cpprest/model/User.h | 8 +-- 33 files changed, 143 insertions(+), 168 deletions(-) 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..276e37c121c 100644 --- a/samples/client/petstore/cpprest/ApiClient.cpp +++ b/samples/client/petstore/cpprest/ApiClient.cpp @@ -1,9 +1,9 @@ /** * Swagger Petstore - * This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters. + * This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters * * OpenAPI spec version: 1.0.0 - * Contact: apiteam@swagger.io + * Contact: apiteam@wordnik.com * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git @@ -45,11 +45,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(const utility::datetime &value) diff --git a/samples/client/petstore/cpprest/ApiClient.h b/samples/client/petstore/cpprest/ApiClient.h index 1678e9e8c51..a22d9ae494e 100644 --- a/samples/client/petstore/cpprest/ApiClient.h +++ b/samples/client/petstore/cpprest/ApiClient.h @@ -1,9 +1,9 @@ /** * Swagger Petstore - * This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters. + * This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters * * OpenAPI spec version: 1.0.0 - * Contact: apiteam@swagger.io + * Contact: apiteam@wordnik.com * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git diff --git a/samples/client/petstore/cpprest/ApiConfiguration.cpp b/samples/client/petstore/cpprest/ApiConfiguration.cpp index 1520a56d347..ddbc1bc3eb2 100644 --- a/samples/client/petstore/cpprest/ApiConfiguration.cpp +++ b/samples/client/petstore/cpprest/ApiConfiguration.cpp @@ -1,9 +1,9 @@ /** * Swagger Petstore - * This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters. + * This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters * * OpenAPI spec version: 1.0.0 - * Contact: apiteam@swagger.io + * Contact: apiteam@wordnik.com * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git diff --git a/samples/client/petstore/cpprest/ApiConfiguration.h b/samples/client/petstore/cpprest/ApiConfiguration.h index 0574783f690..cef9cbff0cb 100644 --- a/samples/client/petstore/cpprest/ApiConfiguration.h +++ b/samples/client/petstore/cpprest/ApiConfiguration.h @@ -1,9 +1,9 @@ /** * Swagger Petstore - * This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters. + * This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters * * OpenAPI spec version: 1.0.0 - * Contact: apiteam@swagger.io + * Contact: apiteam@wordnik.com * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git diff --git a/samples/client/petstore/cpprest/ApiException.cpp b/samples/client/petstore/cpprest/ApiException.cpp index 5ddf808f9f0..8e3646eb973 100644 --- a/samples/client/petstore/cpprest/ApiException.cpp +++ b/samples/client/petstore/cpprest/ApiException.cpp @@ -1,9 +1,9 @@ /** * Swagger Petstore - * This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters. + * This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters * * OpenAPI spec version: 1.0.0 - * Contact: apiteam@swagger.io + * Contact: apiteam@wordnik.com * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git diff --git a/samples/client/petstore/cpprest/ApiException.h b/samples/client/petstore/cpprest/ApiException.h index 835752ea75b..43d0746ca41 100644 --- a/samples/client/petstore/cpprest/ApiException.h +++ b/samples/client/petstore/cpprest/ApiException.h @@ -1,9 +1,9 @@ /** * Swagger Petstore - * This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters. + * This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters * * OpenAPI spec version: 1.0.0 - * Contact: apiteam@swagger.io + * Contact: apiteam@wordnik.com * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git diff --git a/samples/client/petstore/cpprest/HttpContent.cpp b/samples/client/petstore/cpprest/HttpContent.cpp index e9a619d7753..b6e9ff911c1 100644 --- a/samples/client/petstore/cpprest/HttpContent.cpp +++ b/samples/client/petstore/cpprest/HttpContent.cpp @@ -1,9 +1,9 @@ /** * Swagger Petstore - * This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters. + * This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters * * OpenAPI spec version: 1.0.0 - * Contact: apiteam@swagger.io + * Contact: apiteam@wordnik.com * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git diff --git a/samples/client/petstore/cpprest/HttpContent.h b/samples/client/petstore/cpprest/HttpContent.h index 6b7bae0a5f7..a07f5d14e79 100644 --- a/samples/client/petstore/cpprest/HttpContent.h +++ b/samples/client/petstore/cpprest/HttpContent.h @@ -1,9 +1,9 @@ /** * Swagger Petstore - * This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters. + * This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters * * OpenAPI spec version: 1.0.0 - * Contact: apiteam@swagger.io + * Contact: apiteam@wordnik.com * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git diff --git a/samples/client/petstore/cpprest/IHttpBody.h b/samples/client/petstore/cpprest/IHttpBody.h index 0ccf80876e9..1d320e2f809 100644 --- a/samples/client/petstore/cpprest/IHttpBody.h +++ b/samples/client/petstore/cpprest/IHttpBody.h @@ -1,9 +1,9 @@ /** * Swagger Petstore - * This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters. + * This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters * * OpenAPI spec version: 1.0.0 - * Contact: apiteam@swagger.io + * Contact: apiteam@wordnik.com * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git diff --git a/samples/client/petstore/cpprest/JsonBody.cpp b/samples/client/petstore/cpprest/JsonBody.cpp index 41ce32702c3..554953f40cc 100644 --- a/samples/client/petstore/cpprest/JsonBody.cpp +++ b/samples/client/petstore/cpprest/JsonBody.cpp @@ -1,9 +1,9 @@ /** * Swagger Petstore - * This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters. + * This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters * * OpenAPI spec version: 1.0.0 - * Contact: apiteam@swagger.io + * Contact: apiteam@wordnik.com * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git diff --git a/samples/client/petstore/cpprest/JsonBody.h b/samples/client/petstore/cpprest/JsonBody.h index 335be0a72b6..86ee4459c72 100644 --- a/samples/client/petstore/cpprest/JsonBody.h +++ b/samples/client/petstore/cpprest/JsonBody.h @@ -1,9 +1,9 @@ /** * Swagger Petstore - * This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters. + * This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters * * OpenAPI spec version: 1.0.0 - * Contact: apiteam@swagger.io + * Contact: apiteam@wordnik.com * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git diff --git a/samples/client/petstore/cpprest/ModelBase.cpp b/samples/client/petstore/cpprest/ModelBase.cpp index 197741f5379..e0050e763ac 100644 --- a/samples/client/petstore/cpprest/ModelBase.cpp +++ b/samples/client/petstore/cpprest/ModelBase.cpp @@ -1,9 +1,9 @@ /** * Swagger Petstore - * This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters. + * This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters * * OpenAPI spec version: 1.0.0 - * Contact: apiteam@swagger.io + * Contact: apiteam@wordnik.com * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git @@ -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; } diff --git a/samples/client/petstore/cpprest/ModelBase.h b/samples/client/petstore/cpprest/ModelBase.h index 013c99a5d70..ba62e9a42dc 100644 --- a/samples/client/petstore/cpprest/ModelBase.h +++ b/samples/client/petstore/cpprest/ModelBase.h @@ -1,9 +1,9 @@ /** * Swagger Petstore - * This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters. + * This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters * * OpenAPI spec version: 1.0.0 - * Contact: apiteam@swagger.io + * Contact: apiteam@wordnik.com * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git diff --git a/samples/client/petstore/cpprest/MultipartFormData.cpp b/samples/client/petstore/cpprest/MultipartFormData.cpp index a7e5f56c9f9..ba4ec6537fd 100644 --- a/samples/client/petstore/cpprest/MultipartFormData.cpp +++ b/samples/client/petstore/cpprest/MultipartFormData.cpp @@ -1,9 +1,9 @@ /** * Swagger Petstore - * This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters. + * This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters * * OpenAPI spec version: 1.0.0 - * Contact: apiteam@swagger.io + * Contact: apiteam@wordnik.com * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git diff --git a/samples/client/petstore/cpprest/MultipartFormData.h b/samples/client/petstore/cpprest/MultipartFormData.h index 63b84dcb3a9..997ed75e211 100644 --- a/samples/client/petstore/cpprest/MultipartFormData.h +++ b/samples/client/petstore/cpprest/MultipartFormData.h @@ -1,9 +1,9 @@ /** * Swagger Petstore - * This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters. + * This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters * * OpenAPI spec version: 1.0.0 - * Contact: apiteam@swagger.io + * Contact: apiteam@wordnik.com * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git diff --git a/samples/client/petstore/cpprest/api/PetApi.cpp b/samples/client/petstore/cpprest/api/PetApi.cpp index d3e337d367f..49ce1d90891 100644 --- a/samples/client/petstore/cpprest/api/PetApi.cpp +++ b/samples/client/petstore/cpprest/api/PetApi.cpp @@ -1,9 +1,9 @@ /** * Swagger Petstore - * This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters. + * This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters * * OpenAPI spec version: 1.0.0 - * Contact: apiteam@swagger.io + * Contact: apiteam@wordnik.com * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git @@ -39,12 +39,6 @@ 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"); @@ -55,8 +49,8 @@ pplx::task PetApi::addPet(std::shared_ptr body) std::map> fileParams; std::unordered_set responseHttpContentTypes; - responseHttpContentTypes.insert( U("application/xml") ); responseHttpContentTypes.insert( U("application/json") ); + responseHttpContentTypes.insert( U("application/xml") ); utility::string_t responseHttpContentType; @@ -172,8 +166,8 @@ pplx::task PetApi::deletePet(int64_t petId, utility::string_t apiKey) std::map> fileParams; std::unordered_set responseHttpContentTypes; - responseHttpContentTypes.insert( U("application/xml") ); responseHttpContentTypes.insert( U("application/json") ); + responseHttpContentTypes.insert( U("application/xml") ); utility::string_t responseHttpContentType; @@ -277,8 +271,8 @@ pplx::task>> PetApi::findPetsByStatus(std::vect std::map> fileParams; std::unordered_set responseHttpContentTypes; - responseHttpContentTypes.insert( U("application/xml") ); responseHttpContentTypes.insert( U("application/json") ); + responseHttpContentTypes.insert( U("application/xml") ); utility::string_t responseHttpContentType; @@ -407,8 +401,8 @@ pplx::task>> PetApi::findPetsByTags(std::vector std::map> fileParams; std::unordered_set responseHttpContentTypes; - responseHttpContentTypes.insert( U("application/xml") ); responseHttpContentTypes.insert( U("application/json") ); + responseHttpContentTypes.insert( U("application/xml") ); utility::string_t responseHttpContentType; @@ -538,8 +532,8 @@ pplx::task> PetApi::getPetById(int64_t petId) std::map> fileParams; std::unordered_set responseHttpContentTypes; - responseHttpContentTypes.insert( U("application/xml") ); responseHttpContentTypes.insert( U("application/json") ); + responseHttpContentTypes.insert( U("application/xml") ); utility::string_t responseHttpContentType; @@ -589,6 +583,8 @@ pplx::task> PetApi::getPetById(int64_t petId) //Set the request content type in the header. headerParams[U("Content-Type")] = requestHttpContentType; + // authentication (petstore_auth) required + // oauth2 authentication is added automatically as part of the http_client_config // authentication (api_key) required { utility::string_t apiKey = apiConfiguration->getApiKey(U("api_key")); @@ -653,12 +649,6 @@ 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"); @@ -669,8 +659,8 @@ pplx::task PetApi::updatePet(std::shared_ptr body) std::map> fileParams; std::unordered_set responseHttpContentTypes; - responseHttpContentTypes.insert( U("application/xml") ); responseHttpContentTypes.insert( U("application/json") ); + responseHttpContentTypes.insert( U("application/xml") ); utility::string_t responseHttpContentType; @@ -772,7 +762,7 @@ pplx::task PetApi::updatePet(std::shared_ptr body) return void(); }); } -pplx::task PetApi::updatePetWithForm(int64_t petId, utility::string_t name, utility::string_t status) +pplx::task PetApi::updatePetWithForm(utility::string_t petId, utility::string_t name, utility::string_t status) { @@ -786,8 +776,8 @@ pplx::task PetApi::updatePetWithForm(int64_t petId, utility::string_t name std::map> fileParams; std::unordered_set responseHttpContentTypes; - responseHttpContentTypes.insert( U("application/xml") ); responseHttpContentTypes.insert( U("application/json") ); + responseHttpContentTypes.insert( U("application/xml") ); utility::string_t responseHttpContentType; @@ -883,7 +873,7 @@ pplx::task PetApi::updatePetWithForm(int64_t petId, utility::string_t name return void(); }); } -pplx::task> PetApi::uploadFile(int64_t petId, utility::string_t additionalMetadata, std::shared_ptr file) +pplx::task PetApi::uploadFile(int64_t petId, utility::string_t additionalMetadata, std::shared_ptr file) { @@ -898,6 +888,7 @@ pplx::task> PetApi::uploadFile(int64_t petId, utili std::unordered_set responseHttpContentTypes; responseHttpContentTypes.insert( U("application/json") ); + responseHttpContentTypes.insert( U("application/xml") ); utility::string_t responseHttpContentType; @@ -990,25 +981,7 @@ pplx::task> PetApi::uploadFile(int64_t petId, utili }) .then([=](utility::string_t response) { - std::shared_ptr result(new ApiResponse()); - - if(responseHttpContentType == U("application/json")) - { - web::json::value json = web::json::value::parse(response); - - result->fromJson(json); - } - // else if(responseHttpContentType == U("multipart/form-data")) - // { - // TODO multipart response parsing - // } - else - { - throw ApiException(500 - , U("error calling uploadFile: unsupported response type")); - } - - return result; + return void(); }); } diff --git a/samples/client/petstore/cpprest/api/PetApi.h b/samples/client/petstore/cpprest/api/PetApi.h index d60c3c80fca..067b09f65c5 100644 --- a/samples/client/petstore/cpprest/api/PetApi.h +++ b/samples/client/petstore/cpprest/api/PetApi.h @@ -1,9 +1,9 @@ /** * Swagger Petstore - * This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters. + * This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters * * OpenAPI spec version: 1.0.0 - * Contact: apiteam@swagger.io + * Contact: apiteam@wordnik.com * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git @@ -22,7 +22,6 @@ #include "ApiClient.h" -#include "ApiResponse.h" #include "HttpContent.h" #include "Pet.h" #include @@ -45,7 +44,7 @@ public: /// /// /// - /// Pet object that needs to be added to the store + /// Pet object that needs to be added to the store (optional) pplx::task addPet(std::shared_ptr body); /// /// Deletes a pet @@ -61,7 +60,7 @@ public: /// /// Multiple status values can be provided with comma separated strings /// - /// Status values that need to be considered for filter + /// Status values that need to be considered for filter (optional, default to available) pplx::task>> findPetsByStatus(std::vector status); /// /// Finds Pets by tags @@ -69,15 +68,15 @@ public: /// /// Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. /// - /// Tags to filter by + /// Tags to filter by (optional) pplx::task>> findPetsByTags(std::vector tags); /// /// Find pet by ID /// /// - /// Returns a single pet + /// Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions /// - /// ID of pet to return + /// ID of pet that needs to be fetched pplx::task> getPetById(int64_t petId); /// /// Update an existing pet @@ -85,7 +84,7 @@ public: /// /// /// - /// Pet object that needs to be added to the store + /// Pet object that needs to be added to the store (optional) pplx::task updatePet(std::shared_ptr body); /// /// Updates a pet in the store with form data @@ -94,7 +93,7 @@ public: /// /// /// ID of pet that needs to be updated/// Updated name of the pet (optional)/// Updated status of the pet (optional) - pplx::task updatePetWithForm(int64_t petId, utility::string_t name, utility::string_t status); + pplx::task updatePetWithForm(utility::string_t petId, utility::string_t name, utility::string_t status); /// /// uploads an image /// @@ -102,7 +101,7 @@ public: /// /// /// ID of pet to update/// Additional data to pass to server (optional)/// file to upload (optional) - pplx::task> uploadFile(int64_t petId, utility::string_t additionalMetadata, std::shared_ptr file); + pplx::task uploadFile(int64_t petId, utility::string_t additionalMetadata, std::shared_ptr file); protected: std::shared_ptr m_ApiClient; diff --git a/samples/client/petstore/cpprest/api/StoreApi.cpp b/samples/client/petstore/cpprest/api/StoreApi.cpp index 40a6b8cfb71..0834a0c5b5b 100644 --- a/samples/client/petstore/cpprest/api/StoreApi.cpp +++ b/samples/client/petstore/cpprest/api/StoreApi.cpp @@ -1,9 +1,9 @@ /** * Swagger Petstore - * This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters. + * This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters * * OpenAPI spec version: 1.0.0 - * Contact: apiteam@swagger.io + * Contact: apiteam@wordnik.com * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git @@ -50,8 +50,8 @@ pplx::task StoreApi::deleteOrder(utility::string_t orderId) std::map> fileParams; std::unordered_set responseHttpContentTypes; - responseHttpContentTypes.insert( U("application/xml") ); responseHttpContentTypes.insert( U("application/json") ); + responseHttpContentTypes.insert( U("application/xml") ); utility::string_t responseHttpContentType; @@ -150,6 +150,7 @@ pplx::task> StoreApi::getInventory() std::unordered_set responseHttpContentTypes; responseHttpContentTypes.insert( U("application/json") ); + responseHttpContentTypes.insert( U("application/xml") ); utility::string_t responseHttpContentType; @@ -265,7 +266,7 @@ pplx::task> StoreApi::getInventory() return result; }); } -pplx::task> StoreApi::getOrderById(int64_t orderId) +pplx::task> StoreApi::getOrderById(utility::string_t orderId) { @@ -279,8 +280,8 @@ pplx::task> StoreApi::getOrderById(int64_t orderId) std::map> fileParams; std::unordered_set responseHttpContentTypes; - responseHttpContentTypes.insert( U("application/xml") ); responseHttpContentTypes.insert( U("application/json") ); + responseHttpContentTypes.insert( U("application/xml") ); utility::string_t responseHttpContentType; @@ -386,12 +387,6 @@ 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"); @@ -402,8 +397,8 @@ pplx::task> StoreApi::placeOrder(std::shared_ptr b std::map> fileParams; std::unordered_set responseHttpContentTypes; - responseHttpContentTypes.insert( U("application/xml") ); responseHttpContentTypes.insert( U("application/json") ); + responseHttpContentTypes.insert( U("application/xml") ); utility::string_t responseHttpContentType; diff --git a/samples/client/petstore/cpprest/api/StoreApi.h b/samples/client/petstore/cpprest/api/StoreApi.h index 60ec088b326..f752b02e78d 100644 --- a/samples/client/petstore/cpprest/api/StoreApi.h +++ b/samples/client/petstore/cpprest/api/StoreApi.h @@ -1,9 +1,9 @@ /** * Swagger Petstore - * This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters. + * This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters * * OpenAPI spec version: 1.0.0 - * Contact: apiteam@swagger.io + * Contact: apiteam@wordnik.com * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git @@ -61,14 +61,14 @@ public: /// For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions /// /// ID of pet that needs to be fetched - pplx::task> getOrderById(int64_t orderId); + pplx::task> getOrderById(utility::string_t orderId); /// /// Place an order for a pet /// /// /// /// - /// order placed for purchasing the pet + /// order placed for purchasing the pet (optional) pplx::task> placeOrder(std::shared_ptr body); protected: diff --git a/samples/client/petstore/cpprest/api/UserApi.cpp b/samples/client/petstore/cpprest/api/UserApi.cpp index 289295a36b5..41ba81e60d4 100644 --- a/samples/client/petstore/cpprest/api/UserApi.cpp +++ b/samples/client/petstore/cpprest/api/UserApi.cpp @@ -1,9 +1,9 @@ /** * Swagger Petstore - * This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters. + * This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters * * OpenAPI spec version: 1.0.0 - * Contact: apiteam@swagger.io + * Contact: apiteam@wordnik.com * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git @@ -39,12 +39,6 @@ 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"); @@ -55,8 +49,8 @@ pplx::task UserApi::createUser(std::shared_ptr body) std::map> fileParams; std::unordered_set responseHttpContentTypes; - responseHttpContentTypes.insert( U("application/xml") ); responseHttpContentTypes.insert( U("application/json") ); + responseHttpContentTypes.insert( U("application/xml") ); utility::string_t responseHttpContentType; @@ -167,8 +161,8 @@ pplx::task UserApi::createUsersWithArrayInput(std::vector> fileParams; std::unordered_set responseHttpContentTypes; - responseHttpContentTypes.insert( U("application/xml") ); responseHttpContentTypes.insert( U("application/json") ); + responseHttpContentTypes.insert( U("application/xml") ); utility::string_t responseHttpContentType; @@ -292,8 +286,8 @@ pplx::task UserApi::createUsersWithListInput(std::vector> fileParams; std::unordered_set responseHttpContentTypes; - responseHttpContentTypes.insert( U("application/xml") ); responseHttpContentTypes.insert( U("application/json") ); + responseHttpContentTypes.insert( U("application/xml") ); utility::string_t responseHttpContentType; @@ -418,8 +412,8 @@ pplx::task UserApi::deleteUser(utility::string_t username) std::map> fileParams; std::unordered_set responseHttpContentTypes; - responseHttpContentTypes.insert( U("application/xml") ); responseHttpContentTypes.insert( U("application/json") ); + responseHttpContentTypes.insert( U("application/xml") ); utility::string_t responseHttpContentType; @@ -518,8 +512,8 @@ pplx::task> UserApi::getUserByName(utility::string_t usern std::map> fileParams; std::unordered_set responseHttpContentTypes; - responseHttpContentTypes.insert( U("application/xml") ); responseHttpContentTypes.insert( U("application/json") ); + responseHttpContentTypes.insert( U("application/xml") ); utility::string_t responseHttpContentType; @@ -635,8 +629,8 @@ pplx::task UserApi::loginUser(utility::string_t username, uti std::map> fileParams; std::unordered_set responseHttpContentTypes; - responseHttpContentTypes.insert( U("application/xml") ); responseHttpContentTypes.insert( U("application/json") ); + responseHttpContentTypes.insert( U("application/xml") ); utility::string_t responseHttpContentType; @@ -770,8 +764,8 @@ pplx::task UserApi::logoutUser() std::map> fileParams; std::unordered_set responseHttpContentTypes; - responseHttpContentTypes.insert( U("application/xml") ); responseHttpContentTypes.insert( U("application/json") ); + responseHttpContentTypes.insert( U("application/xml") ); utility::string_t responseHttpContentType; @@ -859,12 +853,6 @@ 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}"); @@ -876,8 +864,8 @@ pplx::task UserApi::updateUser(utility::string_t username, std::shared_ptr std::map> fileParams; std::unordered_set responseHttpContentTypes; - responseHttpContentTypes.insert( U("application/xml") ); responseHttpContentTypes.insert( U("application/json") ); + responseHttpContentTypes.insert( U("application/xml") ); utility::string_t responseHttpContentType; diff --git a/samples/client/petstore/cpprest/api/UserApi.h b/samples/client/petstore/cpprest/api/UserApi.h index e94de1a1241..cd7e5cba4da 100644 --- a/samples/client/petstore/cpprest/api/UserApi.h +++ b/samples/client/petstore/cpprest/api/UserApi.h @@ -1,9 +1,9 @@ /** * Swagger Petstore - * This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters. + * This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters * * OpenAPI spec version: 1.0.0 - * Contact: apiteam@swagger.io + * Contact: apiteam@wordnik.com * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git @@ -44,7 +44,7 @@ public: /// /// This can only be done by the logged in user. /// - /// Created user object + /// Created user object (optional) pplx::task createUser(std::shared_ptr body); /// /// Creates list of users with given input array @@ -52,7 +52,7 @@ public: /// /// /// - /// List of user object + /// List of user object (optional) pplx::task createUsersWithArrayInput(std::vector> body); /// /// Creates list of users with given input array @@ -60,7 +60,7 @@ public: /// /// /// - /// List of user object + /// List of user object (optional) pplx::task createUsersWithListInput(std::vector> body); /// /// Delete user @@ -84,7 +84,7 @@ public: /// /// /// - /// The user name for login/// The password for login in clear text + /// The user name for login (optional)/// The password for login in clear text (optional) pplx::task loginUser(utility::string_t username, utility::string_t password); /// /// Logs out current logged in user session @@ -100,7 +100,7 @@ public: /// /// This can only be done by the logged in user. /// - /// name that need to be deleted/// Updated user object + /// name that need to be deleted/// Updated user object (optional) pplx::task updateUser(utility::string_t username, std::shared_ptr body); protected: diff --git a/samples/client/petstore/cpprest/model/Category.cpp b/samples/client/petstore/cpprest/model/Category.cpp index bdb6d8e894a..560cf9070dc 100644 --- a/samples/client/petstore/cpprest/model/Category.cpp +++ b/samples/client/petstore/cpprest/model/Category.cpp @@ -1,9 +1,9 @@ /** * Swagger Petstore - * This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters. + * This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters * * OpenAPI spec version: 1.0.0 - * Contact: apiteam@swagger.io + * Contact: apiteam@wordnik.com * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git diff --git a/samples/client/petstore/cpprest/model/Category.h b/samples/client/petstore/cpprest/model/Category.h index 80e759424a9..4423f489458 100644 --- a/samples/client/petstore/cpprest/model/Category.h +++ b/samples/client/petstore/cpprest/model/Category.h @@ -1,9 +1,9 @@ /** * Swagger Petstore - * This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters. + * This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters * * OpenAPI spec version: 1.0.0 - * Contact: apiteam@swagger.io + * Contact: apiteam@wordnik.com * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git @@ -13,7 +13,7 @@ /* * Category.h * - * A category for a pet + * */ #ifndef Category_H_ @@ -30,7 +30,7 @@ namespace client { namespace model { /// -/// A category for a pet +/// /// class Category : public ModelBase diff --git a/samples/client/petstore/cpprest/model/Order.cpp b/samples/client/petstore/cpprest/model/Order.cpp index e21d867cd7e..86d26aae977 100644 --- a/samples/client/petstore/cpprest/model/Order.cpp +++ b/samples/client/petstore/cpprest/model/Order.cpp @@ -1,9 +1,9 @@ /** * Swagger Petstore - * This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters. + * This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters * * OpenAPI spec version: 1.0.0 - * Contact: apiteam@swagger.io + * Contact: apiteam@wordnik.com * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git diff --git a/samples/client/petstore/cpprest/model/Order.h b/samples/client/petstore/cpprest/model/Order.h index b8f22de9f47..f5d950b8b8f 100644 --- a/samples/client/petstore/cpprest/model/Order.h +++ b/samples/client/petstore/cpprest/model/Order.h @@ -1,9 +1,9 @@ /** * Swagger Petstore - * This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters. + * This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters * * OpenAPI spec version: 1.0.0 - * Contact: apiteam@swagger.io + * Contact: apiteam@wordnik.com * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git @@ -13,7 +13,7 @@ /* * Order.h * - * An order for a pets from the pet store + * */ #ifndef Order_H_ @@ -30,7 +30,7 @@ namespace client { namespace model { /// -/// An order for a pets from the pet store +/// /// class Order : public ModelBase diff --git a/samples/client/petstore/cpprest/model/Pet.cpp b/samples/client/petstore/cpprest/model/Pet.cpp index 51dd6d883e9..8aec0bf3663 100644 --- a/samples/client/petstore/cpprest/model/Pet.cpp +++ b/samples/client/petstore/cpprest/model/Pet.cpp @@ -1,9 +1,9 @@ /** * Swagger Petstore - * This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters. + * This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters * * OpenAPI spec version: 1.0.0 - * Contact: apiteam@swagger.io + * Contact: apiteam@wordnik.com * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git diff --git a/samples/client/petstore/cpprest/model/Pet.h b/samples/client/petstore/cpprest/model/Pet.h index 065c46bdb93..8fb6958a632 100644 --- a/samples/client/petstore/cpprest/model/Pet.h +++ b/samples/client/petstore/cpprest/model/Pet.h @@ -1,9 +1,9 @@ /** * Swagger Petstore - * This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters. + * This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters * * OpenAPI spec version: 1.0.0 - * Contact: apiteam@swagger.io + * Contact: apiteam@wordnik.com * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git @@ -13,7 +13,7 @@ /* * Pet.h * - * A pet for sale in the pet store + * */ #ifndef Pet_H_ @@ -33,7 +33,7 @@ namespace client { namespace model { /// -/// A pet for sale in the pet store +/// /// class Pet : public ModelBase diff --git a/samples/client/petstore/cpprest/model/Tag.cpp b/samples/client/petstore/cpprest/model/Tag.cpp index 3cb0798c99e..faff276fd27 100644 --- a/samples/client/petstore/cpprest/model/Tag.cpp +++ b/samples/client/petstore/cpprest/model/Tag.cpp @@ -1,9 +1,9 @@ /** * Swagger Petstore - * This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters. + * This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters * * OpenAPI spec version: 1.0.0 - * Contact: apiteam@swagger.io + * Contact: apiteam@wordnik.com * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git diff --git a/samples/client/petstore/cpprest/model/Tag.h b/samples/client/petstore/cpprest/model/Tag.h index a977ca07980..a429241f59f 100644 --- a/samples/client/petstore/cpprest/model/Tag.h +++ b/samples/client/petstore/cpprest/model/Tag.h @@ -1,9 +1,9 @@ /** * Swagger Petstore - * This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters. + * This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters * * OpenAPI spec version: 1.0.0 - * Contact: apiteam@swagger.io + * Contact: apiteam@wordnik.com * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git @@ -13,7 +13,7 @@ /* * Tag.h * - * A tag for a pet + * */ #ifndef Tag_H_ @@ -30,7 +30,7 @@ namespace client { namespace model { /// -/// A tag for a pet +/// /// class Tag : public ModelBase diff --git a/samples/client/petstore/cpprest/model/User.cpp b/samples/client/petstore/cpprest/model/User.cpp index 1ea09f35b50..54780080036 100644 --- a/samples/client/petstore/cpprest/model/User.cpp +++ b/samples/client/petstore/cpprest/model/User.cpp @@ -1,9 +1,9 @@ /** * Swagger Petstore - * This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters. + * This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters * * OpenAPI spec version: 1.0.0 - * Contact: apiteam@swagger.io + * Contact: apiteam@wordnik.com * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git diff --git a/samples/client/petstore/cpprest/model/User.h b/samples/client/petstore/cpprest/model/User.h index 83b2120a360..10e18fd68b6 100644 --- a/samples/client/petstore/cpprest/model/User.h +++ b/samples/client/petstore/cpprest/model/User.h @@ -1,9 +1,9 @@ /** * Swagger Petstore - * This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters. + * This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters * * OpenAPI spec version: 1.0.0 - * Contact: apiteam@swagger.io + * Contact: apiteam@wordnik.com * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git @@ -13,7 +13,7 @@ /* * User.h * - * A User who is purchasing from the pet store + * */ #ifndef User_H_ @@ -30,7 +30,7 @@ namespace client { namespace model { /// -/// A User who is purchasing from the pet store +/// /// class User : public ModelBase From aa8546893282309dcb85a67b4dc02c7d63879dc5 Mon Sep 17 00:00:00 2001 From: wing328 Date: Mon, 24 Apr 2017 22:45:16 +0800 Subject: [PATCH 2/3] remove trailing space in cpprest, update samples --- .../resources/cpprest/api-source.mustache | 4 +- samples/client/petstore/cpprest/ApiClient.cpp | 29 ++++++-- samples/client/petstore/cpprest/ApiClient.h | 5 +- .../petstore/cpprest/ApiConfiguration.cpp | 4 +- .../petstore/cpprest/ApiConfiguration.h | 4 +- .../client/petstore/cpprest/ApiException.cpp | 4 +- .../client/petstore/cpprest/ApiException.h | 4 +- .../client/petstore/cpprest/HttpContent.cpp | 4 +- samples/client/petstore/cpprest/HttpContent.h | 4 +- samples/client/petstore/cpprest/IHttpBody.h | 4 +- samples/client/petstore/cpprest/JsonBody.cpp | 4 +- samples/client/petstore/cpprest/JsonBody.h | 4 +- samples/client/petstore/cpprest/ModelBase.cpp | 17 ++++- samples/client/petstore/cpprest/ModelBase.h | 6 +- .../petstore/cpprest/MultipartFormData.cpp | 4 +- .../petstore/cpprest/MultipartFormData.h | 4 +- .../client/petstore/cpprest/api/PetApi.cpp | 73 +++++++++++++------ samples/client/petstore/cpprest/api/PetApi.h | 21 +++--- .../client/petstore/cpprest/api/StoreApi.cpp | 27 ++++--- .../client/petstore/cpprest/api/StoreApi.h | 8 +- .../client/petstore/cpprest/api/UserApi.cpp | 48 +++++++----- samples/client/petstore/cpprest/api/UserApi.h | 14 ++-- .../petstore/cpprest/model/Category.cpp | 4 +- .../client/petstore/cpprest/model/Category.h | 8 +- .../client/petstore/cpprest/model/Order.cpp | 4 +- samples/client/petstore/cpprest/model/Order.h | 8 +- samples/client/petstore/cpprest/model/Pet.cpp | 4 +- samples/client/petstore/cpprest/model/Pet.h | 8 +- samples/client/petstore/cpprest/model/Tag.cpp | 4 +- samples/client/petstore/cpprest/model/Tag.h | 8 +- .../client/petstore/cpprest/model/User.cpp | 4 +- samples/client/petstore/cpprest/model/User.h | 8 +- 32 files changed, 217 insertions(+), 139 deletions(-) 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/samples/client/petstore/cpprest/ApiClient.cpp b/samples/client/petstore/cpprest/ApiClient.cpp index 276e37c121c..aeed9ef42ae 100644 --- a/samples/client/petstore/cpprest/ApiClient.cpp +++ b/samples/client/petstore/cpprest/ApiClient.cpp @@ -1,9 +1,9 @@ /** * Swagger Petstore - * This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters + * This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters. * * OpenAPI spec version: 1.0.0 - * Contact: apiteam@wordnik.com + * Contact: apiteam@swagger.io * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git @@ -56,6 +56,11 @@ utility::string_t ApiClient::parameterToString(int32_t 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)); +} + utility::string_t ApiClient::parameterToString(const utility::datetime &value) { return utility::conversions::to_string_t(value.to_string(utility::datetime::ISO_8601)); @@ -124,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 a22d9ae494e..1f38c864f0e 100644 --- a/samples/client/petstore/cpprest/ApiClient.h +++ b/samples/client/petstore/cpprest/ApiClient.h @@ -1,9 +1,9 @@ /** * Swagger Petstore - * This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters + * This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters. * * OpenAPI spec version: 1.0.0 - * Contact: apiteam@wordnik.com + * Contact: apiteam@swagger.io * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git @@ -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/ApiConfiguration.cpp b/samples/client/petstore/cpprest/ApiConfiguration.cpp index ddbc1bc3eb2..1520a56d347 100644 --- a/samples/client/petstore/cpprest/ApiConfiguration.cpp +++ b/samples/client/petstore/cpprest/ApiConfiguration.cpp @@ -1,9 +1,9 @@ /** * Swagger Petstore - * This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters + * This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters. * * OpenAPI spec version: 1.0.0 - * Contact: apiteam@wordnik.com + * Contact: apiteam@swagger.io * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git diff --git a/samples/client/petstore/cpprest/ApiConfiguration.h b/samples/client/petstore/cpprest/ApiConfiguration.h index cef9cbff0cb..0574783f690 100644 --- a/samples/client/petstore/cpprest/ApiConfiguration.h +++ b/samples/client/petstore/cpprest/ApiConfiguration.h @@ -1,9 +1,9 @@ /** * Swagger Petstore - * This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters + * This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters. * * OpenAPI spec version: 1.0.0 - * Contact: apiteam@wordnik.com + * Contact: apiteam@swagger.io * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git diff --git a/samples/client/petstore/cpprest/ApiException.cpp b/samples/client/petstore/cpprest/ApiException.cpp index 8e3646eb973..5ddf808f9f0 100644 --- a/samples/client/petstore/cpprest/ApiException.cpp +++ b/samples/client/petstore/cpprest/ApiException.cpp @@ -1,9 +1,9 @@ /** * Swagger Petstore - * This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters + * This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters. * * OpenAPI spec version: 1.0.0 - * Contact: apiteam@wordnik.com + * Contact: apiteam@swagger.io * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git diff --git a/samples/client/petstore/cpprest/ApiException.h b/samples/client/petstore/cpprest/ApiException.h index 43d0746ca41..835752ea75b 100644 --- a/samples/client/petstore/cpprest/ApiException.h +++ b/samples/client/petstore/cpprest/ApiException.h @@ -1,9 +1,9 @@ /** * Swagger Petstore - * This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters + * This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters. * * OpenAPI spec version: 1.0.0 - * Contact: apiteam@wordnik.com + * Contact: apiteam@swagger.io * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git diff --git a/samples/client/petstore/cpprest/HttpContent.cpp b/samples/client/petstore/cpprest/HttpContent.cpp index b6e9ff911c1..e9a619d7753 100644 --- a/samples/client/petstore/cpprest/HttpContent.cpp +++ b/samples/client/petstore/cpprest/HttpContent.cpp @@ -1,9 +1,9 @@ /** * Swagger Petstore - * This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters + * This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters. * * OpenAPI spec version: 1.0.0 - * Contact: apiteam@wordnik.com + * Contact: apiteam@swagger.io * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git diff --git a/samples/client/petstore/cpprest/HttpContent.h b/samples/client/petstore/cpprest/HttpContent.h index a07f5d14e79..6b7bae0a5f7 100644 --- a/samples/client/petstore/cpprest/HttpContent.h +++ b/samples/client/petstore/cpprest/HttpContent.h @@ -1,9 +1,9 @@ /** * Swagger Petstore - * This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters + * This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters. * * OpenAPI spec version: 1.0.0 - * Contact: apiteam@wordnik.com + * Contact: apiteam@swagger.io * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git diff --git a/samples/client/petstore/cpprest/IHttpBody.h b/samples/client/petstore/cpprest/IHttpBody.h index 1d320e2f809..0ccf80876e9 100644 --- a/samples/client/petstore/cpprest/IHttpBody.h +++ b/samples/client/petstore/cpprest/IHttpBody.h @@ -1,9 +1,9 @@ /** * Swagger Petstore - * This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters + * This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters. * * OpenAPI spec version: 1.0.0 - * Contact: apiteam@wordnik.com + * Contact: apiteam@swagger.io * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git diff --git a/samples/client/petstore/cpprest/JsonBody.cpp b/samples/client/petstore/cpprest/JsonBody.cpp index 554953f40cc..41ce32702c3 100644 --- a/samples/client/petstore/cpprest/JsonBody.cpp +++ b/samples/client/petstore/cpprest/JsonBody.cpp @@ -1,9 +1,9 @@ /** * Swagger Petstore - * This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters + * This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters. * * OpenAPI spec version: 1.0.0 - * Contact: apiteam@wordnik.com + * Contact: apiteam@swagger.io * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git diff --git a/samples/client/petstore/cpprest/JsonBody.h b/samples/client/petstore/cpprest/JsonBody.h index 86ee4459c72..335be0a72b6 100644 --- a/samples/client/petstore/cpprest/JsonBody.h +++ b/samples/client/petstore/cpprest/JsonBody.h @@ -1,9 +1,9 @@ /** * Swagger Petstore - * This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters + * This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters. * * OpenAPI spec version: 1.0.0 - * Contact: apiteam@wordnik.com + * Contact: apiteam@swagger.io * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git diff --git a/samples/client/petstore/cpprest/ModelBase.cpp b/samples/client/petstore/cpprest/ModelBase.cpp index e0050e763ac..07f44a15a0e 100644 --- a/samples/client/petstore/cpprest/ModelBase.cpp +++ b/samples/client/petstore/cpprest/ModelBase.cpp @@ -1,9 +1,9 @@ /** * Swagger Petstore - * This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters + * This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters. * * OpenAPI spec version: 1.0.0 - * Contact: apiteam@wordnik.com + * Contact: apiteam@swagger.io * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git @@ -283,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(""); @@ -319,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 ba62e9a42dc..558d403b15d 100644 --- a/samples/client/petstore/cpprest/ModelBase.h +++ b/samples/client/petstore/cpprest/ModelBase.h @@ -1,9 +1,9 @@ /** * Swagger Petstore - * This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters + * This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters. * * OpenAPI spec version: 1.0.0 - * Contact: apiteam@wordnik.com + * Contact: apiteam@swagger.io * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git @@ -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/MultipartFormData.cpp b/samples/client/petstore/cpprest/MultipartFormData.cpp index ba4ec6537fd..a7e5f56c9f9 100644 --- a/samples/client/petstore/cpprest/MultipartFormData.cpp +++ b/samples/client/petstore/cpprest/MultipartFormData.cpp @@ -1,9 +1,9 @@ /** * Swagger Petstore - * This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters + * This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters. * * OpenAPI spec version: 1.0.0 - * Contact: apiteam@wordnik.com + * Contact: apiteam@swagger.io * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git diff --git a/samples/client/petstore/cpprest/MultipartFormData.h b/samples/client/petstore/cpprest/MultipartFormData.h index 997ed75e211..63b84dcb3a9 100644 --- a/samples/client/petstore/cpprest/MultipartFormData.h +++ b/samples/client/petstore/cpprest/MultipartFormData.h @@ -1,9 +1,9 @@ /** * Swagger Petstore - * This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters + * This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters. * * OpenAPI spec version: 1.0.0 - * Contact: apiteam@wordnik.com + * Contact: apiteam@swagger.io * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git diff --git a/samples/client/petstore/cpprest/api/PetApi.cpp b/samples/client/petstore/cpprest/api/PetApi.cpp index 49ce1d90891..a5e3d57c70b 100644 --- a/samples/client/petstore/cpprest/api/PetApi.cpp +++ b/samples/client/petstore/cpprest/api/PetApi.cpp @@ -1,9 +1,9 @@ /** * Swagger Petstore - * This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters + * This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters. * * OpenAPI spec version: 1.0.0 - * Contact: apiteam@wordnik.com + * Contact: apiteam@swagger.io * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git @@ -38,7 +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"); @@ -49,8 +55,8 @@ pplx::task PetApi::addPet(std::shared_ptr body) std::map> fileParams; std::unordered_set responseHttpContentTypes; - responseHttpContentTypes.insert( U("application/json") ); responseHttpContentTypes.insert( U("application/xml") ); + responseHttpContentTypes.insert( U("application/json") ); utility::string_t responseHttpContentType; @@ -154,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}"); @@ -166,8 +172,8 @@ pplx::task PetApi::deletePet(int64_t petId, utility::string_t apiKey) std::map> fileParams; std::unordered_set responseHttpContentTypes; - responseHttpContentTypes.insert( U("application/json") ); responseHttpContentTypes.insert( U("application/xml") ); + responseHttpContentTypes.insert( U("application/json") ); utility::string_t responseHttpContentType; @@ -260,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"); @@ -271,8 +277,8 @@ pplx::task>> PetApi::findPetsByStatus(std::vect std::map> fileParams; std::unordered_set responseHttpContentTypes; - responseHttpContentTypes.insert( U("application/json") ); responseHttpContentTypes.insert( U("application/xml") ); + responseHttpContentTypes.insert( U("application/json") ); utility::string_t responseHttpContentType; @@ -390,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"); @@ -401,8 +407,8 @@ pplx::task>> PetApi::findPetsByTags(std::vector std::map> fileParams; std::unordered_set responseHttpContentTypes; - responseHttpContentTypes.insert( U("application/json") ); responseHttpContentTypes.insert( U("application/xml") ); + responseHttpContentTypes.insert( U("application/json") ); utility::string_t responseHttpContentType; @@ -520,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}"); @@ -532,8 +538,8 @@ pplx::task> PetApi::getPetById(int64_t petId) std::map> fileParams; std::unordered_set responseHttpContentTypes; - responseHttpContentTypes.insert( U("application/json") ); responseHttpContentTypes.insert( U("application/xml") ); + responseHttpContentTypes.insert( U("application/json") ); utility::string_t responseHttpContentType; @@ -583,8 +589,6 @@ pplx::task> PetApi::getPetById(int64_t petId) //Set the request content type in the header. headerParams[U("Content-Type")] = requestHttpContentType; - // authentication (petstore_auth) required - // oauth2 authentication is added automatically as part of the http_client_config // authentication (api_key) required { utility::string_t apiKey = apiConfiguration->getApiKey(U("api_key")); @@ -648,7 +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"); @@ -659,8 +669,8 @@ pplx::task PetApi::updatePet(std::shared_ptr body) std::map> fileParams; std::unordered_set responseHttpContentTypes; - responseHttpContentTypes.insert( U("application/json") ); responseHttpContentTypes.insert( U("application/xml") ); + responseHttpContentTypes.insert( U("application/json") ); utility::string_t responseHttpContentType; @@ -762,9 +772,9 @@ pplx::task PetApi::updatePet(std::shared_ptr body) return void(); }); } -pplx::task PetApi::updatePetWithForm(utility::string_t petId, utility::string_t name, utility::string_t status) +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}"); @@ -776,8 +786,8 @@ pplx::task PetApi::updatePetWithForm(utility::string_t petId, utility::str std::map> fileParams; std::unordered_set responseHttpContentTypes; - responseHttpContentTypes.insert( U("application/json") ); responseHttpContentTypes.insert( U("application/xml") ); + responseHttpContentTypes.insert( U("application/json") ); utility::string_t responseHttpContentType; @@ -873,9 +883,9 @@ pplx::task PetApi::updatePetWithForm(utility::string_t petId, utility::str return void(); }); } -pplx::task PetApi::uploadFile(int64_t petId, utility::string_t additionalMetadata, std::shared_ptr file) +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"); @@ -888,7 +898,6 @@ pplx::task PetApi::uploadFile(int64_t petId, utility::string_t additionalM std::unordered_set responseHttpContentTypes; responseHttpContentTypes.insert( U("application/json") ); - responseHttpContentTypes.insert( U("application/xml") ); utility::string_t responseHttpContentType; @@ -981,7 +990,25 @@ pplx::task PetApi::uploadFile(int64_t petId, utility::string_t additionalM }) .then([=](utility::string_t response) { - return void(); + std::shared_ptr result(new ApiResponse()); + + if(responseHttpContentType == U("application/json")) + { + web::json::value json = web::json::value::parse(response); + + result->fromJson(json); + } + // else if(responseHttpContentType == U("multipart/form-data")) + // { + // TODO multipart response parsing + // } + else + { + throw ApiException(500 + , U("error calling uploadFile: unsupported response type")); + } + + return result; }); } diff --git a/samples/client/petstore/cpprest/api/PetApi.h b/samples/client/petstore/cpprest/api/PetApi.h index 067b09f65c5..d60c3c80fca 100644 --- a/samples/client/petstore/cpprest/api/PetApi.h +++ b/samples/client/petstore/cpprest/api/PetApi.h @@ -1,9 +1,9 @@ /** * Swagger Petstore - * This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters + * This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters. * * OpenAPI spec version: 1.0.0 - * Contact: apiteam@wordnik.com + * Contact: apiteam@swagger.io * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git @@ -22,6 +22,7 @@ #include "ApiClient.h" +#include "ApiResponse.h" #include "HttpContent.h" #include "Pet.h" #include @@ -44,7 +45,7 @@ public: /// /// /// - /// Pet object that needs to be added to the store (optional) + /// Pet object that needs to be added to the store pplx::task addPet(std::shared_ptr body); /// /// Deletes a pet @@ -60,7 +61,7 @@ public: /// /// Multiple status values can be provided with comma separated strings /// - /// Status values that need to be considered for filter (optional, default to available) + /// Status values that need to be considered for filter pplx::task>> findPetsByStatus(std::vector status); /// /// Finds Pets by tags @@ -68,15 +69,15 @@ public: /// /// Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. /// - /// Tags to filter by (optional) + /// Tags to filter by pplx::task>> findPetsByTags(std::vector tags); /// /// Find pet by ID /// /// - /// Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions + /// Returns a single pet /// - /// ID of pet that needs to be fetched + /// ID of pet to return pplx::task> getPetById(int64_t petId); /// /// Update an existing pet @@ -84,7 +85,7 @@ public: /// /// /// - /// Pet object that needs to be added to the store (optional) + /// Pet object that needs to be added to the store pplx::task updatePet(std::shared_ptr body); /// /// Updates a pet in the store with form data @@ -93,7 +94,7 @@ public: /// /// /// ID of pet that needs to be updated/// Updated name of the pet (optional)/// Updated status of the pet (optional) - pplx::task updatePetWithForm(utility::string_t petId, utility::string_t name, utility::string_t status); + pplx::task updatePetWithForm(int64_t petId, utility::string_t name, utility::string_t status); /// /// uploads an image /// @@ -101,7 +102,7 @@ public: /// /// /// ID of pet to update/// Additional data to pass to server (optional)/// file to upload (optional) - pplx::task uploadFile(int64_t petId, utility::string_t additionalMetadata, std::shared_ptr file); + pplx::task> uploadFile(int64_t petId, utility::string_t additionalMetadata, std::shared_ptr file); protected: std::shared_ptr m_ApiClient; diff --git a/samples/client/petstore/cpprest/api/StoreApi.cpp b/samples/client/petstore/cpprest/api/StoreApi.cpp index 0834a0c5b5b..d418af4fa4c 100644 --- a/samples/client/petstore/cpprest/api/StoreApi.cpp +++ b/samples/client/petstore/cpprest/api/StoreApi.cpp @@ -1,9 +1,9 @@ /** * Swagger Petstore - * This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters + * This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters. * * OpenAPI spec version: 1.0.0 - * Contact: apiteam@wordnik.com + * Contact: apiteam@swagger.io * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git @@ -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}"); @@ -50,8 +50,8 @@ pplx::task StoreApi::deleteOrder(utility::string_t orderId) std::map> fileParams; std::unordered_set responseHttpContentTypes; - responseHttpContentTypes.insert( U("application/json") ); responseHttpContentTypes.insert( U("application/xml") ); + responseHttpContentTypes.insert( U("application/json") ); utility::string_t responseHttpContentType; @@ -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"); @@ -150,7 +150,6 @@ pplx::task> StoreApi::getInventory() std::unordered_set responseHttpContentTypes; responseHttpContentTypes.insert( U("application/json") ); - responseHttpContentTypes.insert( U("application/xml") ); utility::string_t responseHttpContentType; @@ -266,9 +265,9 @@ pplx::task> StoreApi::getInventory() return result; }); } -pplx::task> StoreApi::getOrderById(utility::string_t orderId) +pplx::task> StoreApi::getOrderById(int64_t orderId) { - + std::shared_ptr apiConfiguration( m_ApiClient->getConfiguration() ); utility::string_t path = U("/store/order/{orderId}"); @@ -280,8 +279,8 @@ pplx::task> StoreApi::getOrderById(utility::string_t orde std::map> fileParams; std::unordered_set responseHttpContentTypes; - responseHttpContentTypes.insert( U("application/json") ); responseHttpContentTypes.insert( U("application/xml") ); + responseHttpContentTypes.insert( U("application/json") ); utility::string_t responseHttpContentType; @@ -386,7 +385,13 @@ pplx::task> StoreApi::getOrderById(utility::string_t orde } 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"); @@ -397,8 +402,8 @@ pplx::task> StoreApi::placeOrder(std::shared_ptr b std::map> fileParams; std::unordered_set responseHttpContentTypes; - responseHttpContentTypes.insert( U("application/json") ); responseHttpContentTypes.insert( U("application/xml") ); + responseHttpContentTypes.insert( U("application/json") ); utility::string_t responseHttpContentType; diff --git a/samples/client/petstore/cpprest/api/StoreApi.h b/samples/client/petstore/cpprest/api/StoreApi.h index f752b02e78d..60ec088b326 100644 --- a/samples/client/petstore/cpprest/api/StoreApi.h +++ b/samples/client/petstore/cpprest/api/StoreApi.h @@ -1,9 +1,9 @@ /** * Swagger Petstore - * This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters + * This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters. * * OpenAPI spec version: 1.0.0 - * Contact: apiteam@wordnik.com + * Contact: apiteam@swagger.io * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git @@ -61,14 +61,14 @@ public: /// For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions /// /// ID of pet that needs to be fetched - pplx::task> getOrderById(utility::string_t orderId); + pplx::task> getOrderById(int64_t orderId); /// /// Place an order for a pet /// /// /// /// - /// order placed for purchasing the pet (optional) + /// order placed for purchasing the pet pplx::task> placeOrder(std::shared_ptr body); protected: diff --git a/samples/client/petstore/cpprest/api/UserApi.cpp b/samples/client/petstore/cpprest/api/UserApi.cpp index 41ba81e60d4..3e0318000f9 100644 --- a/samples/client/petstore/cpprest/api/UserApi.cpp +++ b/samples/client/petstore/cpprest/api/UserApi.cpp @@ -1,9 +1,9 @@ /** * Swagger Petstore - * This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters + * This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters. * * OpenAPI spec version: 1.0.0 - * Contact: apiteam@wordnik.com + * Contact: apiteam@swagger.io * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git @@ -38,7 +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"); @@ -49,8 +55,8 @@ pplx::task UserApi::createUser(std::shared_ptr body) std::map> fileParams; std::unordered_set responseHttpContentTypes; - responseHttpContentTypes.insert( U("application/json") ); responseHttpContentTypes.insert( U("application/xml") ); + responseHttpContentTypes.insert( U("application/json") ); utility::string_t responseHttpContentType; @@ -150,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"); @@ -161,8 +167,8 @@ pplx::task UserApi::createUsersWithArrayInput(std::vector> fileParams; std::unordered_set responseHttpContentTypes; - responseHttpContentTypes.insert( U("application/json") ); responseHttpContentTypes.insert( U("application/xml") ); + responseHttpContentTypes.insert( U("application/json") ); utility::string_t responseHttpContentType; @@ -275,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"); @@ -286,8 +292,8 @@ pplx::task UserApi::createUsersWithListInput(std::vector> fileParams; std::unordered_set responseHttpContentTypes; - responseHttpContentTypes.insert( U("application/json") ); responseHttpContentTypes.insert( U("application/xml") ); + responseHttpContentTypes.insert( U("application/json") ); utility::string_t responseHttpContentType; @@ -400,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}"); @@ -412,8 +418,8 @@ pplx::task UserApi::deleteUser(utility::string_t username) std::map> fileParams; std::unordered_set responseHttpContentTypes; - responseHttpContentTypes.insert( U("application/json") ); responseHttpContentTypes.insert( U("application/xml") ); + responseHttpContentTypes.insert( U("application/json") ); utility::string_t responseHttpContentType; @@ -500,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}"); @@ -512,8 +518,8 @@ pplx::task> UserApi::getUserByName(utility::string_t usern std::map> fileParams; std::unordered_set responseHttpContentTypes; - responseHttpContentTypes.insert( U("application/json") ); responseHttpContentTypes.insert( U("application/xml") ); + responseHttpContentTypes.insert( U("application/json") ); utility::string_t responseHttpContentType; @@ -618,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"); @@ -629,8 +635,8 @@ pplx::task UserApi::loginUser(utility::string_t username, uti std::map> fileParams; std::unordered_set responseHttpContentTypes; - responseHttpContentTypes.insert( U("application/json") ); responseHttpContentTypes.insert( U("application/xml") ); + responseHttpContentTypes.insert( U("application/json") ); utility::string_t responseHttpContentType; @@ -753,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"); @@ -764,8 +770,8 @@ pplx::task UserApi::logoutUser() std::map> fileParams; std::unordered_set responseHttpContentTypes; - responseHttpContentTypes.insert( U("application/json") ); responseHttpContentTypes.insert( U("application/xml") ); + responseHttpContentTypes.insert( U("application/json") ); utility::string_t responseHttpContentType; @@ -852,7 +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}"); @@ -864,8 +876,8 @@ pplx::task UserApi::updateUser(utility::string_t username, std::shared_ptr std::map> fileParams; std::unordered_set responseHttpContentTypes; - responseHttpContentTypes.insert( U("application/json") ); responseHttpContentTypes.insert( U("application/xml") ); + responseHttpContentTypes.insert( U("application/json") ); utility::string_t responseHttpContentType; diff --git a/samples/client/petstore/cpprest/api/UserApi.h b/samples/client/petstore/cpprest/api/UserApi.h index cd7e5cba4da..e94de1a1241 100644 --- a/samples/client/petstore/cpprest/api/UserApi.h +++ b/samples/client/petstore/cpprest/api/UserApi.h @@ -1,9 +1,9 @@ /** * Swagger Petstore - * This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters + * This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters. * * OpenAPI spec version: 1.0.0 - * Contact: apiteam@wordnik.com + * Contact: apiteam@swagger.io * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git @@ -44,7 +44,7 @@ public: /// /// This can only be done by the logged in user. /// - /// Created user object (optional) + /// Created user object pplx::task createUser(std::shared_ptr body); /// /// Creates list of users with given input array @@ -52,7 +52,7 @@ public: /// /// /// - /// List of user object (optional) + /// List of user object pplx::task createUsersWithArrayInput(std::vector> body); /// /// Creates list of users with given input array @@ -60,7 +60,7 @@ public: /// /// /// - /// List of user object (optional) + /// List of user object pplx::task createUsersWithListInput(std::vector> body); /// /// Delete user @@ -84,7 +84,7 @@ public: /// /// /// - /// The user name for login (optional)/// The password for login in clear text (optional) + /// The user name for login/// The password for login in clear text pplx::task loginUser(utility::string_t username, utility::string_t password); /// /// Logs out current logged in user session @@ -100,7 +100,7 @@ public: /// /// This can only be done by the logged in user. /// - /// name that need to be deleted/// Updated user object (optional) + /// name that need to be deleted/// Updated user object pplx::task updateUser(utility::string_t username, std::shared_ptr body); protected: diff --git a/samples/client/petstore/cpprest/model/Category.cpp b/samples/client/petstore/cpprest/model/Category.cpp index 560cf9070dc..bdb6d8e894a 100644 --- a/samples/client/petstore/cpprest/model/Category.cpp +++ b/samples/client/petstore/cpprest/model/Category.cpp @@ -1,9 +1,9 @@ /** * Swagger Petstore - * This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters + * This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters. * * OpenAPI spec version: 1.0.0 - * Contact: apiteam@wordnik.com + * Contact: apiteam@swagger.io * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git diff --git a/samples/client/petstore/cpprest/model/Category.h b/samples/client/petstore/cpprest/model/Category.h index 4423f489458..80e759424a9 100644 --- a/samples/client/petstore/cpprest/model/Category.h +++ b/samples/client/petstore/cpprest/model/Category.h @@ -1,9 +1,9 @@ /** * Swagger Petstore - * This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters + * This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters. * * OpenAPI spec version: 1.0.0 - * Contact: apiteam@wordnik.com + * Contact: apiteam@swagger.io * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git @@ -13,7 +13,7 @@ /* * Category.h * - * + * A category for a pet */ #ifndef Category_H_ @@ -30,7 +30,7 @@ namespace client { namespace model { /// -/// +/// A category for a pet /// class Category : public ModelBase diff --git a/samples/client/petstore/cpprest/model/Order.cpp b/samples/client/petstore/cpprest/model/Order.cpp index 86d26aae977..e21d867cd7e 100644 --- a/samples/client/petstore/cpprest/model/Order.cpp +++ b/samples/client/petstore/cpprest/model/Order.cpp @@ -1,9 +1,9 @@ /** * Swagger Petstore - * This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters + * This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters. * * OpenAPI spec version: 1.0.0 - * Contact: apiteam@wordnik.com + * Contact: apiteam@swagger.io * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git diff --git a/samples/client/petstore/cpprest/model/Order.h b/samples/client/petstore/cpprest/model/Order.h index f5d950b8b8f..b8f22de9f47 100644 --- a/samples/client/petstore/cpprest/model/Order.h +++ b/samples/client/petstore/cpprest/model/Order.h @@ -1,9 +1,9 @@ /** * Swagger Petstore - * This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters + * This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters. * * OpenAPI spec version: 1.0.0 - * Contact: apiteam@wordnik.com + * Contact: apiteam@swagger.io * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git @@ -13,7 +13,7 @@ /* * Order.h * - * + * An order for a pets from the pet store */ #ifndef Order_H_ @@ -30,7 +30,7 @@ namespace client { namespace model { /// -/// +/// An order for a pets from the pet store /// class Order : public ModelBase diff --git a/samples/client/petstore/cpprest/model/Pet.cpp b/samples/client/petstore/cpprest/model/Pet.cpp index 8aec0bf3663..51dd6d883e9 100644 --- a/samples/client/petstore/cpprest/model/Pet.cpp +++ b/samples/client/petstore/cpprest/model/Pet.cpp @@ -1,9 +1,9 @@ /** * Swagger Petstore - * This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters + * This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters. * * OpenAPI spec version: 1.0.0 - * Contact: apiteam@wordnik.com + * Contact: apiteam@swagger.io * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git diff --git a/samples/client/petstore/cpprest/model/Pet.h b/samples/client/petstore/cpprest/model/Pet.h index 8fb6958a632..065c46bdb93 100644 --- a/samples/client/petstore/cpprest/model/Pet.h +++ b/samples/client/petstore/cpprest/model/Pet.h @@ -1,9 +1,9 @@ /** * Swagger Petstore - * This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters + * This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters. * * OpenAPI spec version: 1.0.0 - * Contact: apiteam@wordnik.com + * Contact: apiteam@swagger.io * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git @@ -13,7 +13,7 @@ /* * Pet.h * - * + * A pet for sale in the pet store */ #ifndef Pet_H_ @@ -33,7 +33,7 @@ namespace client { namespace model { /// -/// +/// A pet for sale in the pet store /// class Pet : public ModelBase diff --git a/samples/client/petstore/cpprest/model/Tag.cpp b/samples/client/petstore/cpprest/model/Tag.cpp index faff276fd27..3cb0798c99e 100644 --- a/samples/client/petstore/cpprest/model/Tag.cpp +++ b/samples/client/petstore/cpprest/model/Tag.cpp @@ -1,9 +1,9 @@ /** * Swagger Petstore - * This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters + * This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters. * * OpenAPI spec version: 1.0.0 - * Contact: apiteam@wordnik.com + * Contact: apiteam@swagger.io * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git diff --git a/samples/client/petstore/cpprest/model/Tag.h b/samples/client/petstore/cpprest/model/Tag.h index a429241f59f..a977ca07980 100644 --- a/samples/client/petstore/cpprest/model/Tag.h +++ b/samples/client/petstore/cpprest/model/Tag.h @@ -1,9 +1,9 @@ /** * Swagger Petstore - * This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters + * This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters. * * OpenAPI spec version: 1.0.0 - * Contact: apiteam@wordnik.com + * Contact: apiteam@swagger.io * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git @@ -13,7 +13,7 @@ /* * Tag.h * - * + * A tag for a pet */ #ifndef Tag_H_ @@ -30,7 +30,7 @@ namespace client { namespace model { /// -/// +/// A tag for a pet /// class Tag : public ModelBase diff --git a/samples/client/petstore/cpprest/model/User.cpp b/samples/client/petstore/cpprest/model/User.cpp index 54780080036..1ea09f35b50 100644 --- a/samples/client/petstore/cpprest/model/User.cpp +++ b/samples/client/petstore/cpprest/model/User.cpp @@ -1,9 +1,9 @@ /** * Swagger Petstore - * This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters + * This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters. * * OpenAPI spec version: 1.0.0 - * Contact: apiteam@wordnik.com + * Contact: apiteam@swagger.io * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git diff --git a/samples/client/petstore/cpprest/model/User.h b/samples/client/petstore/cpprest/model/User.h index 10e18fd68b6..83b2120a360 100644 --- a/samples/client/petstore/cpprest/model/User.h +++ b/samples/client/petstore/cpprest/model/User.h @@ -1,9 +1,9 @@ /** * Swagger Petstore - * This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters + * This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters. * * OpenAPI spec version: 1.0.0 - * Contact: apiteam@wordnik.com + * Contact: apiteam@swagger.io * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git @@ -13,7 +13,7 @@ /* * User.h * - * + * A User who is purchasing from the pet store */ #ifndef User_H_ @@ -30,7 +30,7 @@ namespace client { namespace model { /// -/// +/// A User who is purchasing from the pet store /// class User : public ModelBase From c14da15b3ef451a2ed50fdbec88656ed758dc982 Mon Sep 17 00:00:00 2001 From: Kenny Jones Date: Mon, 24 Apr 2017 11:18:04 -0400 Subject: [PATCH 3/3] Feature: Enable validation (#5391) When useBeanValidation is enabled make sure the annotation @Valid is added to the attributes of the model. --- .../JavaSpring/beanValidation.mustache | 3 +- .../JavaSpring/beanValidationCore.mustache | 10 ++--- .../beanValidationQueryParams.mustache | 2 +- .../main/resources/JavaSpring/model.mustache | 2 + .../model/AdditionalPropertiesClass.java | 6 +++ .../main/java/io/swagger/model/Animal.java | 6 +++ .../java/io/swagger/model/AnimalFarm.java | 2 + .../model/ArrayOfArrayOfNumberOnly.java | 4 ++ .../io/swagger/model/ArrayOfNumberOnly.java | 4 ++ .../main/java/io/swagger/model/ArrayTest.java | 8 ++++ .../java/io/swagger/model/Capitalization.java | 14 +++++++ .../src/main/java/io/swagger/model/Cat.java | 4 ++ .../main/java/io/swagger/model/Category.java | 6 +++ .../java/io/swagger/model/ClassModel.java | 4 ++ .../main/java/io/swagger/model/Client.java | 4 ++ .../src/main/java/io/swagger/model/Dog.java | 4 ++ .../java/io/swagger/model/EnumArrays.java | 6 +++ .../main/java/io/swagger/model/EnumClass.java | 2 + .../main/java/io/swagger/model/EnumTest.java | 10 +++++ .../java/io/swagger/model/FormatTest.java | 42 +++++++++++++++---- .../io/swagger/model/HasOnlyReadOnly.java | 6 +++ .../main/java/io/swagger/model/MapTest.java | 6 +++ ...ropertiesAndAdditionalPropertiesClass.java | 8 ++++ .../io/swagger/model/Model200Response.java | 6 +++ .../io/swagger/model/ModelApiResponse.java | 8 ++++ .../java/io/swagger/model/ModelReturn.java | 4 ++ .../src/main/java/io/swagger/model/Name.java | 10 +++++ .../java/io/swagger/model/NumberOnly.java | 4 ++ .../src/main/java/io/swagger/model/Order.java | 14 +++++++ .../main/java/io/swagger/model/OuterEnum.java | 2 + .../src/main/java/io/swagger/model/Pet.java | 14 +++++++ .../java/io/swagger/model/ReadOnlyFirst.java | 6 +++ .../io/swagger/model/SpecialModelName.java | 4 ++ .../src/main/java/io/swagger/model/Tag.java | 6 +++ .../src/main/java/io/swagger/model/User.java | 18 ++++++++ .../model/AdditionalPropertiesClass.java | 6 +++ .../main/java/io/swagger/model/Animal.java | 6 +++ .../java/io/swagger/model/AnimalFarm.java | 2 + .../model/ArrayOfArrayOfNumberOnly.java | 4 ++ .../io/swagger/model/ArrayOfNumberOnly.java | 4 ++ .../main/java/io/swagger/model/ArrayTest.java | 8 ++++ .../java/io/swagger/model/Capitalization.java | 14 +++++++ .../src/main/java/io/swagger/model/Cat.java | 4 ++ .../main/java/io/swagger/model/Category.java | 6 +++ .../java/io/swagger/model/ClassModel.java | 4 ++ .../main/java/io/swagger/model/Client.java | 4 ++ .../src/main/java/io/swagger/model/Dog.java | 4 ++ .../java/io/swagger/model/EnumArrays.java | 6 +++ .../main/java/io/swagger/model/EnumClass.java | 2 + .../main/java/io/swagger/model/EnumTest.java | 10 +++++ .../java/io/swagger/model/FormatTest.java | 42 +++++++++++++++---- .../io/swagger/model/HasOnlyReadOnly.java | 6 +++ .../main/java/io/swagger/model/MapTest.java | 6 +++ ...ropertiesAndAdditionalPropertiesClass.java | 8 ++++ .../io/swagger/model/Model200Response.java | 6 +++ .../io/swagger/model/ModelApiResponse.java | 8 ++++ .../java/io/swagger/model/ModelReturn.java | 4 ++ .../src/main/java/io/swagger/model/Name.java | 10 +++++ .../java/io/swagger/model/NumberOnly.java | 4 ++ .../src/main/java/io/swagger/model/Order.java | 14 +++++++ .../main/java/io/swagger/model/OuterEnum.java | 2 + .../src/main/java/io/swagger/model/Pet.java | 14 +++++++ .../java/io/swagger/model/ReadOnlyFirst.java | 6 +++ .../io/swagger/model/SpecialModelName.java | 4 ++ .../src/main/java/io/swagger/model/Tag.java | 6 +++ .../src/main/java/io/swagger/model/User.java | 18 ++++++++ 66 files changed, 480 insertions(+), 21 deletions(-) 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/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 ad8680a3beb..9d6cf5cd4be 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.joda.time.DateTime; import org.joda.time.LocalDate; +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 DateTime 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 dba1241f6d6..d4cd89cef34 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.joda.time.DateTime; +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 DateTime 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 41dec079587..4106ac36198 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.joda.time.DateTime; +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 DateTime 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/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 ad8680a3beb..9d6cf5cd4be 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.joda.time.DateTime; import org.joda.time.LocalDate; +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 DateTime 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 dba1241f6d6..d4cd89cef34 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.joda.time.DateTime; +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 DateTime 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 41dec079587..4106ac36198 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.joda.time.DateTime; +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 DateTime 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; }