Overview
This API Server was generated by the OpenAPI Generator project. It uses the Restbed Framework.
Installation
Put the package under your project folder and import the API stubs. You need to complete the server stub, as it needs to be connected to a source.
Libraries required
- boost_system
- ssl (if Restbed was built with SSL Support)
- crypto
- pthread
- restbed
Namespaces
Generation
Perform request here, framework cpp-restbed-server
{
"openAPIUrl": "https://cdn.discordapp.com/attachments/900032368671350794/900425969381302312/REST_dummy_DuT.yaml",
"options": {
"apiPackage": "dummy_dut::rest::api",
"modelPackage": "dummy_dut::rest::model"
}
}
The following changes were done to the auto-generated files:
- Auto-format
- In DefaultApi.cpp:
- Create shared_ptr for message object from body and load json text into object.
- Change default return for callbacks to
501 - Not Implemented
and always return a response.
- Change implementation of the following method (to allow for ServerSent Events (SSE)):
{c++}
void DefaultApiDashboardMessagesResource::GET_method_handler(const std::shared_ptr<restbed::Session> session) {
const auto headers = std::multimap<std::string, std::string>{
{"Connection", "keep-alive"},
{"Cache-Control", "no-cache"},
{"Content-Type", "text/event-stream"}
};
session->yield(200, headers, [this](const std::shared_ptr<restbed::Session> &session) {
sessions.push_back(session);
});
}
- In DefaultApi.h:
- Remove unused variable
std::string clientUrl{}
from DefaultApiReadResource
to avoid shadowing.
- Add necessary variable
std::shared_ptr<Message> message{}
to DefaultApiDashboardResource
(missing from generated code, in other resource present).