[cpp-restbed] Added "out-of-the-box" functionality (#4759)

* Added cpp-restbed "out-of-the-box" functionality
* handling class dependencies
* added method override to clean interfaces of ambiguity
* added default values for shared pointers
* fixed _name and name parameters generating the same getters and setters
* updated enum handling
* updated Petstore samples
* updated templates for automated object generation

* fix whitespace

* removed model initialisation

* added model brace initialisation
This commit is contained in:
AlexG
2020-01-02 13:36:22 +01:00
committed by William Cheng
parent 5cc5fbe76a
commit 1cb99e3497
24 changed files with 582 additions and 189 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 4.2.0-SNAPSHOT.
* NOTE: This class is auto generated by OpenAPI-Generator unset.
* https://openapi-generator.tech
* Do not edit the class manually.
*/
@@ -28,19 +28,19 @@ using namespace org::openapitools::server::model;
PetApi::PetApi() {
std::shared_ptr<PetApiPetResource> spPetApiPetResource = std::make_shared<PetApiPetResource>();
this->publish(spPetApiPetResource);
std::shared_ptr<PetApiPetPetIdResource> spPetApiPetPetIdResource = std::make_shared<PetApiPetPetIdResource>();
this->publish(spPetApiPetPetIdResource);
std::shared_ptr<PetApiPetFindByStatusResource> spPetApiPetFindByStatusResource = std::make_shared<PetApiPetFindByStatusResource>();
this->publish(spPetApiPetFindByStatusResource);
std::shared_ptr<PetApiPetFindByTagsResource> spPetApiPetFindByTagsResource = std::make_shared<PetApiPetFindByTagsResource>();
this->publish(spPetApiPetFindByTagsResource);
std::shared_ptr<PetApiPetPetIdUploadImageResource> spPetApiPetPetIdUploadImageResource = std::make_shared<PetApiPetPetIdUploadImageResource>();
this->publish(spPetApiPetPetIdUploadImageResource);
}
PetApi::~PetApi() {}
@@ -66,6 +66,9 @@ PetApiPetResource::PetApiPetResource()
this->set_method_handler("PUT",
std::bind(&PetApiPetResource::PUT_method_handler, this,
std::placeholders::_1));
body = std::make_shared<Pet>();
}
PetApiPetResource::~PetApiPetResource()
@@ -178,6 +181,10 @@ PetApiPetPetIdResource::PetApiPetPetIdResource()
this->set_method_handler("POST",
std::bind(&PetApiPetPetIdResource::POST_method_handler, this,
std::placeholders::_1));
petId = 0L;
apiKey = "";
}
PetApiPetPetIdResource::~PetApiPetPetIdResource()
@@ -302,6 +309,8 @@ PetApiPetFindByStatusResource::PetApiPetFindByStatusResource()
this->set_method_handler("GET",
std::bind(&PetApiPetFindByStatusResource::GET_method_handler, this,
std::placeholders::_1));
}
PetApiPetFindByStatusResource::~PetApiPetFindByStatusResource()
@@ -354,6 +363,8 @@ PetApiPetFindByTagsResource::PetApiPetFindByTagsResource()
this->set_method_handler("GET",
std::bind(&PetApiPetFindByTagsResource::GET_method_handler, this,
std::placeholders::_1));
}
PetApiPetFindByTagsResource::~PetApiPetFindByTagsResource()
@@ -406,6 +417,11 @@ PetApiPetPetIdUploadImageResource::PetApiPetPetIdUploadImageResource()
this->set_method_handler("POST",
std::bind(&PetApiPetPetIdUploadImageResource::POST_method_handler, this,
std::placeholders::_1));
petId = 0L;
additionalMetadata = "";
file = "";
}
PetApiPetPetIdUploadImageResource::~PetApiPetPetIdUploadImageResource()

View File

