Skip to content

Commit 16424c5

Browse files
committed
update to the latest oatpp API version.
1 parent 47ab8a6 commit 16424c5

File tree

5 files changed

+11
-14
lines changed

5 files changed

+11
-14
lines changed

CMakeLists.txt

+3-3
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ target_include_directories(${project_name}-lib PUBLIC src)
2727

2828
## link libs
2929

30-
find_package(oatpp 1.2.5 REQUIRED)
31-
find_package(oatpp-swagger 1.2.5 REQUIRED)
32-
find_package(oatpp-postgresql 1.2.5 REQUIRED)
30+
find_package(oatpp 1.3.0 REQUIRED)
31+
find_package(oatpp-swagger 1.3.0 REQUIRED)
32+
find_package(oatpp-postgresql 1.3.0 REQUIRED)
3333

3434
target_link_libraries(${project_name}-lib
3535
PUBLIC oatpp::oatpp

azure-pipelines.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@
44
# https://aka.ms/yaml
55

66
jobs:
7-
- job: ubuntu_16_04
8-
displayName: 'Build - Ubuntu 16.04'
7+
- job: ubuntu_20_04
8+
displayName: 'Build - Ubuntu 20.04'
99
continueOnError: false
1010
pool:
11-
vmImage: 'Ubuntu 16.04'
11+
vmImage: 'ubuntu-20.04'
1212
workspace:
1313
clean: all
1414
steps:

src/App.cpp

+3-7
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,11 @@ void run(const oatpp::base::CommandLineArguments& args) {
2121
/* create ApiControllers and add endpoints to router */
2222

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

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

29-
docEndpoints->pushBackAll(userController->getEndpoints()); // Add userController to swagger
30-
31-
auto swaggerController = oatpp::swagger::Controller::createShared(docEndpoints);
32-
swaggerController->addEndpointsToRouter(router);
28+
router->addController(oatpp::swagger::Controller::createShared(docEndpoints));
3329

3430
/* create server */
3531

src/AppComponent.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class AppComponent {
2828
const char* configPath = CONFIG_PATH;
2929
auto objectMapper = oatpp::parser::json::mapping::ObjectMapper::createShared();
3030

31-
oatpp::String configText = oatpp::base::StrBuffer::loadFromFile(configPath);
31+
oatpp::String configText = oatpp::String::loadFromFile(configPath);
3232
if (configText) {
3333

3434
auto profiles = objectMapper->readFromString<oatpp::Fields<oatpp::Object<ConfigDto>>>(configText);

src/ServiceComponent.hpp

+1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ class ServiceComponent {
2121
OATPP_CREATE_COMPONENT(std::shared_ptr<oatpp::data::mapping::ObjectMapper>, apiObjectMapper)([] {
2222
auto mapper = oatpp::parser::json::mapping::ObjectMapper::createShared();
2323
mapper->getSerializer()->getConfig()->useBeautifier = true;
24+
mapper->getSerializer()->getConfig()->escapeFlags = 0;
2425
return mapper;
2526
}());
2627

0 commit comments

Comments
 (0)