diff --git a/modules/openapi-generator/src/test/resources/3_0/cpp-restsdk/petstore.yaml b/modules/openapi-generator/src/test/resources/3_0/cpp-restsdk/petstore.yaml index 5394e75e5ce..e28e1c61039 100644 --- a/modules/openapi-generator/src/test/resources/3_0/cpp-restsdk/petstore.yaml +++ b/modules/openapi-generator/src/test/resources/3_0/cpp-restsdk/petstore.yaml @@ -865,4 +865,13 @@ components: perPage: type: integer format: int32 + reference_test: + type: array + readOnly: true + items: + $ref: "#/components/schemas/UUID" + UUID: + format: "uuid" + pattern: "[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}" + type: "string" diff --git a/samples/client/petstore/cpp-restsdk/client/include/CppRestPetstoreClient/model/Page.h b/samples/client/petstore/cpp-restsdk/client/include/CppRestPetstoreClient/model/Page.h index 7aeb0858b8b..cb8ccd5d4b3 100644 --- a/samples/client/petstore/cpp-restsdk/client/include/CppRestPetstoreClient/model/Page.h +++ b/samples/client/petstore/cpp-restsdk/client/include/CppRestPetstoreClient/model/Page.h @@ -21,6 +21,8 @@ #include "CppRestPetstoreClient/ModelBase.h" +#include +#include namespace org { namespace openapitools { @@ -62,6 +64,11 @@ public: void unsetPerPage(); void setPerPage(int32_t value); + std::vector getReferenceTest() const; + bool referenceTestIsSet() const; + void unsetReference_test(); + void setReferenceTest(const std::vector& value); + protected: int32_t m_Page; @@ -70,6 +77,9 @@ protected: int32_t m_PerPage; bool m_PerPageIsSet; + std::vector m_Reference_test; + bool m_Reference_testIsSet; + }; diff --git a/samples/client/petstore/cpp-restsdk/client/src/model/Page.cpp b/samples/client/petstore/cpp-restsdk/client/src/model/Page.cpp index 71fccb0e12a..fb1a8fe12a6 100644 --- a/samples/client/petstore/cpp-restsdk/client/src/model/Page.cpp +++ b/samples/client/petstore/cpp-restsdk/client/src/model/Page.cpp @@ -24,6 +24,7 @@ Page::Page() m_PageIsSet = false; m_PerPage = 0; m_PerPageIsSet = false; + m_Reference_testIsSet = false; } Page::~Page() @@ -48,6 +49,11 @@ web::json::value Page::toJson() const val[utility::conversions::to_string_t(_XPLATSTR("perPage"))] = ModelBase::toJson(m_PerPage); } + if(m_Reference_testIsSet) + { + + val[utility::conversions::to_string_t(_XPLATSTR("reference_test"))] = ModelBase::toJson(m_Reference_test); + } return val; } @@ -77,6 +83,17 @@ bool Page::fromJson(const web::json::value& val) } } + if(val.has_field(utility::conversions::to_string_t(_XPLATSTR("reference_test")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(_XPLATSTR("reference_test"))); + if(!fieldValue.is_null()) + { + std::vector refVal_setReferenceTest; + ok &= ModelBase::fromJson(fieldValue, refVal_setReferenceTest); + setReferenceTest(refVal_setReferenceTest); + + } + } return ok; } @@ -95,6 +112,10 @@ void Page::toMultipart(std::shared_ptr multipart, const utili { multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(_XPLATSTR("perPage")), m_PerPage)); } + if(m_Reference_testIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(_XPLATSTR("reference_test")), m_Reference_test)); + } } bool Page::fromMultiPart(std::shared_ptr multipart, const utility::string_t& prefix) @@ -118,6 +139,12 @@ bool Page::fromMultiPart(std::shared_ptr multipart, const uti ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(_XPLATSTR("perPage"))), refVal_setPerPage ); setPerPage(refVal_setPerPage); } + if(multipart->hasContent(utility::conversions::to_string_t(_XPLATSTR("reference_test")))) + { + std::vector refVal_setReferenceTest; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(_XPLATSTR("reference_test"))), refVal_setReferenceTest ); + setReferenceTest(refVal_setReferenceTest); + } return ok; } @@ -162,6 +189,27 @@ void Page::unsetPerPage() { m_PerPageIsSet = false; } +std::vector Page::getReferenceTest() const +{ + return m_Reference_test; +} + + +void Page::setReferenceTest(const std::vector& value) +{ + m_Reference_test = value; + m_Reference_testIsSet = true; +} + +bool Page::referenceTestIsSet() const +{ + return m_Reference_testIsSet; +} + +void Page::unsetReference_test() +{ + m_Reference_testIsSet = false; +} } }