[C++][Pistache] Add compatibility for nlohmann-json 3.5.0 (#3306)

* [C++][Pistache] Replace contains with find on json object

This makes generator compatible with nlohmann-json 3.5.0

* [C++][Pistache] Update Petstore sample
This commit is contained in:
Mateusz Szychowski (Muttley)
2019-07-13 13:31:14 +02:00
committed by Stefan Krismann
parent 4843dfc244
commit c1df082d65
9 changed files with 30 additions and 30 deletions

View File

@@ -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;