@@ -5,7 +5,7 @@
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI-Generator 4.2.0-SNAPSHOT.
* NOTE: This class is auto generated by OpenAPI-Generator unset.
* https://openapi-generator.tech
* Do not edit the class manually.
*/
@@ -82,6 +82,8 @@ private:
std::function<std::pair<int, std::string>(
std::shared_ptr<Pet> const &
)> handler_PUT_;
std::shared_ptr<Pet> body;
};
/// <summary>
@@ -127,6 +129,9 @@ private:
std::function<std::pair<int, std::string>(
int64_t const &, std::string const &, std::string const &
)> handler_POST_;
int64_t petId;
std::string apiKey;
};
/// <summary>
@@ -154,6 +159,8 @@ private:
std::vector<std::string> const &
)> handler_GET_;
std::vector<std::string> status;
};
/// <summary>
@@ -181,6 +188,8 @@ private:
std::vector<std::string> const &
)> handler_GET_;
std::vector<std::string> tags;
};
/// <summary>
@@ -208,6 +217,10 @@ private:
int64_t const &, std::string const &, std::string const &
)> handler_POST_;
int64_t petId;
std::string additionalMetadata;
std::string file;
};

View File

@@ -5,7 +5,7 @@
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI-Generator 4.2.0-SNAPSHOT.
* NOTE: This class is auto generated by OpenAPI-Generator unset.
* https://openapi-generator.tech
* Do not edit the class manually.
*/
@@ -28,13 +28,13 @@ using namespace org::openapitools::server::model;
StoreApi::StoreApi() {
std::shared_ptr<StoreApiStoreOrderOrderIdResource> spStoreApiStoreOrderOrderIdResource = std::make_shared<StoreApiStoreOrderOrderIdResource>();
this->publish(spStoreApiStoreOrderOrderIdResource);
std::shared_ptr<StoreApiStoreInventoryResource> spStoreApiStoreInventoryResource = std::make_shared<StoreApiStoreInventoryResource>();
this->publish(spStoreApiStoreInventoryResource);
std::shared_ptr<StoreApiStoreOrderResource> spStoreApiStoreOrderResource = std::make_shared<StoreApiStoreOrderResource>();
this->publish(spStoreApiStoreOrderResource);
}
StoreApi::~StoreApi() {}
@@ -60,6 +60,9 @@ StoreApiStoreOrderOrderIdResource::StoreApiStoreOrderOrderIdResource()
this->set_method_handler("GET",
std::bind(&StoreApiStoreOrderOrderIdResource::GET_method_handler, this,
std::placeholders::_1));
orderId = "";
}
StoreApiStoreOrderOrderIdResource::~StoreApiStoreOrderOrderIdResource()
@@ -154,6 +157,8 @@ StoreApiStoreInventoryResource::StoreApiStoreInventoryResource()
this->set_method_handler("GET",
std::bind(&StoreApiStoreInventoryResource::GET_method_handler, this,
std::placeholders::_1));
}
StoreApiStoreInventoryResource::~StoreApiStoreInventoryResource()
@@ -201,6 +206,9 @@ StoreApiStoreOrderResource::StoreApiStoreOrderResource()
this->set_method_handler("POST",
std::bind(&StoreApiStoreOrderResource::POST_method_handler, this,
std::placeholders::_1));
body = std::make_shared<Order>();
}
StoreApiStoreOrderResource::~StoreApiStoreOrderResource()

View File

@@ -5,7 +5,7 @@
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI-Generator 4.2.0-SNAPSHOT.
* NOTE: This class is auto generated by OpenAPI-Generator unset.
* https://openapi-generator.tech
* Do not edit the class manually.
*/
@@ -82,6 +82,8 @@ private:
std::function<std::pair<int, std::string>(
int64_t const &
)> handler_GET_;
std::string orderId;
};
/// <summary>
@@ -109,6 +111,7 @@ private:
)> handler_GET_;
};
/// <summary>
@@ -136,6 +139,8 @@ private:
std::shared_ptr<Order> const &
)> handler_POST_;
std::shared_ptr<Order> body;
};

View File

