[cpp-restbed-server] make the restbed SERVER generator more extensible (#7679)

* Simple fix to allow users to override the Api class and set handlers

* fix definition order

* Regen petstore example files
This commit is contained in:
Francesco Montorsi
2020-10-27 08:35:10 +01:00
committed by GitHub
parent 3d6bd48b67
commit 4860eb65e1
21 changed files with 146 additions and 243 deletions

View File

@@ -5,7 +5,7 @@
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI-Generator unset.
* NOTE: This class is auto generated by OpenAPI-Generator 5.0.0-SNAPSHOT.
* https://openapi-generator.tech
* Do not edit the class manually.
*/
@@ -75,10 +75,12 @@ ptree Pet::toPropertyTree()
pt.add_child("photoUrls", tmp_node);
tmp_node.clear();
}
// generate tree for vector of pointers of Tags
// generate tree for Tags
if (!m_Tags.empty()) {
for (const auto &childEntry : m_Tags) {
tmp_node.push_back(std::make_pair("", childEntry->toPropertyTree()));
ptree Tags_node;
Tags_node.put("", childEntry);
tmp_node.push_back(std::make_pair("", Tags_node));
}
pt.add_child("tags", tmp_node);
tmp_node.clear();
@@ -102,11 +104,10 @@ void Pet::fromPropertyTree(ptree const &pt)
m_PhotoUrls.emplace_back(childTree.second.data());
}
}
// generate new Tag Object for each item and assign it to the current
// push all items of Tags into member vector
if (pt.get_child_optional("tags")) {
for (const auto &childTree : pt.get_child("tags")) {
m_Tags.emplace_back(std::make_shared<Tag>());
m_Tags.back()->fromPropertyTree(childTree.second);
m_Tags.emplace_back(childTree.second.data());
}
}
setStatus(pt.get("status", ""));