Skip to content

Commit f9d62c7

Browse files
committedMay 23, 2020
Update to the latest oatpp API.
1 parent 5bd9c91 commit f9d62c7

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed
 

‎src/controller/MyController.hpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -82,10 +82,10 @@ class MyController : public oatpp::web::server::api::ApiController {
8282
ENDPOINT_ASYNC_INIT(EchoDtoBody)
8383

8484
Action act() override {
85-
return request->readBodyToDtoAsync<MessageDto>(controller->getDefaultObjectMapper()).callbackTo(&EchoDtoBody::returnResponse);
85+
return request->readBodyToDtoAsync<oatpp::Object<MessageDto>>(controller->getDefaultObjectMapper()).callbackTo(&EchoDtoBody::returnResponse);
8686
}
8787

88-
Action returnResponse(const MessageDto::ObjectWrapper& body){
88+
Action returnResponse(const oatpp::Object<MessageDto>& body){
8989
return _return(controller->createDtoResponse(Status::CODE_200, body));
9090
}
9191

‎src/dto/MyDTOs.hpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,19 @@
1111
* Data Transfer Object. Object containing fields only.
1212
* Used in API for serialization/deserialization and validation
1313
*/
14-
class HelloDto : public oatpp::Object {
14+
class HelloDto : public oatpp::DTO {
1515

16-
DTO_INIT(HelloDto, Object)
16+
DTO_INIT(HelloDto, DTO)
1717

1818
DTO_FIELD(String, userAgent, "user-agent");
1919
DTO_FIELD(String, message);
2020
DTO_FIELD(String, server);
2121

2222
};
2323

24-
class MessageDto : public oatpp::Object {
24+
class MessageDto : public oatpp::DTO {
2525

26-
DTO_INIT(MessageDto, Object)
26+
DTO_INIT(MessageDto, DTO)
2727

2828
DTO_FIELD(String, message);
2929

0 commit comments

Comments
 (0)
Please sign in to comment.