@@ -5,7 +5,7 @@
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI-Generator 4.2.0-SNAPSHOT.
* NOTE: This class is auto generated by OpenAPI-Generator unset.
* https://openapi-generator.tech
* Do not edit the class manually.
*/
@@ -28,22 +28,22 @@ using namespace org::openapitools::server::model;
UserApi::UserApi() {
std::shared_ptr<UserApiUserResource> spUserApiUserResource = std::make_shared<UserApiUserResource>();
this->publish(spUserApiUserResource);
std::shared_ptr<UserApiUserCreateWithArrayResource> spUserApiUserCreateWithArrayResource = std::make_shared<UserApiUserCreateWithArrayResource>();
this->publish(spUserApiUserCreateWithArrayResource);
std::shared_ptr<UserApiUserCreateWithListResource> spUserApiUserCreateWithListResource = std::make_shared<UserApiUserCreateWithListResource>();
this->publish(spUserApiUserCreateWithListResource);
std::shared_ptr<UserApiUserUsernameResource> spUserApiUserUsernameResource = std::make_shared<UserApiUserUsernameResource>();
this->publish(spUserApiUserUsernameResource);
std::shared_ptr<UserApiUserLoginResource> spUserApiUserLoginResource = std::make_shared<UserApiUserLoginResource>();
this->publish(spUserApiUserLoginResource);
std::shared_ptr<UserApiUserLogoutResource> spUserApiUserLogoutResource = std::make_shared<UserApiUserLogoutResource>();
this->publish(spUserApiUserLogoutResource);
}
UserApi::~UserApi() {}
@@ -66,6 +66,9 @@ UserApiUserResource::UserApiUserResource()
this->set_method_handler("POST",
std::bind(&UserApiUserResource::POST_method_handler, this,
std::placeholders::_1));
body = std::make_shared<User>();
}
UserApiUserResource::~UserApiUserResource()
@@ -125,6 +128,8 @@ UserApiUserCreateWithArrayResource::UserApiUserCreateWithArrayResource()
this->set_method_handler("POST",
std::bind(&UserApiUserCreateWithArrayResource::POST_method_handler, this,
std::placeholders::_1));
}
UserApiUserCreateWithArrayResource::~UserApiUserCreateWithArrayResource()
@@ -184,6 +189,8 @@ UserApiUserCreateWithListResource::UserApiUserCreateWithListResource()
this->set_method_handler("POST",
std::bind(&UserApiUserCreateWithListResource::POST_method_handler, this,
std::placeholders::_1));
}
UserApiUserCreateWithListResource::~UserApiUserCreateWithListResource()
@@ -249,6 +256,9 @@ UserApiUserUsernameResource::UserApiUserUsernameResource()
this->set_method_handler("PUT",
std::bind(&UserApiUserUsernameResource::PUT_method_handler, this,
std::placeholders::_1));
username = "";
}
UserApiUserUsernameResource::~UserApiUserUsernameResource()
@@ -388,6 +398,10 @@ UserApiUserLoginResource::UserApiUserLoginResource()
this->set_method_handler("GET",
std::bind(&UserApiUserLoginResource::GET_method_handler, this,
std::placeholders::_1));
username = "";
password = "";
}
UserApiUserLoginResource::~UserApiUserLoginResource()
@@ -446,6 +460,8 @@ UserApiUserLogoutResource::UserApiUserLogoutResource()
this->set_method_handler("GET",
std::bind(&UserApiUserLogoutResource::GET_method_handler, this,
std::placeholders::_1));
}
UserApiUserLogoutResource::~UserApiUserLogoutResource()

View File

@@ -5,7 +5,7 @@
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI-Generator 4.2.0-SNAPSHOT.
* NOTE: This class is auto generated by OpenAPI-Generator unset.
* https://openapi-generator.tech
* Do not edit the class manually.
*/
@@ -73,6 +73,8 @@ private:
std::shared_ptr<User> const &
)> handler_POST_;
std::shared_ptr<User> body;
};
/// <summary>
@@ -100,6 +102,8 @@ private:
std::vector<std::shared_ptr<User>> const &
)> handler_POST_;
std::vector<std::shared_ptr<User>> body;
};
/// <summary>
@@ -127,6 +131,8 @@ private:
std::vector<std::shared_ptr<User>> const &
)> handler_POST_;
std::vector<std::shared_ptr<User>> body;
};
/// <summary>
@@ -172,6 +178,8 @@ private:
std::function<std::pair<int, std::string>(
std::string const &, std::shared_ptr<User> const &
)> handler_PUT_;
std::string username;
};
/// <summary>
@@ -199,6 +207,9 @@ private:
std::string const &, std::string const &
)> handler_GET_;
std::string username;
std::string password;
};
/// <summary>
@@ -226,6 +237,7 @@ private:
)> handler_GET_;
};