Skip to content

Commit

Permalink
update to the latest oatpp API version.
Browse files Browse the repository at this point in the history
  • Loading branch information
lganzzzo committed Oct 24, 2021
1 parent 47ab8a6 commit 16424c5
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 14 deletions.
6 changes: 3 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ target_include_directories(${project_name}-lib PUBLIC src)

## link libs

find_package(oatpp 1.2.5 REQUIRED)
find_package(oatpp-swagger 1.2.5 REQUIRED)
find_package(oatpp-postgresql 1.2.5 REQUIRED)
find_package(oatpp 1.3.0 REQUIRED)
find_package(oatpp-swagger 1.3.0 REQUIRED)
find_package(oatpp-postgresql 1.3.0 REQUIRED)

target_link_libraries(${project_name}-lib
PUBLIC oatpp::oatpp
Expand Down
6 changes: 3 additions & 3 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
# https://aka.ms/yaml

jobs:
- job: ubuntu_16_04
displayName: 'Build - Ubuntu 16.04'
- job: ubuntu_20_04
displayName: 'Build - Ubuntu 20.04'
continueOnError: false
pool:
vmImage: 'Ubuntu 16.04'
vmImage: 'ubuntu-20.04'
workspace:
clean: all
steps:
Expand Down
10 changes: 3 additions & 7 deletions src/App.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,11 @@ void run(const oatpp::base::CommandLineArguments& args) {
/* create ApiControllers and add endpoints to router */

auto router = serviceComponent.httpRouter.getObject();
auto docEndpoints = oatpp::swagger::Controller::Endpoints::createShared();
oatpp::web::server::api::Endpoints docEndpoints;

auto userController = UserController::createShared();
userController->addEndpointsToRouter(router);
docEndpoints.append(router->addController(UserController::createShared())->getEndpoints());

docEndpoints->pushBackAll(userController->getEndpoints()); // Add userController to swagger

auto swaggerController = oatpp::swagger::Controller::createShared(docEndpoints);
swaggerController->addEndpointsToRouter(router);
router->addController(oatpp::swagger::Controller::createShared(docEndpoints));

/* create server */

Expand Down
2 changes: 1 addition & 1 deletion src/AppComponent.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class AppComponent {
const char* configPath = CONFIG_PATH;
auto objectMapper = oatpp::parser::json::mapping::ObjectMapper::createShared();

oatpp::String configText = oatpp::base::StrBuffer::loadFromFile(configPath);
oatpp::String configText = oatpp::String::loadFromFile(configPath);
if (configText) {

auto profiles = objectMapper->readFromString<oatpp::Fields<oatpp::Object<ConfigDto>>>(configText);
Expand Down
1 change: 1 addition & 0 deletions src/ServiceComponent.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ class ServiceComponent {
OATPP_CREATE_COMPONENT(std::shared_ptr<oatpp::data::mapping::ObjectMapper>, apiObjectMapper)([] {
auto mapper = oatpp::parser::json::mapping::ObjectMapper::createShared();
mapper->getSerializer()->getConfig()->useBeautifier = true;
mapper->getSerializer()->getConfig()->escapeFlags = 0;
return mapper;
}());

Expand Down

0 comments on commit 16424c5

Please sign in to comment.