verion which did not include the handling in RTService wth creating the
Json file
This commit is contained in:
50
vrpmdvaotserver/src/SwaggerComponent.hpp
Normal file
50
vrpmdvaotserver/src/SwaggerComponent.hpp
Normal file
@@ -0,0 +1,50 @@
|
||||
|
||||
#ifndef VRPMDV_SWAGGERCOMPONENT_HPP
|
||||
#define VRPMDV_SWAGGERCOMPONENT_HPP
|
||||
|
||||
#include "oatpp-swagger/Model.hpp"
|
||||
#include "oatpp-swagger/Resources.hpp"
|
||||
#include "oatpp/core/macro/component.hpp"
|
||||
|
||||
/**
|
||||
* Swagger ui is served at
|
||||
* http://host:port/swagger/ui
|
||||
*/
|
||||
class SwaggerComponent {
|
||||
public:
|
||||
|
||||
/**
|
||||
* General API docs info
|
||||
*/
|
||||
OATPP_CREATE_COMPONENT(std::shared_ptr<oatpp::swagger::DocumentInfo>, swaggerDocumentInfo)([] {
|
||||
|
||||
oatpp::swagger::DocumentInfo::Builder builder;
|
||||
|
||||
builder
|
||||
.setTitle("User entity service")
|
||||
.setDescription("CRUD API Example project with swagger docs")
|
||||
.setVersion("1.0")
|
||||
.setContactName("Ivan Ovsyanochka")
|
||||
.setContactUrl("https://oatpp.io/")
|
||||
|
||||
.setLicenseName("Apache License, Version 2.0")
|
||||
.setLicenseUrl("http://www.apache.org/licenses/LICENSE-2.0")
|
||||
|
||||
.addServer("http://localhost:8000", "server on localhost");
|
||||
|
||||
return builder.build();
|
||||
|
||||
}());
|
||||
|
||||
|
||||
/**
|
||||
* Swagger-Ui Resources (<oatpp-examples>/lib/oatpp-swagger/res)
|
||||
*/
|
||||
OATPP_CREATE_COMPONENT(std::shared_ptr<oatpp::swagger::Resources>, swaggerResources)([] {
|
||||
// Make sure to specify correct full path to oatpp-swagger/res folder !!!
|
||||
return oatpp::swagger::Resources::loadResources(OATPP_SWAGGER_RES_PATH);
|
||||
}());
|
||||
|
||||
};
|
||||
|
||||
#endif /* SwaggerComponent_hpp */
|
||||
Reference in New Issue
Block a user