diff --git a/modules/openapi-generator/src/main/resources/cpp-pistache-server/model-struct-header.mustache b/modules/openapi-generator/src/main/resources/cpp-pistache-server/model-struct-header.mustache index 3fc013a8b0c..4113a04e6b3 100644 --- a/modules/openapi-generator/src/main/resources/cpp-pistache-server/model-struct-header.mustache +++ b/modules/openapi-generator/src/main/resources/cpp-pistache-server/model-struct-header.mustache @@ -24,6 +24,9 @@ struct {{classname}} {{^required}}Pistache::Optional<{{/required}}{{{dataType}}}{{^required}}>{{/required}} {{baseName}}; {{/vars}} + bool operator==(const {{classname}}& other) const; + bool operator!=(const {{classname}}& other) const; + nlohmann::json to_json() const; static {{classname}} from_json(const nlohmann::json& j); }; diff --git a/modules/openapi-generator/src/main/resources/cpp-pistache-server/model-struct-source.mustache b/modules/openapi-generator/src/main/resources/cpp-pistache-server/model-struct-source.mustache index 2e4f114cc73..b67e8aa366e 100644 --- a/modules/openapi-generator/src/main/resources/cpp-pistache-server/model-struct-source.mustache +++ b/modules/openapi-generator/src/main/resources/cpp-pistache-server/model-struct-source.mustache @@ -21,6 +21,16 @@ nlohmann::json {{classname}}::to_json() const return o; } +bool {{classname}}::operator==(const {{classname}}& other) const +{ + return {{#vars}}{{baseName}} == other.{{baseName}}{{#hasMore}} && {{/hasMore}}{{/vars}}; +} + +bool {{classname}}::operator!=(const {{classname}}& other) const +{ + return !(*this == other); +} + void to_json(nlohmann::json& j, const {{classname}}& o) { {{#vars}} diff --git a/samples/server/petstore/cpp-pistache/.openapi-generator/VERSION b/samples/server/petstore/cpp-pistache/.openapi-generator/VERSION index d168f1d8bda..e4955748d3e 100644 --- a/samples/server/petstore/cpp-pistache/.openapi-generator/VERSION +++ b/samples/server/petstore/cpp-pistache/.openapi-generator/VERSION @@ -1 +1 @@ -4.2.1-SNAPSHOT \ No newline at end of file +4.2.2-SNAPSHOT \ No newline at end of file