File tree Expand file tree Collapse file tree 2 files changed +4
-4
lines changed Expand file tree Collapse file tree 2 files changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -35,7 +35,7 @@ class BookController : public oatpp::web::server::api::ApiController {
35
35
ENDPOINT_INFO (getBookById) {
36
36
// general
37
37
info->summary = " Get one Book by bookId" ;
38
- info->addResponse <dto::BookInfoDto>(Status::CODE_200, " application/json" );
38
+ info->addResponse <oatpp::Object< dto::BookInfoDto> >(Status::CODE_200, " application/json" );
39
39
info->addResponse <String>(Status::CODE_404, " text/plain" );
40
40
// params specific
41
41
info->pathParams [" bookId" ].description = " Book Identifier" ;
@@ -46,12 +46,12 @@ class BookController : public oatpp::web::server::api::ApiController {
46
46
auto response = bookService->getBookById (bookId);
47
47
OATPP_ASSERT_HTTP (response->getStatusCode () == 200 , Status::CODE_500, " Unable to get book by id" );
48
48
49
- auto book = response->readBodyToDto <dto::BookDto>(getDefaultObjectMapper ().get ());
49
+ auto book = response->readBodyToDto <oatpp::Object< dto::BookDto> >(getDefaultObjectMapper ().get ());
50
50
51
51
response = userService->getUserById (book->authorId );
52
52
OATPP_ASSERT_HTTP (response->getStatusCode () == 200 , Status::CODE_500, " Unable to get user by id" );
53
53
54
- auto user = response->readBodyToDto <dto::UserDto>(getDefaultObjectMapper ().get ());
54
+ auto user = response->readBodyToDto <oatpp::Object< dto::UserDto> >(getDefaultObjectMapper ().get ());
55
55
56
56
auto bookInfoDto = dto::BookInfoDto::createShared ();
57
57
bookInfoDto->id = book->id ;
Original file line number Diff line number Diff line change @@ -17,7 +17,7 @@ class BookInfoDto : public oatpp::DTO {
17
17
18
18
DTO_FIELD (Int64, id);
19
19
DTO_FIELD (String, title, " title" );
20
- DTO_FIELD (UserDto, author);
20
+ DTO_FIELD (Object< UserDto> , author);
21
21
22
22
};
23
23
You can’t perform that action at this time.
0 commit comments