forked from loafle/openapi-generator-original
[C++][Pistache] Add missing setter for arrays (#3837)
* [C++][Pistache] Add missing setter for arrays Fixes #3769 * [C++][Pistache] Update Petstore sample
This commit is contained in:
parent
096f2d0fc8
commit
f2fe4fc200
@ -35,12 +35,10 @@ public:
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// {{description}}
|
/// {{description}}
|
||||||
/// </summary>
|
/// </summary>
|
||||||
{{#isContainer}}{{{dataType}}}& {{getter}}();
|
{{{dataType}}}{{#isContainer}}&{{/isContainer}} {{getter}}(){{^isContainer}} const{{/isContainer}};
|
||||||
{{/isContainer}}{{^isContainer}}{{{dataType}}} {{getter}}() const;
|
void {{setter}}({{{dataType}}} const{{^isPrimitiveType}}&{{/isPrimitiveType}} value);{{^required}}
|
||||||
void {{setter}}({{{dataType}}} const{{^isPrimitiveType}}&{{/isPrimitiveType}} value);
|
bool {{nameInCamelCase}}IsSet() const;
|
||||||
{{/isContainer}}{{^required}}bool {{nameInCamelCase}}IsSet() const;
|
void unset{{name}}();{{/required}}
|
||||||
void unset{{name}}();
|
|
||||||
{{/required}}
|
|
||||||
{{/vars}}
|
{{/vars}}
|
||||||
|
|
||||||
friend void to_json(nlohmann::json& j, const {{classname}}& o);
|
friend void to_json(nlohmann::json& j, const {{classname}}& o);
|
||||||
|
@ -29,7 +29,7 @@ void to_json(nlohmann::json& j, const {{classname}}& o)
|
|||||||
{
|
{
|
||||||
j = nlohmann::json();
|
j = nlohmann::json();
|
||||||
{{#vars}}
|
{{#vars}}
|
||||||
{{#required}}j["{{baseName}}"] = o.m_{{name}};{{/required}}{{^required}}if(o.{{nameInCamelCase}}IsSet())
|
{{#required}}j["{{baseName}}"] = o.m_{{name}};{{/required}}{{^required}}if(o.{{nameInCamelCase}}IsSet(){{#isContainer}} || !o.m_{{name}}.empty(){{/isContainer}})
|
||||||
j["{{baseName}}"] = o.m_{{name}};{{/required}}
|
j["{{baseName}}"] = o.m_{{name}};{{/required}}
|
||||||
{{/vars}}
|
{{/vars}}
|
||||||
}
|
}
|
||||||
@ -45,20 +45,15 @@ void from_json(const nlohmann::json& j, {{classname}}& o)
|
|||||||
{{/vars}}
|
{{/vars}}
|
||||||
}
|
}
|
||||||
|
|
||||||
{{#vars}}{{#isContainer}}{{{dataType}}}& {{classname}}::{{getter}}()
|
{{#vars}}{{{dataType}}}{{#isContainer}}&{{/isContainer}} {{classname}}::{{getter}}(){{^isContainer}} const{{/isContainer}}
|
||||||
{
|
|
||||||
return m_{{name}};
|
|
||||||
}
|
|
||||||
{{/isContainer}}{{^isContainer}}{{{dataType}}} {{classname}}::{{getter}}() const
|
|
||||||
{
|
{
|
||||||
return m_{{name}};
|
return m_{{name}};
|
||||||
}
|
}
|
||||||
void {{classname}}::{{setter}}({{{dataType}}} const{{^isPrimitiveType}}&{{/isPrimitiveType}} value)
|
void {{classname}}::{{setter}}({{{dataType}}} const{{^isPrimitiveType}}&{{/isPrimitiveType}} value)
|
||||||
{
|
{
|
||||||
m_{{name}} = value;
|
m_{{name}} = value;{{^required}}
|
||||||
{{^required}}m_{{name}}IsSet = true;{{/required}}
|
m_{{name}}IsSet = true;{{/required}}
|
||||||
}
|
}
|
||||||
{{/isContainer}}
|
|
||||||
{{^required}}bool {{classname}}::{{nameInCamelCase}}IsSet() const
|
{{^required}}bool {{classname}}::{{nameInCamelCase}}IsSet() const
|
||||||
{
|
{
|
||||||
return m_{{name}}IsSet;
|
return m_{{name}}IsSet;
|
||||||
|
@ -1 +1 @@
|
|||||||
4.1.0-SNAPSHOT
|
4.1.2-SNAPSHOT
|
@ -48,7 +48,7 @@ void to_json(nlohmann::json& j, const Pet& o)
|
|||||||
j["category"] = o.m_Category;
|
j["category"] = o.m_Category;
|
||||||
j["name"] = o.m_Name;
|
j["name"] = o.m_Name;
|
||||||
j["photoUrls"] = o.m_PhotoUrls;
|
j["photoUrls"] = o.m_PhotoUrls;
|
||||||
if(o.tagsIsSet())
|
if(o.tagsIsSet() || !o.m_Tags.empty())
|
||||||
j["tags"] = o.m_Tags;
|
j["tags"] = o.m_Tags;
|
||||||
if(o.statusIsSet())
|
if(o.statusIsSet())
|
||||||
j["status"] = o.m_Status;
|
j["status"] = o.m_Status;
|
||||||
@ -121,16 +121,24 @@ std::string Pet::getName() const
|
|||||||
void Pet::setName(std::string const& value)
|
void Pet::setName(std::string const& value)
|
||||||
{
|
{
|
||||||
m_Name = value;
|
m_Name = value;
|
||||||
|
|
||||||
}
|
}
|
||||||
std::vector<std::string>& Pet::getPhotoUrls()
|
std::vector<std::string>& Pet::getPhotoUrls()
|
||||||
{
|
{
|
||||||
return m_PhotoUrls;
|
return m_PhotoUrls;
|
||||||
}
|
}
|
||||||
|
void Pet::setPhotoUrls(std::vector<std::string> const& value)
|
||||||
|
{
|
||||||
|
m_PhotoUrls = value;
|
||||||
|
}
|
||||||
std::vector<Tag>& Pet::getTags()
|
std::vector<Tag>& Pet::getTags()
|
||||||
{
|
{
|
||||||
return m_Tags;
|
return m_Tags;
|
||||||
}
|
}
|
||||||
|
void Pet::setTags(std::vector<Tag> const& value)
|
||||||
|
{
|
||||||
|
m_Tags = value;
|
||||||
|
m_TagsIsSet = true;
|
||||||
|
}
|
||||||
bool Pet::tagsIsSet() const
|
bool Pet::tagsIsSet() const
|
||||||
{
|
{
|
||||||
return m_TagsIsSet;
|
return m_TagsIsSet;
|
||||||
|
@ -67,10 +67,12 @@ public:
|
|||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
std::vector<std::string>& getPhotoUrls();
|
std::vector<std::string>& getPhotoUrls();
|
||||||
|
void setPhotoUrls(std::vector<std::string> const& value);
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
std::vector<Tag>& getTags();
|
std::vector<Tag>& getTags();
|
||||||
|
void setTags(std::vector<Tag> const& value);
|
||||||
bool tagsIsSet() const;
|
bool tagsIsSet() const;
|
||||||
void unsetTags();
|
void unsetTags();
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user