forked from loafle/openapi-generator-original
* Fix not processing enums in cpp-pistache-server Defining a reusable enum as a component schema results in an empty class. Following changes are made: - activate 'postProcessModelsEnum' in 'AbstractCppCodegen' - modify model templates for the 'cpp-pistache-server' project As 'postProcessModelsEnum' is now available in the 'AbstactCppCodegen' the 'enumVars' variables are now available in mustache templates for all cpp based code generators. As the 'AbstractCppCodegen' was touched all cpp based samples were updated. * fixes encountered on real world * PR fixes Co-authored-by: mfyuce <mfyuce@netas.com.tr>
176 lines
3.0 KiB
C++
176 lines
3.0 KiB
C++
/**
|
|
* OpenAPI Petstore
|
|
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
|
|
*
|
|
* The version of the OpenAPI document: 1.0.0
|
|
*
|
|
*
|
|
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
* https://openapi-generator.tech
|
|
* Do not edit the class manually.
|
|
*/
|
|
|
|
|
|
#include "Pet.h"
|
|
|
|
namespace org {
|
|
namespace openapitools {
|
|
namespace server {
|
|
namespace model {
|
|
|
|
Pet::Pet()
|
|
{
|
|
m_Id = 0L;
|
|
m_IdIsSet = false;
|
|
m_CategoryIsSet = false;
|
|
m_Name = "";
|
|
m_TagsIsSet = false;
|
|
m_Status = "";
|
|
m_StatusIsSet = false;
|
|
|
|
}
|
|
|
|
Pet::~Pet()
|
|
{
|
|
}
|
|
|
|
void Pet::validate()
|
|
{
|
|
// TODO: implement validation
|
|
}
|
|
|
|
void to_json(nlohmann::json& j, const Pet& o)
|
|
{
|
|
j = nlohmann::json();
|
|
if(o.idIsSet())
|
|
j["id"] = o.m_Id;
|
|
if(o.categoryIsSet())
|
|
j["category"] = o.m_Category;
|
|
j["name"] = o.m_Name;
|
|
j["photoUrls"] = o.m_PhotoUrls;
|
|
if(o.tagsIsSet() || !o.m_Tags.empty())
|
|
j["tags"] = o.m_Tags;
|
|
if(o.statusIsSet())
|
|
j["status"] = o.m_Status;
|
|
|
|
}
|
|
|
|
void from_json(const nlohmann::json& j, Pet& o)
|
|
{
|
|
if(j.find("id") != j.end())
|
|
{
|
|
j.at("id").get_to(o.m_Id);
|
|
o.m_IdIsSet = true;
|
|
}
|
|
if(j.find("category") != j.end())
|
|
{
|
|
j.at("category").get_to(o.m_Category);
|
|
o.m_CategoryIsSet = true;
|
|
}
|
|
j.at("name").get_to(o.m_Name);
|
|
j.at("photoUrls").get_to(o.m_PhotoUrls);
|
|
if(j.find("tags") != j.end())
|
|
{
|
|
j.at("tags").get_to(o.m_Tags);
|
|
o.m_TagsIsSet = true;
|
|
}
|
|
if(j.find("status") != j.end())
|
|
{
|
|
j.at("status").get_to(o.m_Status);
|
|
o.m_StatusIsSet = true;
|
|
}
|
|
|
|
}
|
|
|
|
int64_t Pet::getId() const
|
|
{
|
|
return m_Id;
|
|
}
|
|
void Pet::setId(int64_t const value)
|
|
{
|
|
m_Id = value;
|
|
m_IdIsSet = true;
|
|
}
|
|
bool Pet::idIsSet() const
|
|
{
|
|
return m_IdIsSet;
|
|
}
|
|
void Pet::unsetId()
|
|
{
|
|
m_IdIsSet = false;
|
|
}
|
|
Category Pet::getCategory() const
|
|
{
|
|
return m_Category;
|
|
}
|
|
void Pet::setCategory(Category const& value)
|
|
{
|
|
m_Category = value;
|
|
m_CategoryIsSet = true;
|
|
}
|
|
bool Pet::categoryIsSet() const
|
|
{
|
|
return m_CategoryIsSet;
|
|
}
|
|
void Pet::unsetCategory()
|
|
{
|
|
m_CategoryIsSet = false;
|
|
}
|
|
std::string Pet::getName() const
|
|
{
|
|
return m_Name;
|
|
}
|
|
void Pet::setName(std::string const& value)
|
|
{
|
|
m_Name = value;
|
|
}
|
|
std::vector<std::string>& Pet::getPhotoUrls()
|
|
{
|
|
return m_PhotoUrls;
|
|
}
|
|
void Pet::setPhotoUrls(std::vector<std::string> const& value)
|
|
{
|
|
m_PhotoUrls = value;
|
|
}
|
|
std::vector<Tag>& Pet::getTags()
|
|
{
|
|
return m_Tags;
|
|
}
|
|
void Pet::setTags(std::vector<Tag> const& value)
|
|
{
|
|
m_Tags = value;
|
|
m_TagsIsSet = true;
|
|
}
|
|
bool Pet::tagsIsSet() const
|
|
{
|
|
return m_TagsIsSet;
|
|
}
|
|
void Pet::unsetTags()
|
|
{
|
|
m_TagsIsSet = false;
|
|
}
|
|
std::string Pet::getStatus() const
|
|
{
|
|
return m_Status;
|
|
}
|
|
void Pet::setStatus(std::string const& value)
|
|
{
|
|
m_Status = value;
|
|
m_StatusIsSet = true;
|
|
}
|
|
bool Pet::statusIsSet() const
|
|
{
|
|
return m_StatusIsSet;
|
|
}
|
|
void Pet::unsetStatus()
|
|
{
|
|
m_StatusIsSet = false;
|
|
}
|
|
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|