diff --git a/modules/openapi-generator/src/main/resources/cpp-pistache-server/model-source.mustache b/modules/openapi-generator/src/main/resources/cpp-pistache-server/model-source.mustache index c58a2fc79a0..e69d65cafc6 100644 --- a/modules/openapi-generator/src/main/resources/cpp-pistache-server/model-source.mustache +++ b/modules/openapi-generator/src/main/resources/cpp-pistache-server/model-source.mustache @@ -37,7 +37,7 @@ void to_json(nlohmann::json& j, const {{classname}}& o) void from_json(const nlohmann::json& j, {{classname}}& o) { {{#vars}} - {{#required}}j.at("{{baseName}}").get_to(o.m_{{name}});{{/required}}{{^required}}if(j.contains("{{baseName}}")) + {{#required}}j.at("{{baseName}}").get_to(o.m_{{name}});{{/required}}{{^required}}if(j.find("{{baseName}}") != j.end()) { j.at("{{baseName}}").get_to(o.m_{{name}}); o.m_{{name}}IsSet = true; diff --git a/samples/server/petstore/cpp-pistache/model/ApiResponse.cpp b/samples/server/petstore/cpp-pistache/model/ApiResponse.cpp index a78fb1cc7f9..77cd466e145 100644 --- a/samples/server/petstore/cpp-pistache/model/ApiResponse.cpp +++ b/samples/server/petstore/cpp-pistache/model/ApiResponse.cpp @@ -51,17 +51,17 @@ void to_json(nlohmann::json& j, const ApiResponse& o) void from_json(const nlohmann::json& j, ApiResponse& o) { - if(j.contains("code")) + if(j.find("code") != j.end()) { j.at("code").get_to(o.m_Code); o.m_CodeIsSet = true; } - if(j.contains("type")) + if(j.find("type") != j.end()) { j.at("type").get_to(o.m_Type); o.m_TypeIsSet = true; } - if(j.contains("message")) + if(j.find("message") != j.end()) { j.at("message").get_to(o.m_Message); o.m_MessageIsSet = true; diff --git a/samples/server/petstore/cpp-pistache/model/Category.cpp b/samples/server/petstore/cpp-pistache/model/Category.cpp index 2abb0c3c5e2..43ff1d49000 100644 --- a/samples/server/petstore/cpp-pistache/model/Category.cpp +++ b/samples/server/petstore/cpp-pistache/model/Category.cpp @@ -47,12 +47,12 @@ void to_json(nlohmann::json& j, const Category& o) void from_json(const nlohmann::json& j, Category& o) { - if(j.contains("id")) + if(j.find("id") != j.end()) { j.at("id").get_to(o.m_Id); o.m_IdIsSet = true; } - if(j.contains("name")) + if(j.find("name") != j.end()) { j.at("name").get_to(o.m_Name); o.m_NameIsSet = true; diff --git a/samples/server/petstore/cpp-pistache/model/Inline_object.cpp b/samples/server/petstore/cpp-pistache/model/Inline_object.cpp index ebb31303908..89638a84566 100644 --- a/samples/server/petstore/cpp-pistache/model/Inline_object.cpp +++ b/samples/server/petstore/cpp-pistache/model/Inline_object.cpp @@ -47,12 +47,12 @@ void to_json(nlohmann::json& j, const Inline_object& o) void from_json(const nlohmann::json& j, Inline_object& o) { - if(j.contains("name")) + if(j.find("name") != j.end()) { j.at("name").get_to(o.m_Name); o.m_NameIsSet = true; } - if(j.contains("status")) + if(j.find("status") != j.end()) { j.at("status").get_to(o.m_Status); o.m_StatusIsSet = true; diff --git a/samples/server/petstore/cpp-pistache/model/Inline_object_1.cpp b/samples/server/petstore/cpp-pistache/model/Inline_object_1.cpp index d5ffe1fef88..0da3bdba2b8 100644 --- a/samples/server/petstore/cpp-pistache/model/Inline_object_1.cpp +++ b/samples/server/petstore/cpp-pistache/model/Inline_object_1.cpp @@ -46,12 +46,12 @@ void to_json(nlohmann::json& j, const Inline_object_1& o) void from_json(const nlohmann::json& j, Inline_object_1& o) { - if(j.contains("additionalMetadata")) + if(j.find("additionalMetadata") != j.end()) { j.at("additionalMetadata").get_to(o.m_AdditionalMetadata); o.m_AdditionalMetadataIsSet = true; } - if(j.contains("file")) + if(j.find("file") != j.end()) { j.at("file").get_to(o.m_file); o.m_fileIsSet = true; diff --git a/samples/server/petstore/cpp-pistache/model/Order.cpp b/samples/server/petstore/cpp-pistache/model/Order.cpp index b24cc0fce92..82efbce6cb2 100644 --- a/samples/server/petstore/cpp-pistache/model/Order.cpp +++ b/samples/server/petstore/cpp-pistache/model/Order.cpp @@ -63,32 +63,32 @@ void to_json(nlohmann::json& j, const Order& o) void from_json(const nlohmann::json& j, Order& o) { - if(j.contains("id")) + if(j.find("id") != j.end()) { j.at("id").get_to(o.m_Id); o.m_IdIsSet = true; } - if(j.contains("petId")) + if(j.find("petId") != j.end()) { j.at("petId").get_to(o.m_PetId); o.m_PetIdIsSet = true; } - if(j.contains("quantity")) + if(j.find("quantity") != j.end()) { j.at("quantity").get_to(o.m_Quantity); o.m_QuantityIsSet = true; } - if(j.contains("shipDate")) + if(j.find("shipDate") != j.end()) { j.at("shipDate").get_to(o.m_ShipDate); o.m_ShipDateIsSet = true; } - if(j.contains("status")) + if(j.find("status") != j.end()) { j.at("status").get_to(o.m_Status); o.m_StatusIsSet = true; } - if(j.contains("complete")) + if(j.find("complete") != j.end()) { j.at("complete").get_to(o.m_Complete); o.m_CompleteIsSet = true; diff --git a/samples/server/petstore/cpp-pistache/model/Pet.cpp b/samples/server/petstore/cpp-pistache/model/Pet.cpp index 7781e283ceb..1bceb861ad4 100644 --- a/samples/server/petstore/cpp-pistache/model/Pet.cpp +++ b/samples/server/petstore/cpp-pistache/model/Pet.cpp @@ -56,24 +56,24 @@ void to_json(nlohmann::json& j, const Pet& o) void from_json(const nlohmann::json& j, Pet& o) { - if(j.contains("id")) + if(j.find("id") != j.end()) { j.at("id").get_to(o.m_Id); o.m_IdIsSet = true; } - if(j.contains("category")) + 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.contains("tags")) + if(j.find("tags") != j.end()) { j.at("tags").get_to(o.m_Tags); o.m_TagsIsSet = true; } - if(j.contains("status")) + if(j.find("status") != j.end()) { j.at("status").get_to(o.m_Status); o.m_StatusIsSet = true; diff --git a/samples/server/petstore/cpp-pistache/model/Tag.cpp b/samples/server/petstore/cpp-pistache/model/Tag.cpp index b81cb825724..7f56fb2bcca 100644 --- a/samples/server/petstore/cpp-pistache/model/Tag.cpp +++ b/samples/server/petstore/cpp-pistache/model/Tag.cpp @@ -47,12 +47,12 @@ void to_json(nlohmann::json& j, const Tag& o) void from_json(const nlohmann::json& j, Tag& o) { - if(j.contains("id")) + if(j.find("id") != j.end()) { j.at("id").get_to(o.m_Id); o.m_IdIsSet = true; } - if(j.contains("name")) + if(j.find("name") != j.end()) { j.at("name").get_to(o.m_Name); o.m_NameIsSet = true; diff --git a/samples/server/petstore/cpp-pistache/model/User.cpp b/samples/server/petstore/cpp-pistache/model/User.cpp index 66a026e9c78..20ae06352f2 100644 --- a/samples/server/petstore/cpp-pistache/model/User.cpp +++ b/samples/server/petstore/cpp-pistache/model/User.cpp @@ -71,42 +71,42 @@ void to_json(nlohmann::json& j, const User& o) void from_json(const nlohmann::json& j, User& o) { - if(j.contains("id")) + if(j.find("id") != j.end()) { j.at("id").get_to(o.m_Id); o.m_IdIsSet = true; } - if(j.contains("username")) + if(j.find("username") != j.end()) { j.at("username").get_to(o.m_Username); o.m_UsernameIsSet = true; } - if(j.contains("firstName")) + if(j.find("firstName") != j.end()) { j.at("firstName").get_to(o.m_FirstName); o.m_FirstNameIsSet = true; } - if(j.contains("lastName")) + if(j.find("lastName") != j.end()) { j.at("lastName").get_to(o.m_LastName); o.m_LastNameIsSet = true; } - if(j.contains("email")) + if(j.find("email") != j.end()) { j.at("email").get_to(o.m_Email); o.m_EmailIsSet = true; } - if(j.contains("password")) + if(j.find("password") != j.end()) { j.at("password").get_to(o.m_Password); o.m_PasswordIsSet = true; } - if(j.contains("phone")) + if(j.find("phone") != j.end()) { j.at("phone").get_to(o.m_Phone); o.m_PhoneIsSet = true; } - if(j.contains("userStatus")) + if(j.find("userStatus") != j.end()) { j.at("userStatus").get_to(o.m_UserStatus); o.m_UserStatusIsSet = true;