From f406f789781143967d0066065961fcc4904eab56 Mon Sep 17 00:00:00 2001 From: William Cheng Date: Thu, 5 Dec 2024 12:07:14 +0800 Subject: [PATCH] [cpprestsdk] Better code format (#20237) * remove blank lines * fix summary, add line break bwtween vars * update --- .../cpp-rest-sdk-client/model-header.mustache | 70 +++++++++++---- .../cpp-rest-sdk-client/model-source.mustache | 75 +++++++++++----- .../CppRestPetstoreClient/model/ApiResponse.h | 34 ++------ .../CppRestPetstoreClient/model/Category.h | 23 +---- .../CppRestPetstoreClient/model/Order.h | 65 +++----------- .../include/CppRestPetstoreClient/model/Pet.h | 68 +++------------ .../model/SchemaWithSet.h | 21 +---- .../model/SchemaWithSet_vaccinationBook.h | 13 +-- .../include/CppRestPetstoreClient/model/Tag.h | 23 +---- .../CppRestPetstoreClient/model/User.h | 85 ++++--------------- .../CppRestPetstoreClient/model/Vaccine.h | 20 +---- .../client/src/model/ApiResponse.cpp | 16 ---- .../cpp-restsdk/client/src/model/Category.cpp | 12 --- .../src/model/CreateUserOrPet_request.cpp | 2 - .../cpp-restsdk/client/src/model/Order.cpp | 31 ------- .../cpp-restsdk/client/src/model/Pet.cpp | 31 ------- .../client/src/model/SchemaWithSet.cpp | 12 --- .../model/SchemaWithSet_vaccinationBook.cpp | 8 -- .../cpp-restsdk/client/src/model/Tag.cpp | 12 --- .../cpp-restsdk/client/src/model/User.cpp | 36 -------- .../cpp-restsdk/client/src/model/Vaccine.cpp | 12 --- 21 files changed, 177 insertions(+), 492 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/cpp-rest-sdk-client/model-header.mustache b/modules/openapi-generator/src/main/resources/cpp-rest-sdk-client/model-header.mustache index 9536512f0f73..a8d71b425ff4 100644 --- a/modules/openapi-generator/src/main/resources/cpp-rest-sdk-client/model-header.mustache +++ b/modules/openapi-generator/src/main/resources/cpp-rest-sdk-client/model-header.mustache @@ -128,9 +128,11 @@ public: {{/isEnum}} {{^isEnum}} +{{#description}} /// /// {{description}} /// +{{/description}} class {{declspec}} {{classname}} : public {{{parent}}}{{^parent}}ModelBase{{/parent}} { @@ -154,16 +156,26 @@ public: /// {{classname}} members {{! ENUM DEFINITIONS }} - {{#vars}}{{^isInherited}}{{#isEnum}} + {{#vars}} + {{^isInherited}} + {{#isEnum}} enum class {{#isContainer}}{{{enumName}}}{{/isContainer}}{{^isContainer}}{{{datatypeWithEnum}}}{{/isContainer}} { {{#allowableValues}}{{#enumVars}}{{value}}, {{/enumVars}}{{/allowableValues}} }; + {{#description}} /// /// {{description}} /// - {{/isEnum}}{{/isInherited}}{{/vars}}{{#vars}}{{^isInherited}}{{#isEnum}}{{#isContainer}} + {{/description}} + {{/isEnum}} + {{/isInherited}} + {{/vars}} + {{#vars}} + {{^isInherited}} + {{#isEnum}} + {{#isContainer}} {{! ENUM CONVERSIONS }} {{{enumName}}} to{{{enumName}}}(const utility::string_t& value) const; const utility::string_t from{{{enumName}}}(const {{{enumName}}} value) const; @@ -173,41 +185,67 @@ public: {{/isArray}}{{/isContainer}}{{^isContainer}} {{{datatypeWithEnum}}} to{{{datatypeWithEnum}}}(const utility::string_t& value) const; const utility::string_t from{{{datatypeWithEnum}}}(const {{{datatypeWithEnum}}} value) const; - {{/isContainer}}{{/isEnum}}{{/isInherited}}{{/vars}} + {{/isContainer}} + + {{/isEnum}} + {{/isInherited}} + {{/vars}} {{! SETTER AND GETTERS }} - {{#vars}}{{^isInherited}} + {{#vars}} + {{^isInherited}} + {{#description}} /// /// {{description}} /// - {{#isContainer}}{{^isEnum}} + {{/description}} + {{#isContainer}} + {{^isEnum}} {{{dataType}}} {{getter}}() const; - {{/isEnum}}{{/isContainer}}{{^isContainer}}{{^isEnum}} + {{/isEnum}} + {{/isContainer}} + {{^isContainer}} + {{^isEnum}} {{{dataType}}} {{getter}}() const; - {{/isEnum}}{{/isContainer}} - {{#isEnum}}{{^isMap}} + {{/isEnum}} + {{/isContainer}} + {{#isEnum}} + {{^isMap}} {{{datatypeWithEnum}}} {{getter}}() const; - {{/isMap}}{{#isMap}} + {{/isMap}} + {{#isMap}} {{{dataType}}} {{getter}}() const; - {{/isMap}}{{/isEnum}} + {{/isMap}} + {{/isEnum}} bool {{nameInCamelCase}}IsSet() const; void unset{{name}}(); {{#isPrimitiveType}} void {{setter}}({{{dataType}}} value); - {{/isPrimitiveType}}{{^isPrimitiveType}}{{^isEnum}} + {{/isPrimitiveType}} + {{^isPrimitiveType}} + {{^isEnum}} void {{setter}}(const {{{dataType}}}& value); - {{/isEnum}}{{/isPrimitiveType}}{{#isEnum}} + {{/isEnum}} + {{/isPrimitiveType}} + {{#isEnum}} void {{setter}}(const {{^isMap}}{{{datatypeWithEnum}}}{{/isMap}}{{#isMap}}{{{dataType}}}{{/isMap}} value); - {{/isEnum}}{{/isInherited}}{{/vars}} + {{/isEnum}} + {{/isInherited}} + + {{/vars}} protected: {{#vars}} - {{^isInherited}}{{^isEnum}} + {{^isInherited}} + {{^isEnum}} {{{dataType}}} m_{{name}}; - {{/isEnum}}{{#isEnum}} + {{/isEnum}} + {{#isEnum}} {{^isMap}}{{{datatypeWithEnum}}}{{/isMap}}{{#isMap}}{{{dataType}}}{{/isMap}} m_{{name}}; - {{/isEnum}}bool m_{{name}}IsSet; + {{/isEnum}} + bool m_{{name}}IsSet; {{/isInherited}} + {{/vars}} }; diff --git a/modules/openapi-generator/src/main/resources/cpp-rest-sdk-client/model-source.mustache b/modules/openapi-generator/src/main/resources/cpp-rest-sdk-client/model-source.mustache index 175c0401d247..fcb6637804fa 100644 --- a/modules/openapi-generator/src/main/resources/cpp-rest-sdk-client/model-source.mustache +++ b/modules/openapi-generator/src/main/resources/cpp-rest-sdk-client/model-source.mustache @@ -6,7 +6,8 @@ {{#modelNamespaceDeclarations}} namespace {{this}} { {{/modelNamespaceDeclarations}} -{{#oneOf}}{{#-first}} +{{#oneOf}} +{{#-first}} void {{classname}}::validate() { @@ -54,7 +55,8 @@ template bool {{classname}}::fromJson<{{.}}>(const web::json::value& json); template bool {{classname}}::fromMultiPart<{{.}}>(std::shared_ptr multipart, const utility::string_t& namePrefix); {{/oneOf}} -{{/-first}}{{/oneOf}} +{{/-first}} +{{/oneOf}} {{^oneOf}} {{#isEnum}} @@ -218,7 +220,8 @@ web::json::value {{classname}}::toJson() const {{^parent}} web::json::value val = web::json::value::object(); {{/parent}} - {{#vars}}{{^isInherited}} + {{#vars}} + {{^isInherited}} if(m_{{name}}IsSet) { {{#isEnum}}{{#isContainer}}{{#isArray}} @@ -233,7 +236,8 @@ web::json::value {{classname}}::toJson() const val[utility::conversions::to_string_t(U("{{baseName}}"))] = ModelBase::toJson(m_{{name}}); {{/isEnum}} } - {{/isInherited}}{{/vars}} + {{/isInherited}} + {{/vars}} return val; } @@ -244,7 +248,8 @@ bool {{classname}}::fromJson(const web::json::value& val) {{#parent}} ok &= this->{{{.}}}::fromJson(val); {{/parent}} - {{#vars}}{{^isInherited}} + {{#vars}} + {{^isInherited}} if(val.has_field(utility::conversions::to_string_t(U("{{baseName}}")))) { const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("{{baseName}}"))); @@ -263,7 +268,9 @@ bool {{classname}}::fromJson(const web::json::value& val) {{setter}}(to{{{datatypeWithEnum}}}(refVal_{{setter}})); {{/isContainer}}{{/isEnum}} } - }{{/isInherited}}{{/vars}} + } + {{/isInherited}} + {{/vars}} return ok; } @@ -280,13 +287,18 @@ void {{classname}}::toMultipart(std::shared_ptr multipart, co {{^isEnum}} multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("{{baseName}}")), m_{{name}})); {{/isEnum}} - {{#isEnum}}{{#isContainer}}{{#isArray}} + {{#isEnum}} + {{#isContainer}} + {{#isArray}} multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("{{baseName}}")), from{{{enumName}}}(m_{{name}}))); {{/isArray}}{{#isMap}} multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("{{baseName}}")), m_{{name}})); - {{/isMap}}{{/isContainer}}{{^isContainer}} + {{/isMap}} + {{/isContainer}} + {{^isContainer}} multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("{{baseName}}")), from{{{datatypeWithEnum}}}(m_{{name}}))); - {{/isContainer}}{{/isEnum}} + {{/isContainer}} + {{/isEnum}} } {{/vars}} } @@ -308,21 +320,31 @@ bool {{classname}}::fromMultiPart(std::shared_ptr multipart, {{^isEnum}} {{setter}}(refVal_{{setter}}); {{/isEnum}} - {{#isEnum}}{{#isContainer}}{{#isArray}} + {{#isEnum}} + {{#isContainer}} + {{#isArray}} {{setter}}(to{{{enumName}}}(refVal_{{setter}})); - {{/isArray}}{{#isMap}} + {{/isArray}} + {{#isMap}} {{setter}}(refVal_{{setter}}); - {{/isMap}}{{/isContainer}}{{^isContainer}} + {{/isMap}} + {{/isContainer}} + {{^isContainer}} {{setter}}(to{{{datatypeWithEnum}}}(refVal_{{setter}})); - {{/isContainer}}{{/isEnum}} + {{/isContainer}} + {{/isEnum}} } {{/vars}} return ok; } -{{#vars}}{{^isInherited}}{{#isEnum}}{{#isContainer}} +{{#vars}} +{{^isInherited}} +{{#isEnum}} +{{#isContainer}} {{classname}}::{{{enumName}}} {{classname}}::to{{{enumName}}}(const utility::string_t& value) const -{{/isContainer}}{{^isContainer}} +{{/isContainer}} +{{^isContainer}} {{classname}}::{{{datatypeWithEnum}}} {{classname}}::to{{{datatypeWithEnum}}}(const {{dataType}}& value) const {{/isContainer}} { @@ -348,7 +370,8 @@ const {{dataType}} {{classname}}::from{{{datatypeWithEnum}}}(const {{{datatypeWi } } -{{#isContainer}}{{#isArray}} +{{#isContainer}} +{{#isArray}} {{{dataType}}} {{{classname}}}::from{{{enumName}}}(const {{{datatypeWithEnum}}}& value) const { {{{dataType}}} ret; @@ -366,19 +389,31 @@ const {{dataType}} {{classname}}::from{{{datatypeWithEnum}}}(const {{{datatypeWi } return ret; } -{{/isArray}}{{/isContainer}}{{/isEnum}}{{/isInherited}}{{/vars}} +{{/isArray}} +{{/isContainer}} +{{/isEnum}} +{{/isInherited}} +{{/vars}} -{{#vars}}{{^isInherited}}{{#isContainer}}{{^isEnum}} +{{#vars}} +{{^isInherited}} +{{#isContainer}} +{{^isEnum}} {{{dataType}}} {{classname}}::{{getter}}() const { return m_{{name}}; } -{{/isEnum}}{{/isContainer}}{{^isContainer}}{{^isEnum}} +{{/isEnum}} +{{/isContainer}} +{{^isContainer}} +{{^isEnum}} {{{dataType}}} {{classname}}::{{getter}}() const { return m_{{name}}; } -{{/isEnum}}{{/isContainer}}{{#isEnum}} +{{/isEnum}} +{{/isContainer}} +{{#isEnum}} {{^isMap}}{{#isArray}}{{{baseType}}}<{{/isArray}}{{{classname}}}::{{{enumName}}}{{#isArray}}>{{/isArray}}{{/isMap}}{{#isMap}}{{{dataType}}}{{/isMap}} {{classname}}::{{getter}}() const { return m_{{name}}; diff --git a/samples/client/petstore/cpp-restsdk/client/include/CppRestPetstoreClient/model/ApiResponse.h b/samples/client/petstore/cpp-restsdk/client/include/CppRestPetstoreClient/model/ApiResponse.h index a7b7c86819da..3d00f9bdc40a 100644 --- a/samples/client/petstore/cpp-restsdk/client/include/CppRestPetstoreClient/model/ApiResponse.h +++ b/samples/client/petstore/cpp-restsdk/client/include/CppRestPetstoreClient/model/ApiResponse.h @@ -55,55 +55,33 @@ class ApiResponse ///////////////////////////////////////////// /// ApiResponse members - - - /// - /// - /// - int32_t getCode() const; - - bool codeIsSet() const; void unsetCode(); void setCode(int32_t value); - - /// - /// - /// - + utility::string_t getType() const; - - bool typeIsSet() const; void unsetType(); - void setType(const utility::string_t& value); - - /// - /// - /// - + utility::string_t getMessage() const; - - bool messageIsSet() const; void unsetMessage(); - void setMessage(const utility::string_t& value); - + protected: - int32_t m_Code; bool m_CodeIsSet; - + utility::string_t m_Type; bool m_TypeIsSet; - + utility::string_t m_Message; bool m_MessageIsSet; + }; diff --git a/samples/client/petstore/cpp-restsdk/client/include/CppRestPetstoreClient/model/Category.h b/samples/client/petstore/cpp-restsdk/client/include/CppRestPetstoreClient/model/Category.h index 0e2cc2d13219..da763f6b2b41 100644 --- a/samples/client/petstore/cpp-restsdk/client/include/CppRestPetstoreClient/model/Category.h +++ b/samples/client/petstore/cpp-restsdk/client/include/CppRestPetstoreClient/model/Category.h @@ -55,40 +55,25 @@ class Category ///////////////////////////////////////////// /// Category members - - - /// - /// - /// - int64_t getId() const; - - bool idIsSet() const; void unsetId(); void setId(int64_t value); - - /// - /// - /// - + utility::string_t getName() const; - - bool nameIsSet() const; void unsetName(); - void setName(const utility::string_t& value); - + protected: - int64_t m_Id; bool m_IdIsSet; - + utility::string_t m_Name; bool m_NameIsSet; + }; diff --git a/samples/client/petstore/cpp-restsdk/client/include/CppRestPetstoreClient/model/Order.h b/samples/client/petstore/cpp-restsdk/client/include/CppRestPetstoreClient/model/Order.h index d3ee6a7de51c..8cc343c35852 100644 --- a/samples/client/petstore/cpp-restsdk/client/include/CppRestPetstoreClient/model/Order.h +++ b/samples/client/petstore/cpp-restsdk/client/include/CppRestPetstoreClient/model/Order.h @@ -56,7 +56,6 @@ class Order ///////////////////////////////////////////// /// Order members - enum class StatusEnum { placed, @@ -67,100 +66,64 @@ class Order /// /// Order Status /// - + StatusEnum toStatusEnum(const utility::string_t& value) const; const utility::string_t fromStatusEnum(const StatusEnum value) const; - - - /// - /// - /// - + int64_t getId() const; - - bool idIsSet() const; void unsetId(); void setId(int64_t value); - - /// - /// - /// - + int64_t getPetId() const; - - bool petIdIsSet() const; void unsetPetId(); void setPetId(int64_t value); - - /// - /// - /// - + int32_t getQuantity() const; - - bool quantityIsSet() const; void unsetQuantity(); void setQuantity(int32_t value); - - /// - /// - /// - + utility::datetime getShipDate() const; - - bool shipDateIsSet() const; void unsetShipDate(); - void setShipDate(const utility::datetime& value); - + /// /// Order Status /// - - StatusEnum getStatus() const; - bool statusIsSet() const; void unsetStatus(); - void setStatus(const StatusEnum value); - - /// - /// - /// - + bool isComplete() const; - - bool completeIsSet() const; void unsetComplete(); void setComplete(bool value); - + protected: - int64_t m_Id; bool m_IdIsSet; - + int64_t m_PetId; bool m_PetIdIsSet; - + int32_t m_Quantity; bool m_QuantityIsSet; - + utility::datetime m_ShipDate; bool m_ShipDateIsSet; - + StatusEnum m_Status; bool m_StatusIsSet; - + bool m_Complete; bool m_CompleteIsSet; + }; diff --git a/samples/client/petstore/cpp-restsdk/client/include/CppRestPetstoreClient/model/Pet.h b/samples/client/petstore/cpp-restsdk/client/include/CppRestPetstoreClient/model/Pet.h index 16305368b11d..441a839c4d6d 100644 --- a/samples/client/petstore/cpp-restsdk/client/include/CppRestPetstoreClient/model/Pet.h +++ b/samples/client/petstore/cpp-restsdk/client/include/CppRestPetstoreClient/model/Pet.h @@ -61,7 +61,6 @@ class Pet ///////////////////////////////////////////// /// Pet members - enum class StatusEnum { available, @@ -72,103 +71,64 @@ class Pet /// /// pet status in the store /// - + StatusEnum toStatusEnum(const utility::string_t& value) const; const utility::string_t fromStatusEnum(const StatusEnum value) const; - - - /// - /// - /// - + int64_t getId() const; - - bool idIsSet() const; void unsetId(); void setId(int64_t value); - - /// - /// - /// - + std::shared_ptr getCategory() const; - - bool categoryIsSet() const; void unsetCategory(); - void setCategory(const std::shared_ptr& value); - - /// - /// - /// - + utility::string_t getName() const; - - bool nameIsSet() const; void unsetName(); - void setName(const utility::string_t& value); - - /// - /// - /// - + std::vector getPhotoUrls() const; - - bool photoUrlsIsSet() const; void unsetPhotoUrls(); - void setPhotoUrls(const std::vector& value); - - /// - /// - /// - + std::vector> getTags() const; - - bool tagsIsSet() const; void unsetTags(); - void setTags(const std::vector>& value); - + /// /// pet status in the store /// - - StatusEnum getStatus() const; - bool statusIsSet() const; void unsetStatus(); - void setStatus(const StatusEnum value); - + protected: - int64_t m_Id; bool m_IdIsSet; - + std::shared_ptr m_Category; bool m_CategoryIsSet; - + utility::string_t m_Name; bool m_NameIsSet; - + std::vector m_PhotoUrls; bool m_PhotoUrlsIsSet; - + std::vector> m_Tags; bool m_TagsIsSet; - + StatusEnum m_Status; bool m_StatusIsSet; + }; diff --git a/samples/client/petstore/cpp-restsdk/client/include/CppRestPetstoreClient/model/SchemaWithSet.h b/samples/client/petstore/cpp-restsdk/client/include/CppRestPetstoreClient/model/SchemaWithSet.h index f5d24906d377..ae03e3c5b82e 100644 --- a/samples/client/petstore/cpp-restsdk/client/include/CppRestPetstoreClient/model/SchemaWithSet.h +++ b/samples/client/petstore/cpp-restsdk/client/include/CppRestPetstoreClient/model/SchemaWithSet.h @@ -58,41 +58,28 @@ class SchemaWithSet ///////////////////////////////////////////// /// SchemaWithSet members - - /// /// pedigree and other certificates /// - std::set getCertificates() const; - - bool certificatesIsSet() const; void unsetCertificates(); - void setCertificates(const std::set& value); - - /// - /// - /// - + std::shared_ptr getVaccinationBook() const; - - bool vaccinationBookIsSet() const; void unsetVaccinationBook(); - void setVaccinationBook(const std::shared_ptr& value); - + protected: - std::set m_Certificates; bool m_CertificatesIsSet; - + std::shared_ptr m_VaccinationBook; bool m_VaccinationBookIsSet; + }; diff --git a/samples/client/petstore/cpp-restsdk/client/include/CppRestPetstoreClient/model/SchemaWithSet_vaccinationBook.h b/samples/client/petstore/cpp-restsdk/client/include/CppRestPetstoreClient/model/SchemaWithSet_vaccinationBook.h index cb47dc3b963e..d69a038285f0 100644 --- a/samples/client/petstore/cpp-restsdk/client/include/CppRestPetstoreClient/model/SchemaWithSet_vaccinationBook.h +++ b/samples/client/petstore/cpp-restsdk/client/include/CppRestPetstoreClient/model/SchemaWithSet_vaccinationBook.h @@ -57,26 +57,17 @@ class SchemaWithSet_vaccinationBook ///////////////////////////////////////////// /// SchemaWithSet_vaccinationBook members - - - /// - /// - /// - std::set> getVaccines() const; - - bool vaccinesIsSet() const; void unsetVaccines(); - void setVaccines(const std::set>& value); - + protected: - std::set> m_Vaccines; bool m_VaccinesIsSet; + }; diff --git a/samples/client/petstore/cpp-restsdk/client/include/CppRestPetstoreClient/model/Tag.h b/samples/client/petstore/cpp-restsdk/client/include/CppRestPetstoreClient/model/Tag.h index 393e17fd49ab..08436c290f0c 100644 --- a/samples/client/petstore/cpp-restsdk/client/include/CppRestPetstoreClient/model/Tag.h +++ b/samples/client/petstore/cpp-restsdk/client/include/CppRestPetstoreClient/model/Tag.h @@ -55,40 +55,25 @@ class Tag ///////////////////////////////////////////// /// Tag members - - - /// - /// - /// - int64_t getId() const; - - bool idIsSet() const; void unsetId(); void setId(int64_t value); - - /// - /// - /// - + utility::string_t getName() const; - - bool nameIsSet() const; void unsetName(); - void setName(const utility::string_t& value); - + protected: - int64_t m_Id; bool m_IdIsSet; - + utility::string_t m_Name; bool m_NameIsSet; + }; diff --git a/samples/client/petstore/cpp-restsdk/client/include/CppRestPetstoreClient/model/User.h b/samples/client/petstore/cpp-restsdk/client/include/CppRestPetstoreClient/model/User.h index e9e88086af52..c9c9d0aca212 100644 --- a/samples/client/petstore/cpp-restsdk/client/include/CppRestPetstoreClient/model/User.h +++ b/samples/client/petstore/cpp-restsdk/client/include/CppRestPetstoreClient/model/User.h @@ -55,129 +55,76 @@ class User ///////////////////////////////////////////// /// User members - - - /// - /// - /// - int64_t getId() const; - - bool idIsSet() const; void unsetId(); void setId(int64_t value); - - /// - /// - /// - + utility::string_t getUsername() const; - - bool usernameIsSet() const; void unsetUsername(); - void setUsername(const utility::string_t& value); - - /// - /// - /// - + utility::string_t getFirstName() const; - - bool firstNameIsSet() const; void unsetFirstName(); - void setFirstName(const utility::string_t& value); - - /// - /// - /// - + utility::string_t getLastName() const; - - bool lastNameIsSet() const; void unsetLastName(); - void setLastName(const utility::string_t& value); - - /// - /// - /// - + utility::string_t getEmail() const; - - bool emailIsSet() const; void unsetEmail(); - void setEmail(const utility::string_t& value); - - /// - /// - /// - + utility::string_t getPassword() const; - - bool passwordIsSet() const; void unsetPassword(); - void setPassword(const utility::string_t& value); - - /// - /// - /// - + utility::string_t getPhone() const; - - bool phoneIsSet() const; void unsetPhone(); - void setPhone(const utility::string_t& value); - + /// /// User Status /// - int32_t getUserStatus() const; - - bool userStatusIsSet() const; void unsetUserStatus(); void setUserStatus(int32_t value); - + protected: - int64_t m_Id; bool m_IdIsSet; - + utility::string_t m_Username; bool m_UsernameIsSet; - + utility::string_t m_FirstName; bool m_FirstNameIsSet; - + utility::string_t m_LastName; bool m_LastNameIsSet; - + utility::string_t m_Email; bool m_EmailIsSet; - + utility::string_t m_Password; bool m_PasswordIsSet; - + utility::string_t m_Phone; bool m_PhoneIsSet; - + int32_t m_UserStatus; bool m_UserStatusIsSet; + }; diff --git a/samples/client/petstore/cpp-restsdk/client/include/CppRestPetstoreClient/model/Vaccine.h b/samples/client/petstore/cpp-restsdk/client/include/CppRestPetstoreClient/model/Vaccine.h index 05db96a4df83..3ecbdd391362 100644 --- a/samples/client/petstore/cpp-restsdk/client/include/CppRestPetstoreClient/model/Vaccine.h +++ b/samples/client/petstore/cpp-restsdk/client/include/CppRestPetstoreClient/model/Vaccine.h @@ -30,9 +30,6 @@ namespace model { -/// -/// -/// class Vaccine : public ModelBase { @@ -55,40 +52,31 @@ class Vaccine ///////////////////////////////////////////// /// Vaccine members - - /// /// vaccination date /// - std::shared_ptr getDate() const; - - bool dateIsSet() const; void unsetdate(); - void setDate(const std::shared_ptr& value); - + /// /// true if a booster is still needed to complete the vaccination /// - bool isBoosterRequired() const; - - bool boosterRequiredIsSet() const; void unsetBoosterRequired(); void setBoosterRequired(bool value); - + protected: - std::shared_ptr m_date; bool m_dateIsSet; - + bool m_BoosterRequired; bool m_BoosterRequiredIsSet; + }; diff --git a/samples/client/petstore/cpp-restsdk/client/src/model/ApiResponse.cpp b/samples/client/petstore/cpp-restsdk/client/src/model/ApiResponse.cpp index 5f925cc56072..b8ee8d85a769 100644 --- a/samples/client/petstore/cpp-restsdk/client/src/model/ApiResponse.cpp +++ b/samples/client/petstore/cpp-restsdk/client/src/model/ApiResponse.cpp @@ -18,7 +18,6 @@ namespace openapitools { namespace client { namespace model { - ApiResponse::ApiResponse() { m_Code = 0; @@ -41,25 +40,21 @@ void ApiResponse::validate() web::json::value ApiResponse::toJson() const { web::json::value val = web::json::value::object(); - if(m_CodeIsSet) { val[utility::conversions::to_string_t(U("code"))] = ModelBase::toJson(m_Code); } - if(m_TypeIsSet) { val[utility::conversions::to_string_t(U("type"))] = ModelBase::toJson(m_Type); } - if(m_MessageIsSet) { val[utility::conversions::to_string_t(U("message"))] = ModelBase::toJson(m_Message); } - return val; } @@ -67,7 +62,6 @@ web::json::value ApiResponse::toJson() const bool ApiResponse::fromJson(const web::json::value& val) { bool ok = true; - if(val.has_field(utility::conversions::to_string_t(U("code")))) { const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("code"))); @@ -114,17 +108,14 @@ void ApiResponse::toMultipart(std::shared_ptr multipart, cons if(m_CodeIsSet) { multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("code")), m_Code)); - } if(m_TypeIsSet) { multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("type")), m_Type)); - } if(m_MessageIsSet) { multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("message")), m_Message)); - } } @@ -142,28 +133,23 @@ bool ApiResponse::fromMultiPart(std::shared_ptr multipart, co int32_t refVal_setCode; ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("code"))), refVal_setCode ); setCode(refVal_setCode); - } if(multipart->hasContent(utility::conversions::to_string_t(U("type")))) { utility::string_t refVal_setType; ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("type"))), refVal_setType ); setType(refVal_setType); - } if(multipart->hasContent(utility::conversions::to_string_t(U("message")))) { utility::string_t refVal_setMessage; ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("message"))), refVal_setMessage ); setMessage(refVal_setMessage); - } return ok; } - - int32_t ApiResponse::getCode() const { return m_Code; @@ -184,7 +170,6 @@ void ApiResponse::unsetCode() { m_CodeIsSet = false; } - utility::string_t ApiResponse::getType() const { return m_Type; @@ -206,7 +191,6 @@ void ApiResponse::unsetType() { m_TypeIsSet = false; } - utility::string_t ApiResponse::getMessage() const { return m_Message; diff --git a/samples/client/petstore/cpp-restsdk/client/src/model/Category.cpp b/samples/client/petstore/cpp-restsdk/client/src/model/Category.cpp index 461149854a3b..8ff12bb22e7d 100644 --- a/samples/client/petstore/cpp-restsdk/client/src/model/Category.cpp +++ b/samples/client/petstore/cpp-restsdk/client/src/model/Category.cpp @@ -18,7 +18,6 @@ namespace openapitools { namespace client { namespace model { - Category::Category() { m_Id = 0L; @@ -39,19 +38,16 @@ void Category::validate() web::json::value Category::toJson() const { web::json::value val = web::json::value::object(); - if(m_IdIsSet) { val[utility::conversions::to_string_t(U("id"))] = ModelBase::toJson(m_Id); } - if(m_NameIsSet) { val[utility::conversions::to_string_t(U("name"))] = ModelBase::toJson(m_Name); } - return val; } @@ -59,7 +55,6 @@ web::json::value Category::toJson() const bool Category::fromJson(const web::json::value& val) { bool ok = true; - if(val.has_field(utility::conversions::to_string_t(U("id")))) { const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("id"))); @@ -95,12 +90,10 @@ void Category::toMultipart(std::shared_ptr multipart, const u if(m_IdIsSet) { multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("id")), m_Id)); - } if(m_NameIsSet) { multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("name")), m_Name)); - } } @@ -118,21 +111,17 @@ bool Category::fromMultiPart(std::shared_ptr multipart, const int64_t refVal_setId; ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("id"))), refVal_setId ); setId(refVal_setId); - } if(multipart->hasContent(utility::conversions::to_string_t(U("name")))) { utility::string_t refVal_setName; ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("name"))), refVal_setName ); setName(refVal_setName); - } return ok; } - - int64_t Category::getId() const { return m_Id; @@ -153,7 +142,6 @@ void Category::unsetId() { m_IdIsSet = false; } - utility::string_t Category::getName() const { return m_Name; diff --git a/samples/client/petstore/cpp-restsdk/client/src/model/CreateUserOrPet_request.cpp b/samples/client/petstore/cpp-restsdk/client/src/model/CreateUserOrPet_request.cpp index 2fba8a89d486..033775c5c6f7 100644 --- a/samples/client/petstore/cpp-restsdk/client/src/model/CreateUserOrPet_request.cpp +++ b/samples/client/petstore/cpp-restsdk/client/src/model/CreateUserOrPet_request.cpp @@ -18,7 +18,6 @@ namespace openapitools { namespace client { namespace model { - void CreateUserOrPet_request::validate() { // TODO: implement validation @@ -65,7 +64,6 @@ template bool CreateUserOrPet_request::fromMultiPart(std::shared_ptr(const web::json::value& json); template bool CreateUserOrPet_request::fromMultiPart(std::shared_ptr multipart, const utility::string_t& namePrefix); - } } } diff --git a/samples/client/petstore/cpp-restsdk/client/src/model/Order.cpp b/samples/client/petstore/cpp-restsdk/client/src/model/Order.cpp index dacb34ed96e1..4e9becf6b9d2 100644 --- a/samples/client/petstore/cpp-restsdk/client/src/model/Order.cpp +++ b/samples/client/petstore/cpp-restsdk/client/src/model/Order.cpp @@ -18,7 +18,6 @@ namespace openapitools { namespace client { namespace model { - Order::Order() { m_Id = 0L; @@ -46,31 +45,26 @@ void Order::validate() web::json::value Order::toJson() const { web::json::value val = web::json::value::object(); - if(m_IdIsSet) { val[utility::conversions::to_string_t(U("id"))] = ModelBase::toJson(m_Id); } - if(m_PetIdIsSet) { val[utility::conversions::to_string_t(U("petId"))] = ModelBase::toJson(m_PetId); } - if(m_QuantityIsSet) { val[utility::conversions::to_string_t(U("quantity"))] = ModelBase::toJson(m_Quantity); } - if(m_ShipDateIsSet) { val[utility::conversions::to_string_t(U("shipDate"))] = ModelBase::toJson(m_ShipDate); } - if(m_StatusIsSet) { @@ -78,13 +72,11 @@ web::json::value Order::toJson() const val[utility::conversions::to_string_t(U("status"))] = ModelBase::toJson(refVal); } - if(m_CompleteIsSet) { val[utility::conversions::to_string_t(U("complete"))] = ModelBase::toJson(m_Complete); } - return val; } @@ -92,7 +84,6 @@ web::json::value Order::toJson() const bool Order::fromJson(const web::json::value& val) { bool ok = true; - if(val.has_field(utility::conversions::to_string_t(U("id")))) { const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("id"))); @@ -173,33 +164,26 @@ void Order::toMultipart(std::shared_ptr multipart, const util if(m_IdIsSet) { multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("id")), m_Id)); - } if(m_PetIdIsSet) { multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("petId")), m_PetId)); - } if(m_QuantityIsSet) { multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("quantity")), m_Quantity)); - } if(m_ShipDateIsSet) { multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("shipDate")), m_ShipDate)); - } if(m_StatusIsSet) { - multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("status")), fromStatusEnum(m_Status))); - } if(m_CompleteIsSet) { multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("complete")), m_Complete)); - } } @@ -217,48 +201,40 @@ bool Order::fromMultiPart(std::shared_ptr multipart, const ut int64_t refVal_setId; ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("id"))), refVal_setId ); setId(refVal_setId); - } if(multipart->hasContent(utility::conversions::to_string_t(U("petId")))) { int64_t refVal_setPetId; ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("petId"))), refVal_setPetId ); setPetId(refVal_setPetId); - } if(multipart->hasContent(utility::conversions::to_string_t(U("quantity")))) { int32_t refVal_setQuantity; ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("quantity"))), refVal_setQuantity ); setQuantity(refVal_setQuantity); - } if(multipart->hasContent(utility::conversions::to_string_t(U("shipDate")))) { utility::datetime refVal_setShipDate; ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("shipDate"))), refVal_setShipDate ); setShipDate(refVal_setShipDate); - } if(multipart->hasContent(utility::conversions::to_string_t(U("status")))) { utility::string_t refVal_setStatus; ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("status"))), refVal_setStatus ); - setStatus(toStatusEnum(refVal_setStatus)); - } if(multipart->hasContent(utility::conversions::to_string_t(U("complete")))) { bool refVal_setComplete; ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("complete"))), refVal_setComplete ); setComplete(refVal_setComplete); - } return ok; } - Order::StatusEnum Order::toStatusEnum(const utility::string_t& value) const { @@ -293,8 +269,6 @@ const utility::string_t Order::fromStatusEnum(const StatusEnum value) const } - - int64_t Order::getId() const { return m_Id; @@ -315,7 +289,6 @@ void Order::unsetId() { m_IdIsSet = false; } - int64_t Order::getPetId() const { return m_PetId; @@ -336,7 +309,6 @@ void Order::unsetPetId() { m_PetIdIsSet = false; } - int32_t Order::getQuantity() const { return m_Quantity; @@ -357,7 +329,6 @@ void Order::unsetQuantity() { m_QuantityIsSet = false; } - utility::datetime Order::getShipDate() const { return m_ShipDate; @@ -379,7 +350,6 @@ void Order::unsetShipDate() { m_ShipDateIsSet = false; } - Order::StatusEnum Order::getStatus() const { return m_Status; @@ -401,7 +371,6 @@ void Order::unsetStatus() { m_StatusIsSet = false; } - bool Order::isComplete() const { return m_Complete; diff --git a/samples/client/petstore/cpp-restsdk/client/src/model/Pet.cpp b/samples/client/petstore/cpp-restsdk/client/src/model/Pet.cpp index 678c7f78bd0b..4b786ebb7b95 100644 --- a/samples/client/petstore/cpp-restsdk/client/src/model/Pet.cpp +++ b/samples/client/petstore/cpp-restsdk/client/src/model/Pet.cpp @@ -18,7 +18,6 @@ namespace openapitools { namespace client { namespace model { - Pet::Pet() { m_Id = 0L; @@ -43,37 +42,31 @@ void Pet::validate() web::json::value Pet::toJson() const { web::json::value val = web::json::value::object(); - if(m_IdIsSet) { val[utility::conversions::to_string_t(U("id"))] = ModelBase::toJson(m_Id); } - if(m_CategoryIsSet) { val[utility::conversions::to_string_t(U("category"))] = ModelBase::toJson(m_Category); } - if(m_NameIsSet) { val[utility::conversions::to_string_t(U("name"))] = ModelBase::toJson(m_Name); } - if(m_PhotoUrlsIsSet) { val[utility::conversions::to_string_t(U("photoUrls"))] = ModelBase::toJson(m_PhotoUrls); } - if(m_TagsIsSet) { val[utility::conversions::to_string_t(U("tags"))] = ModelBase::toJson(m_Tags); } - if(m_StatusIsSet) { @@ -81,7 +74,6 @@ web::json::value Pet::toJson() const val[utility::conversions::to_string_t(U("status"))] = ModelBase::toJson(refVal); } - return val; } @@ -89,7 +81,6 @@ web::json::value Pet::toJson() const bool Pet::fromJson(const web::json::value& val) { bool ok = true; - if(val.has_field(utility::conversions::to_string_t(U("id")))) { const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("id"))); @@ -170,33 +161,26 @@ void Pet::toMultipart(std::shared_ptr multipart, const utilit if(m_IdIsSet) { multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("id")), m_Id)); - } if(m_CategoryIsSet) { multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("category")), m_Category)); - } if(m_NameIsSet) { multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("name")), m_Name)); - } if(m_PhotoUrlsIsSet) { multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("photoUrls")), m_PhotoUrls)); - } if(m_TagsIsSet) { multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("tags")), m_Tags)); - } if(m_StatusIsSet) { - multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("status")), fromStatusEnum(m_Status))); - } } @@ -214,48 +198,40 @@ bool Pet::fromMultiPart(std::shared_ptr multipart, const util int64_t refVal_setId; ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("id"))), refVal_setId ); setId(refVal_setId); - } if(multipart->hasContent(utility::conversions::to_string_t(U("category")))) { std::shared_ptr refVal_setCategory; ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("category"))), refVal_setCategory ); setCategory(refVal_setCategory); - } if(multipart->hasContent(utility::conversions::to_string_t(U("name")))) { utility::string_t refVal_setName; ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("name"))), refVal_setName ); setName(refVal_setName); - } if(multipart->hasContent(utility::conversions::to_string_t(U("photoUrls")))) { std::vector refVal_setPhotoUrls; ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("photoUrls"))), refVal_setPhotoUrls ); setPhotoUrls(refVal_setPhotoUrls); - } if(multipart->hasContent(utility::conversions::to_string_t(U("tags")))) { std::vector> refVal_setTags; ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("tags"))), refVal_setTags ); setTags(refVal_setTags); - } if(multipart->hasContent(utility::conversions::to_string_t(U("status")))) { utility::string_t refVal_setStatus; ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("status"))), refVal_setStatus ); - setStatus(toStatusEnum(refVal_setStatus)); - } return ok; } - Pet::StatusEnum Pet::toStatusEnum(const utility::string_t& value) const { @@ -290,8 +266,6 @@ const utility::string_t Pet::fromStatusEnum(const StatusEnum value) const } - - int64_t Pet::getId() const { return m_Id; @@ -312,7 +286,6 @@ void Pet::unsetId() { m_IdIsSet = false; } - std::shared_ptr Pet::getCategory() const { return m_Category; @@ -334,7 +307,6 @@ void Pet::unsetCategory() { m_CategoryIsSet = false; } - utility::string_t Pet::getName() const { return m_Name; @@ -356,7 +328,6 @@ void Pet::unsetName() { m_NameIsSet = false; } - std::vector Pet::getPhotoUrls() const { return m_PhotoUrls; @@ -378,7 +349,6 @@ void Pet::unsetPhotoUrls() { m_PhotoUrlsIsSet = false; } - std::vector> Pet::getTags() const { return m_Tags; @@ -400,7 +370,6 @@ void Pet::unsetTags() { m_TagsIsSet = false; } - Pet::StatusEnum Pet::getStatus() const { return m_Status; diff --git a/samples/client/petstore/cpp-restsdk/client/src/model/SchemaWithSet.cpp b/samples/client/petstore/cpp-restsdk/client/src/model/SchemaWithSet.cpp index ba45d8b5ca40..5e50e1d6ba2b 100644 --- a/samples/client/petstore/cpp-restsdk/client/src/model/SchemaWithSet.cpp +++ b/samples/client/petstore/cpp-restsdk/client/src/model/SchemaWithSet.cpp @@ -18,7 +18,6 @@ namespace openapitools { namespace client { namespace model { - SchemaWithSet::SchemaWithSet() { m_CertificatesIsSet = false; @@ -37,19 +36,16 @@ void SchemaWithSet::validate() web::json::value SchemaWithSet::toJson() const { web::json::value val = web::json::value::object(); - if(m_CertificatesIsSet) { val[utility::conversions::to_string_t(U("certificates"))] = ModelBase::toJson(m_Certificates); } - if(m_VaccinationBookIsSet) { val[utility::conversions::to_string_t(U("vaccinationBook"))] = ModelBase::toJson(m_VaccinationBook); } - return val; } @@ -57,7 +53,6 @@ web::json::value SchemaWithSet::toJson() const bool SchemaWithSet::fromJson(const web::json::value& val) { bool ok = true; - if(val.has_field(utility::conversions::to_string_t(U("certificates")))) { const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("certificates"))); @@ -93,12 +88,10 @@ void SchemaWithSet::toMultipart(std::shared_ptr multipart, co if(m_CertificatesIsSet) { multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("certificates")), m_Certificates)); - } if(m_VaccinationBookIsSet) { multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("vaccinationBook")), m_VaccinationBook)); - } } @@ -116,21 +109,17 @@ bool SchemaWithSet::fromMultiPart(std::shared_ptr multipart, std::set refVal_setCertificates; ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("certificates"))), refVal_setCertificates ); setCertificates(refVal_setCertificates); - } if(multipart->hasContent(utility::conversions::to_string_t(U("vaccinationBook")))) { std::shared_ptr refVal_setVaccinationBook; ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("vaccinationBook"))), refVal_setVaccinationBook ); setVaccinationBook(refVal_setVaccinationBook); - } return ok; } - - std::set SchemaWithSet::getCertificates() const { return m_Certificates; @@ -152,7 +141,6 @@ void SchemaWithSet::unsetCertificates() { m_CertificatesIsSet = false; } - std::shared_ptr SchemaWithSet::getVaccinationBook() const { return m_VaccinationBook; diff --git a/samples/client/petstore/cpp-restsdk/client/src/model/SchemaWithSet_vaccinationBook.cpp b/samples/client/petstore/cpp-restsdk/client/src/model/SchemaWithSet_vaccinationBook.cpp index f27c681113b9..754db70ed42d 100644 --- a/samples/client/petstore/cpp-restsdk/client/src/model/SchemaWithSet_vaccinationBook.cpp +++ b/samples/client/petstore/cpp-restsdk/client/src/model/SchemaWithSet_vaccinationBook.cpp @@ -18,7 +18,6 @@ namespace openapitools { namespace client { namespace model { - SchemaWithSet_vaccinationBook::SchemaWithSet_vaccinationBook() { m_VaccinesIsSet = false; @@ -36,13 +35,11 @@ void SchemaWithSet_vaccinationBook::validate() web::json::value SchemaWithSet_vaccinationBook::toJson() const { web::json::value val = web::json::value::object(); - if(m_VaccinesIsSet) { val[utility::conversions::to_string_t(U("vaccines"))] = ModelBase::toJson(m_Vaccines); } - return val; } @@ -50,7 +47,6 @@ web::json::value SchemaWithSet_vaccinationBook::toJson() const bool SchemaWithSet_vaccinationBook::fromJson(const web::json::value& val) { bool ok = true; - if(val.has_field(utility::conversions::to_string_t(U("vaccines")))) { const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("vaccines"))); @@ -75,7 +71,6 @@ void SchemaWithSet_vaccinationBook::toMultipart(std::shared_ptradd(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("vaccines")), m_Vaccines)); - } } @@ -93,14 +88,11 @@ bool SchemaWithSet_vaccinationBook::fromMultiPart(std::shared_ptr> refVal_setVaccines; ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("vaccines"))), refVal_setVaccines ); setVaccines(refVal_setVaccines); - } return ok; } - - std::set> SchemaWithSet_vaccinationBook::getVaccines() const { return m_Vaccines; diff --git a/samples/client/petstore/cpp-restsdk/client/src/model/Tag.cpp b/samples/client/petstore/cpp-restsdk/client/src/model/Tag.cpp index 3c4d3c1fb67a..bc36904b52d4 100644 --- a/samples/client/petstore/cpp-restsdk/client/src/model/Tag.cpp +++ b/samples/client/petstore/cpp-restsdk/client/src/model/Tag.cpp @@ -18,7 +18,6 @@ namespace openapitools { namespace client { namespace model { - Tag::Tag() { m_Id = 0L; @@ -39,19 +38,16 @@ void Tag::validate() web::json::value Tag::toJson() const { web::json::value val = web::json::value::object(); - if(m_IdIsSet) { val[utility::conversions::to_string_t(U("id"))] = ModelBase::toJson(m_Id); } - if(m_NameIsSet) { val[utility::conversions::to_string_t(U("name"))] = ModelBase::toJson(m_Name); } - return val; } @@ -59,7 +55,6 @@ web::json::value Tag::toJson() const bool Tag::fromJson(const web::json::value& val) { bool ok = true; - if(val.has_field(utility::conversions::to_string_t(U("id")))) { const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("id"))); @@ -95,12 +90,10 @@ void Tag::toMultipart(std::shared_ptr multipart, const utilit if(m_IdIsSet) { multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("id")), m_Id)); - } if(m_NameIsSet) { multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("name")), m_Name)); - } } @@ -118,21 +111,17 @@ bool Tag::fromMultiPart(std::shared_ptr multipart, const util int64_t refVal_setId; ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("id"))), refVal_setId ); setId(refVal_setId); - } if(multipart->hasContent(utility::conversions::to_string_t(U("name")))) { utility::string_t refVal_setName; ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("name"))), refVal_setName ); setName(refVal_setName); - } return ok; } - - int64_t Tag::getId() const { return m_Id; @@ -153,7 +142,6 @@ void Tag::unsetId() { m_IdIsSet = false; } - utility::string_t Tag::getName() const { return m_Name; diff --git a/samples/client/petstore/cpp-restsdk/client/src/model/User.cpp b/samples/client/petstore/cpp-restsdk/client/src/model/User.cpp index e9b53ec07df1..bd1c959d53f1 100644 --- a/samples/client/petstore/cpp-restsdk/client/src/model/User.cpp +++ b/samples/client/petstore/cpp-restsdk/client/src/model/User.cpp @@ -18,7 +18,6 @@ namespace openapitools { namespace client { namespace model { - User::User() { m_Id = 0L; @@ -51,55 +50,46 @@ void User::validate() web::json::value User::toJson() const { web::json::value val = web::json::value::object(); - if(m_IdIsSet) { val[utility::conversions::to_string_t(U("id"))] = ModelBase::toJson(m_Id); } - if(m_UsernameIsSet) { val[utility::conversions::to_string_t(U("username"))] = ModelBase::toJson(m_Username); } - if(m_FirstNameIsSet) { val[utility::conversions::to_string_t(U("firstName"))] = ModelBase::toJson(m_FirstName); } - if(m_LastNameIsSet) { val[utility::conversions::to_string_t(U("lastName"))] = ModelBase::toJson(m_LastName); } - if(m_EmailIsSet) { val[utility::conversions::to_string_t(U("email"))] = ModelBase::toJson(m_Email); } - if(m_PasswordIsSet) { val[utility::conversions::to_string_t(U("password"))] = ModelBase::toJson(m_Password); } - if(m_PhoneIsSet) { val[utility::conversions::to_string_t(U("phone"))] = ModelBase::toJson(m_Phone); } - if(m_UserStatusIsSet) { val[utility::conversions::to_string_t(U("userStatus"))] = ModelBase::toJson(m_UserStatus); } - return val; } @@ -107,7 +97,6 @@ web::json::value User::toJson() const bool User::fromJson(const web::json::value& val) { bool ok = true; - if(val.has_field(utility::conversions::to_string_t(U("id")))) { const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("id"))); @@ -209,42 +198,34 @@ void User::toMultipart(std::shared_ptr multipart, const utili if(m_IdIsSet) { multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("id")), m_Id)); - } if(m_UsernameIsSet) { multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("username")), m_Username)); - } if(m_FirstNameIsSet) { multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("firstName")), m_FirstName)); - } if(m_LastNameIsSet) { multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("lastName")), m_LastName)); - } if(m_EmailIsSet) { multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("email")), m_Email)); - } if(m_PasswordIsSet) { multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("password")), m_Password)); - } if(m_PhoneIsSet) { multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("phone")), m_Phone)); - } if(m_UserStatusIsSet) { multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("userStatus")), m_UserStatus)); - } } @@ -262,63 +243,53 @@ bool User::fromMultiPart(std::shared_ptr multipart, const uti int64_t refVal_setId; ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("id"))), refVal_setId ); setId(refVal_setId); - } if(multipart->hasContent(utility::conversions::to_string_t(U("username")))) { utility::string_t refVal_setUsername; ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("username"))), refVal_setUsername ); setUsername(refVal_setUsername); - } if(multipart->hasContent(utility::conversions::to_string_t(U("firstName")))) { utility::string_t refVal_setFirstName; ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("firstName"))), refVal_setFirstName ); setFirstName(refVal_setFirstName); - } if(multipart->hasContent(utility::conversions::to_string_t(U("lastName")))) { utility::string_t refVal_setLastName; ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("lastName"))), refVal_setLastName ); setLastName(refVal_setLastName); - } if(multipart->hasContent(utility::conversions::to_string_t(U("email")))) { utility::string_t refVal_setEmail; ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("email"))), refVal_setEmail ); setEmail(refVal_setEmail); - } if(multipart->hasContent(utility::conversions::to_string_t(U("password")))) { utility::string_t refVal_setPassword; ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("password"))), refVal_setPassword ); setPassword(refVal_setPassword); - } if(multipart->hasContent(utility::conversions::to_string_t(U("phone")))) { utility::string_t refVal_setPhone; ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("phone"))), refVal_setPhone ); setPhone(refVal_setPhone); - } if(multipart->hasContent(utility::conversions::to_string_t(U("userStatus")))) { int32_t refVal_setUserStatus; ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("userStatus"))), refVal_setUserStatus ); setUserStatus(refVal_setUserStatus); - } return ok; } - - int64_t User::getId() const { return m_Id; @@ -339,7 +310,6 @@ void User::unsetId() { m_IdIsSet = false; } - utility::string_t User::getUsername() const { return m_Username; @@ -361,7 +331,6 @@ void User::unsetUsername() { m_UsernameIsSet = false; } - utility::string_t User::getFirstName() const { return m_FirstName; @@ -383,7 +352,6 @@ void User::unsetFirstName() { m_FirstNameIsSet = false; } - utility::string_t User::getLastName() const { return m_LastName; @@ -405,7 +373,6 @@ void User::unsetLastName() { m_LastNameIsSet = false; } - utility::string_t User::getEmail() const { return m_Email; @@ -427,7 +394,6 @@ void User::unsetEmail() { m_EmailIsSet = false; } - utility::string_t User::getPassword() const { return m_Password; @@ -449,7 +415,6 @@ void User::unsetPassword() { m_PasswordIsSet = false; } - utility::string_t User::getPhone() const { return m_Phone; @@ -471,7 +436,6 @@ void User::unsetPhone() { m_PhoneIsSet = false; } - int32_t User::getUserStatus() const { return m_UserStatus; diff --git a/samples/client/petstore/cpp-restsdk/client/src/model/Vaccine.cpp b/samples/client/petstore/cpp-restsdk/client/src/model/Vaccine.cpp index 6e8ec9282ed2..a833d63dcd22 100644 --- a/samples/client/petstore/cpp-restsdk/client/src/model/Vaccine.cpp +++ b/samples/client/petstore/cpp-restsdk/client/src/model/Vaccine.cpp @@ -18,7 +18,6 @@ namespace openapitools { namespace client { namespace model { - Vaccine::Vaccine() { m_dateIsSet = false; @@ -38,19 +37,16 @@ void Vaccine::validate() web::json::value Vaccine::toJson() const { web::json::value val = web::json::value::object(); - if(m_dateIsSet) { val[utility::conversions::to_string_t(U("date"))] = ModelBase::toJson(m_date); } - if(m_BoosterRequiredIsSet) { val[utility::conversions::to_string_t(U("boosterRequired"))] = ModelBase::toJson(m_BoosterRequired); } - return val; } @@ -58,7 +54,6 @@ web::json::value Vaccine::toJson() const bool Vaccine::fromJson(const web::json::value& val) { bool ok = true; - if(val.has_field(utility::conversions::to_string_t(U("date")))) { const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("date"))); @@ -94,12 +89,10 @@ void Vaccine::toMultipart(std::shared_ptr multipart, const ut if(m_dateIsSet) { multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("date")), m_date)); - } if(m_BoosterRequiredIsSet) { multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("boosterRequired")), m_BoosterRequired)); - } } @@ -117,21 +110,17 @@ bool Vaccine::fromMultiPart(std::shared_ptr multipart, const std::shared_ptr refVal_setDate; ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("date"))), refVal_setDate ); setDate(refVal_setDate); - } if(multipart->hasContent(utility::conversions::to_string_t(U("boosterRequired")))) { bool refVal_setBoosterRequired; ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("boosterRequired"))), refVal_setBoosterRequired ); setBoosterRequired(refVal_setBoosterRequired); - } return ok; } - - std::shared_ptr Vaccine::getDate() const { return m_date; @@ -153,7 +142,6 @@ void Vaccine::unsetdate() { m_dateIsSet = false; } - bool Vaccine::isBoosterRequired() const { return m_BoosterRequired;