Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -387,6 +387,8 @@ public String getTypeDeclaration(Schema p) {
|| ModelUtils.isFileSchema(p) || ModelUtils.isUUIDSchema(p)
|| languageSpecificPrimitives.contains(openAPIType)) {
return toModelName(openAPIType);
} else if (ModelUtils.isObjectSchema(p)) {
return "std::shared_ptr<Object>";
} else if(typeMapping.containsKey(super.getSchemaType(p))) {
return openAPIType;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -798,6 +798,8 @@ components:
- available
- pending
- sold
metadata:
type: object
xml:
name: Pet
Color:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
#include "CppRestPetstoreClient/model/Tag.h"
#include "CppRestPetstoreClient/model/Category.h"
#include <cpprest/details/basic_types.h>
#include "CppRestPetstoreClient/Object.h"
#include "CppRestPetstoreClient/model/Pet.h"
#include <vector>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#include "CppRestPetstoreClient/model/Tag.h"
#include "CppRestPetstoreClient/model/Category.h"
#include <cpprest/details/basic_types.h>
#include "CppRestPetstoreClient/Object.h"
#include <vector>

namespace org {
Expand Down Expand Up @@ -109,6 +110,11 @@ class Pet
void unsetStatus();
void setStatus(const StatusEnum value);

std::shared_ptr<Object> getMetadata() const;
bool metadataIsSet() const;
void unsetMetadata();
void setMetadata(const std::shared_ptr<Object>& value);


protected:
int64_t m_Id;
Expand All @@ -129,6 +135,9 @@ class Pet
StatusEnum m_Status;
bool m_StatusIsSet;

std::shared_ptr<Object> m_Metadata;
bool m_MetadataIsSet;

};


Expand Down
48 changes: 48 additions & 0 deletions samples/client/petstore/cpp-restsdk/client/src/model/Pet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ Pet::Pet()
m_PhotoUrlsIsSet = false;
m_TagsIsSet = false;
m_StatusIsSet = false;
m_MetadataIsSet = false;
}

Pet::~Pet()
Expand Down Expand Up @@ -74,6 +75,11 @@ web::json::value Pet::toJson() const
val[utility::conversions::to_string_t(_XPLATSTR("status"))] = ModelBase::toJson(refVal);

}
if(m_MetadataIsSet)
{

val[utility::conversions::to_string_t(_XPLATSTR("metadata"))] = ModelBase::toJson(m_Metadata);
}

return val;
}
Expand Down Expand Up @@ -148,6 +154,17 @@ bool Pet::fromJson(const web::json::value& val)

}
}
if(val.has_field(utility::conversions::to_string_t(_XPLATSTR("metadata"))))
{
const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(_XPLATSTR("metadata")));
if(!fieldValue.is_null())
{
std::shared_ptr<Object> refVal_setMetadata;
ok &= ModelBase::fromJson(fieldValue, refVal_setMetadata);
setMetadata(refVal_setMetadata);

}
}
return ok;
}

Expand Down Expand Up @@ -182,6 +199,10 @@ void Pet::toMultipart(std::shared_ptr<MultipartFormData> multipart, const utilit
{
multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(_XPLATSTR("status")), fromStatusEnum(m_Status)));
}
if(m_MetadataIsSet)
{
multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(_XPLATSTR("metadata")), m_Metadata));
}
}

bool Pet::fromMultiPart(std::shared_ptr<MultipartFormData> multipart, const utility::string_t& prefix)
Expand Down Expand Up @@ -229,6 +250,12 @@ bool Pet::fromMultiPart(std::shared_ptr<MultipartFormData> multipart, const util
ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(_XPLATSTR("status"))), refVal_setStatus );
setStatus(toStatusEnum(refVal_setStatus));
}
if(multipart->hasContent(utility::conversions::to_string_t(_XPLATSTR("metadata"))))
{
std::shared_ptr<Object> refVal_setMetadata;
ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(_XPLATSTR("metadata"))), refVal_setMetadata );
setMetadata(refVal_setMetadata);
}
return ok;
}

Expand Down Expand Up @@ -391,6 +418,27 @@ void Pet::unsetStatus()
{
m_StatusIsSet = false;
}
std::shared_ptr<Object> Pet::getMetadata() const
{
return m_Metadata;
}


void Pet::setMetadata(const std::shared_ptr<Object>& value)
{
m_Metadata = value;
m_MetadataIsSet = true;
}

bool Pet::metadataIsSet() const
{
return m_MetadataIsSet;
}

void Pet::unsetMetadata()
{
m_MetadataIsSet = false;
}

}
}
Expand Down
Loading