forked from loafle/openapi-generator-original
Better allOf handling in fromProperty (#15035)
* fix allOf handling in fromProperty * add null check, update samples * update dart generator to handle allof with a single ref
This commit is contained in:
@@ -20,6 +20,7 @@
|
||||
#include <sstream>
|
||||
#include <stdexcept>
|
||||
#include <regex>
|
||||
#include <algorithm>
|
||||
#include <boost/lexical_cast.hpp>
|
||||
#include <boost/property_tree/ptree.hpp>
|
||||
#include <boost/property_tree/json_parser.hpp>
|
||||
@@ -63,7 +64,6 @@ ptree AllOfWithSingleRef::toPropertyTree() const
|
||||
ptree pt;
|
||||
ptree tmp_node;
|
||||
pt.put("username", m_Username);
|
||||
pt.add_child("SingleRefType", m_SingleRefType.toPropertyTree());
|
||||
return pt;
|
||||
}
|
||||
|
||||
@@ -71,9 +71,6 @@ void AllOfWithSingleRef::fromPropertyTree(ptree const &pt)
|
||||
{
|
||||
ptree tmp_node;
|
||||
m_Username = pt.get("username", "");
|
||||
if (pt.get_child_optional("SingleRefType")) {
|
||||
m_SingleRefType = fromPt<SingleRefType>(pt.get_child("SingleRefType"));
|
||||
}
|
||||
}
|
||||
|
||||
std::string AllOfWithSingleRef::getUsername() const
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
#include "SingleRefType.h"
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
#include <array>
|
||||
#include <boost/property_tree/ptree.hpp>
|
||||
#include "helpers.h"
|
||||
|
||||
@@ -72,7 +73,7 @@ public:
|
||||
|
||||
protected:
|
||||
std::string m_Username = "";
|
||||
SingleRefType m_SingleRefType;
|
||||
SingleRefType m_SingleRefType = SingleRefType{};
|
||||
};
|
||||
|
||||
std::vector<AllOfWithSingleRef> createAllOfWithSingleRefVectorFromJsonString(const std::string& json);
|
||||
|
||||
Reference in New Issue
Block a user