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 @@ -35,12 +35,10 @@ public:
/// <summary>
/// {{description}}
/// </summary>
{{#isContainer}}{{{dataType}}}& {{getter}}();
{{/isContainer}}{{^isContainer}}{{{dataType}}} {{getter}}() const;
void {{setter}}({{{dataType}}} const{{^isPrimitiveType}}&{{/isPrimitiveType}} value);
{{/isContainer}}{{^required}}bool {{nameInCamelCase}}IsSet() const;
void unset{{name}}();
{{/required}}
{{{dataType}}}{{#isContainer}}&{{/isContainer}} {{getter}}(){{^isContainer}} const{{/isContainer}};
void {{setter}}({{{dataType}}} const{{^isPrimitiveType}}&{{/isPrimitiveType}} value);{{^required}}
bool {{nameInCamelCase}}IsSet() const;
void unset{{name}}();{{/required}}
{{/vars}}

friend void to_json(nlohmann::json& j, const {{classname}}& o);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ void to_json(nlohmann::json& j, const {{classname}}& o)
{
j = nlohmann::json();
{{#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}}
{{/vars}}
}
Expand All @@ -45,20 +45,15 @@ void from_json(const nlohmann::json& j, {{classname}}& o)
{{/vars}}
}

{{#vars}}{{#isContainer}}{{{dataType}}}& {{classname}}::{{getter}}()
{
return m_{{name}};
}
{{/isContainer}}{{^isContainer}}{{{dataType}}} {{classname}}::{{getter}}() const
{{#vars}}{{{dataType}}}{{#isContainer}}&{{/isContainer}} {{classname}}::{{getter}}(){{^isContainer}} const{{/isContainer}}
{
return m_{{name}};
}
void {{classname}}::{{setter}}({{{dataType}}} const{{^isPrimitiveType}}&{{/isPrimitiveType}} value)
{
m_{{name}} = value;
{{^required}}m_{{name}}IsSet = true;{{/required}}
m_{{name}} = value;{{^required}}
m_{{name}}IsSet = true;{{/required}}
}
{{/isContainer}}
{{^required}}bool {{classname}}::{{nameInCamelCase}}IsSet() const
{
return m_{{name}}IsSet;
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
4.1.0-SNAPSHOT
4.1.2-SNAPSHOT
12 changes: 10 additions & 2 deletions samples/server/petstore/cpp-pistache/model/Pet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ void to_json(nlohmann::json& j, const Pet& o)
j["category"] = o.m_Category;
j["name"] = o.m_Name;
j["photoUrls"] = o.m_PhotoUrls;
if(o.tagsIsSet())
if(o.tagsIsSet() || !o.m_Tags.empty())
j["tags"] = o.m_Tags;
if(o.statusIsSet())
j["status"] = o.m_Status;
Expand Down Expand Up @@ -121,16 +121,24 @@ std::string Pet::getName() const
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;
Expand Down
6 changes: 4 additions & 2 deletions samples/server/petstore/cpp-pistache/model/Pet.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,14 +63,16 @@ class Pet
/// </summary>
std::string getName() const;
void setName(std::string const& value);
/// <summary>
/// <summary>
///
/// </summary>
std::vector<std::string>& getPhotoUrls();
/// <summary>
void setPhotoUrls(std::vector<std::string> const& value);
/// <summary>
///
/// </summary>
std::vector<Tag>& getTags();
void setTags(std::vector<Tag> const& value);
bool tagsIsSet() const;
void unsetTags();
/// <summary>
Expand Down