#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, 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 (/lib/oatpp-swagger/res) */ OATPP_CREATE_COMPONENT(std::shared_ptr, 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 */