Bladeren bron

DTO. Introduce the new oatpp::Object<T> - as an ObjectWrapper over oatpp::DTO.

lganzzzo 4 jaren geleden
bovenliggende
commit
1c0aea3f88

+ 7 - 1
src/oatpp/core/Types.hpp

@@ -102,10 +102,16 @@ namespace oatpp {
   typedef oatpp::data::mapping::type::Boolean Boolean;
 
   /**
-   * Mapping-Enabled DTO Object. Base class for all DTO objects. &id:oatpp::data::mapping::type::Object;
+   * Base class for all DTO objects. &id:oatpp::data::mapping::type::DTO;
    */
   typedef oatpp::data::mapping::type::DTO DTO;
 
+  /*
+   * Mapping-Enabled DTO Object.
+   */
+  template <class T>
+  using Object = oatpp::data::mapping::type::DTOWrapper<T>;
+
   /*
    * Mapping-Enabled Enum. &id:oatpp::data::mapping::type::Enum;
    */

+ 52 - 45
src/oatpp/core/data/mapping/type/Object.hpp

@@ -91,6 +91,55 @@ namespace __class {
   
 }
 
+/**
+ * ObjectWrapper for &l:DTO;. AKA `oatpp::Object<T>`.
+ * @tparam ObjT - class extended from &l:DTO;.
+ */
+template<class ObjT>
+class DTOWrapper : public ObjectWrapper<ObjT, __class::Object<ObjT>> {
+public:
+  typedef ObjT TemplateObjectType;
+  typedef __class::Object<ObjT> TemplateObjectClass;
+public:
+
+OATPP_DEFINE_OBJECT_WRAPPER_DEFAULTS(DTOWrapper, TemplateObjectType, TemplateObjectClass)
+
+  static DTOWrapper createShared() {
+    return std::make_shared<TemplateObjectType>();
+  }
+
+  template<typename T,
+    typename enabled = typename std::enable_if<std::is_same<T, std::nullptr_t>::value, void>::type
+  >
+  inline bool operator == (T){
+    return this->m_ptr.get() == nullptr;
+  }
+
+  template<typename T,
+    typename enabled = typename std::enable_if<std::is_same<T, std::nullptr_t>::value, void>::type
+  >
+  inline bool operator != (T){
+    return this->m_ptr.get() != nullptr;
+  }
+
+  template<typename T,
+    typename enabled = typename std::enable_if<std::is_same<T, DTOWrapper>::value, void>::type
+  >
+  inline bool operator == (const T &other) const {
+    if(this->m_ptr.get() == other.m_ptr.get()) return true;
+    if(!this->m_ptr || !other.m_ptr) return false;
+    return *this->m_ptr == *other.m_ptr;
+  }
+
+  template<typename T,
+    typename enabled = typename std::enable_if<std::is_same<T, DTOWrapper>::value, void>::type
+  >
+  inline bool operator != (const T &other) const {
+    return !operator == (other);
+  }
+
+};
+
 /**
  * Base class for all DTO objects.
  * For more info about Data Transfer Object (DTO) see [Data Transfer Object (DTO)](https://oatpp.io/docs/components/dto/).
@@ -114,6 +163,9 @@ public:
   typedef oatpp::data::mapping::type::Float64 Float64;
   typedef oatpp::data::mapping::type::Boolean Boolean;
 
+  template <class T>
+  using Object = DTOWrapper<T>;
+
   template <class T>
   using Enum = oatpp::data::mapping::type::Enum<T>;
 
@@ -163,51 +215,6 @@ public:
   }
 
 };
-
-template<class ObjT>
-class DTOWrapper : public ObjectWrapper<ObjT, __class::Object<ObjT>> {
-public:
-  typedef ObjT TemplateObjectType;
-  typedef __class::Object<ObjT> TemplateObjectClass;
-public:
-
-  OATPP_DEFINE_OBJECT_WRAPPER_DEFAULTS(DTOWrapper, TemplateObjectType, TemplateObjectClass)
-
-  static DTOWrapper createShared() {
-    return std::make_shared<TemplateObjectType>();
-  }
-
-  template<typename T,
-    typename enabled = typename std::enable_if<std::is_same<T, std::nullptr_t>::value, void>::type
-  >
-  inline bool operator == (T){
-    return this->m_ptr.get() == nullptr;
-  }
-
-  template<typename T,
-    typename enabled = typename std::enable_if<std::is_same<T, std::nullptr_t>::value, void>::type
-  >
-  inline bool operator != (T){
-    return this->m_ptr.get() != nullptr;
-  }
-
-  template<typename T,
-    typename enabled = typename std::enable_if<std::is_same<T, DTOWrapper>::value, void>::type
-  >
-  inline bool operator == (const T &other) const {
-    if(this->m_ptr.get() == other.m_ptr.get()) return true;
-    if(!this->m_ptr || !other.m_ptr) return false;
-    return *this->m_ptr == *other.m_ptr;
-  }
-
-  template<typename T,
-    typename enabled = typename std::enable_if<std::is_same<T, DTOWrapper>::value, void>::type
-  >
-  inline bool operator != (const T &other) const {
-    return !operator == (other);
-  }
-
-};
   
 }}}}
 

+ 3 - 0
src/oatpp/web/client/ApiClient.hpp

@@ -136,6 +136,9 @@ public:
 
   template <class T>
   using Enum = oatpp::data::mapping::type::Enum<T>;
+
+  template <class T>
+  using Object = oatpp::Object<T>;
 public:
 
   /**

+ 3 - 0
src/oatpp/web/server/api/ApiController.hpp

@@ -188,6 +188,9 @@ public:
    */
   typedef std::function<std::shared_ptr<Endpoint::Info>()> EndpointInfoBuilder;
 
+  template <class T>
+  using Object = oatpp::Object<T>;
+
   template <class T>
   using List = oatpp::List<T>;
 

+ 2 - 2
test/oatpp/core/data/mapping/type/AnyTest.cpp

@@ -110,12 +110,12 @@ void AnyTest::onRun() {
     oatpp::Any any(Dto1::createShared());
     OATPP_ASSERT(any);
     OATPP_ASSERT(any.valueType == oatpp::data::mapping::type::__class::Any::getType());
-    OATPP_ASSERT(any.getStoredType() == Dto1::Wrapper::Class::getType());
+    OATPP_ASSERT(any.getStoredType() == Object<Dto1>::Class::getType());
 
     bool wasError = false;
 
     try {
-      auto obj = any.retrieve<Dto2::Wrapper>(); // wrong object
+      auto obj = any.retrieve<oatpp::Object<Dto2>>(); // wrong object
     } catch (std::runtime_error& e) {
       wasError = true;
     }

+ 8 - 8
test/oatpp/core/data/mapping/type/ObjectTest.cpp

@@ -121,7 +121,7 @@ void ObjectTest::onRun() {
   {
     OATPP_LOGI(TAG, "Test Meta 1...");
 
-    auto type = DtoA::Wrapper::Class::getType();
+    auto type = Object<DtoA>::Class::getType();
     const auto& propsMap = type->propertiesGetter()->getMap();
 
     OATPP_ASSERT(propsMap.size() == 1);
@@ -136,7 +136,7 @@ void ObjectTest::onRun() {
   {
     OATPP_LOGI(TAG, "Test Meta 2...");
 
-    auto type = DtoB::Wrapper::Class::getType();
+    auto type = Object<DtoB>::Class::getType();
     const auto& propsMap = type->propertiesGetter()->getMap();
 
     OATPP_ASSERT(propsMap.size() == 2);
@@ -158,7 +158,7 @@ void ObjectTest::onRun() {
 
   {
     OATPP_LOGI(TAG, "Test 1...");
-    DtoA::Wrapper a;
+    Object<DtoA> a;
     OATPP_ASSERT(!a);
     OATPP_ASSERT(a == nullptr);
     OATPP_ASSERT(a.valueType->classId.id == oatpp::data::mapping::type::__class::AbstractObject::CLASS_ID.id);
@@ -167,8 +167,8 @@ void ObjectTest::onRun() {
 
   {
     OATPP_LOGI(TAG, "Test 2...");
-    DtoA::Wrapper a;
-    DtoA::Wrapper b;
+    Object<DtoA> a;
+    Object<DtoA> b;
     OATPP_ASSERT(a == b);
     OATPP_LOGI(TAG, "OK");
   }
@@ -176,11 +176,11 @@ void ObjectTest::onRun() {
   {
     OATPP_LOGI(TAG, "Test 3...");
     auto a = DtoA::createShared();
-    DtoA::Wrapper b;
+    Object<DtoA> b;
     OATPP_ASSERT(a != b);
     OATPP_ASSERT(b != a);
     auto ohc = a->hashCode();
-    auto whc = std::hash<DtoA::Wrapper>{}(a);
+    auto whc = std::hash<oatpp::Object<DtoA>>{}(a);
     OATPP_ASSERT(ohc == whc);
     OATPP_LOGI(TAG, "OK");
   }
@@ -285,7 +285,7 @@ void ObjectTest::onRun() {
     a->id = "1";
     e->id = "1";
 
-    oatpp::UnorderedSet<DtoB::Wrapper> set = {a, b, c, d, e};
+    oatpp::UnorderedSet<oatpp::Object<DtoB>> set = {a, b, c, d, e};
 
     OATPP_ASSERT(set->size() == 2);
     OATPP_ASSERT(set[a] == true);

+ 1 - 1
test/oatpp/core/data/mapping/type/TypeTest.cpp

@@ -56,7 +56,7 @@ namespace {
     
     DTO_FIELD(Fields<String>, field_map_string_string);
     
-    DTO_FIELD(TestDto::Wrapper, obj1);
+    DTO_FIELD(Object<TestDto>, obj1);
     
   };
   

+ 1 - 1
test/oatpp/parser/json/mapping/DTOMapperPerfTest.cpp

@@ -92,7 +92,7 @@ void DTOMapperPerfTest::onRun() {
     oatpp::parser::Caret caret(test1_Text);
     for(v_int32 i = 0; i < numIterations; i ++) {
       caret.setPosition(0);
-      mapper->readFromCaret<Test1::Wrapper>(caret);
+      mapper->readFromCaret<oatpp::Object<Test1>>(caret);
     }
   }
 

+ 8 - 8
test/oatpp/parser/json/mapping/DTOMapperTest.cpp

@@ -74,15 +74,15 @@ class Test : public oatpp::DTO {
   DTO_FIELD(List<Float64>, field_list_float64) = {};
   DTO_FIELD(List<Boolean>, field_list_boolean) = {};
   
-  DTO_FIELD(List<TestChild::Wrapper>, field_list_object) = {};
-  DTO_FIELD(List<List<TestChild::Wrapper>>, field_list_list_object) = {};
+  DTO_FIELD(List<Object<TestChild>>, field_list_object) = {};
+  DTO_FIELD(List<List<Object<TestChild>>>, field_list_list_object) = {};
 
   DTO_FIELD(Vector<String>, field_vector);
   DTO_FIELD(Fields<String>, field_fields);
   DTO_FIELD(UnorderedFields<String>, field_unordered_fields);
   
-  DTO_FIELD(Test::Wrapper, obj1);
-  DTO_FIELD(TestChild::Wrapper, child1);
+  DTO_FIELD(Object<Test>, obj1);
+  DTO_FIELD(Object<TestChild>, child1);
   
 };
 
@@ -159,9 +159,9 @@ void DTOMapperTest::onRun(){
   test1->field_list_object->push_back(TestChild::createShared("child", "2"));
   test1->field_list_object->push_back(TestChild::createShared("child", "3"));
   
-  auto l1 = oatpp::List<TestChild::Wrapper>::createShared();
-  auto l2 = oatpp::List<TestChild::Wrapper>::createShared();
-  auto l3 = oatpp::List<TestChild::Wrapper>::createShared();
+  auto l1 = oatpp::List<oatpp::Object<TestChild>>::createShared();
+  auto l2 = oatpp::List<oatpp::Object<TestChild>>::createShared();
+  auto l3 = oatpp::List<oatpp::Object<TestChild>>::createShared();
   
   l1->push_back(TestChild::createShared("list_1", "item_1"));
   l1->push_back(TestChild::createShared("list_1", "item_2"));
@@ -220,7 +220,7 @@ void DTOMapperTest::onRun(){
   OATPP_LOGV(TAG, "...");
 
   oatpp::parser::Caret caret(result);
-  auto obj = mapper->readFromCaret<Test::Wrapper>(caret);
+  auto obj = mapper->readFromCaret<oatpp::Object<Test>>(caret);
   
   OATPP_ASSERT(obj->field_string);
   OATPP_ASSERT(obj->field_string == test1->field_string);

+ 18 - 18
test/oatpp/parser/json/mapping/DeserializerTest.cpp

@@ -71,9 +71,9 @@ class Test4 : public oatpp::DTO {
 
   DTO_INIT(Test4, DTO)
 
-  DTO_FIELD(EmptyDto::Wrapper, object);
-  DTO_FIELD(List<EmptyDto::Wrapper>, list);
-  DTO_FIELD(Fields<EmptyDto::Wrapper>, map);
+  DTO_FIELD(Object<EmptyDto>, object);
+  DTO_FIELD(List<Object<EmptyDto>>, list);
+  DTO_FIELD(Fields<Object<EmptyDto>>, map);
 
 };
   
@@ -85,69 +85,69 @@ void DeserializerTest::onRun(){
   
   auto mapper = oatpp::parser::json::mapping::ObjectMapper::createShared();
   
-  auto obj1 = mapper->readFromString<Test1::Wrapper>("{}");
+  auto obj1 = mapper->readFromString<oatpp::Object<Test1>>("{}");
   
   OATPP_ASSERT(obj1);
   OATPP_ASSERT(!obj1->strF);
   
-  obj1 = mapper->readFromString<Test1::Wrapper>("{\"strF\":\"value1\"}");
+  obj1 = mapper->readFromString<oatpp::Object<Test1>>("{\"strF\":\"value1\"}");
   
   OATPP_ASSERT(obj1);
   OATPP_ASSERT(obj1->strF);
   OATPP_ASSERT(obj1->strF->equals("value1"));
   
-  obj1 = mapper->readFromString<Test1::Wrapper>("{\n\r\t\f\"strF\"\n\r\t\f:\n\r\t\f\"value1\"\n\r\t\f}");
+  obj1 = mapper->readFromString<oatpp::Object<Test1>>("{\n\r\t\f\"strF\"\n\r\t\f:\n\r\t\f\"value1\"\n\r\t\f}");
   
   OATPP_ASSERT(obj1);
   OATPP_ASSERT(obj1->strF);
   OATPP_ASSERT(obj1->strF->equals("value1"));
   
-  auto obj2 = mapper->readFromString<Test2::Wrapper>("{\"int32F\": null}");
+  auto obj2 = mapper->readFromString<oatpp::Object<Test2>>("{\"int32F\": null}");
   
   OATPP_ASSERT(obj2);
   OATPP_ASSERT(!obj2->int32F);
   
-  obj2 = mapper->readFromString<Test2::Wrapper>("{\"int32F\": 32}");
+  obj2 = mapper->readFromString<oatpp::Object<Test2>>("{\"int32F\": 32}");
   
   OATPP_ASSERT(obj2);
   OATPP_ASSERT(obj2->int32F == 32);
   
-  obj2 = mapper->readFromString<Test2::Wrapper>("{\"int32F\":    -32}");
+  obj2 = mapper->readFromString<oatpp::Object<Test2>>("{\"int32F\":    -32}");
   
   OATPP_ASSERT(obj2);
   OATPP_ASSERT(obj2->int32F == -32);
   
-  auto obj3 = mapper->readFromString<Test3::Wrapper>("{\"float32F\": null}");
+  auto obj3 = mapper->readFromString<oatpp::Object<Test3>>("{\"float32F\": null}");
   
   OATPP_ASSERT(obj3);
   OATPP_ASSERT(!obj3->float32F);
   
-  obj3 = mapper->readFromString<Test3::Wrapper>("{\"float32F\": 32}");
+  obj3 = mapper->readFromString<oatpp::Object<Test3>>("{\"float32F\": 32}");
   
   OATPP_ASSERT(obj3);
   OATPP_ASSERT(obj3->float32F == 32);
   
-  obj3 = mapper->readFromString<Test3::Wrapper>("{\"float32F\": 1.32e1}");
+  obj3 = mapper->readFromString<oatpp::Object<Test3>>("{\"float32F\": 1.32e1}");
   
   OATPP_ASSERT(obj3);
   OATPP_ASSERT(obj3->float32F);
   
-  obj3 = mapper->readFromString<Test3::Wrapper>("{\"float32F\": 1.32e+1 }");
+  obj3 = mapper->readFromString<oatpp::Object<Test3>>("{\"float32F\": 1.32e+1 }");
   
   OATPP_ASSERT(obj3);
   OATPP_ASSERT(obj3->float32F);
   
-  obj3 = mapper->readFromString<Test3::Wrapper>("{\"float32F\": 1.32e-1 }");
+  obj3 = mapper->readFromString<oatpp::Object<Test3>>("{\"float32F\": 1.32e-1 }");
   
   OATPP_ASSERT(obj3);
   OATPP_ASSERT(obj3->float32F);
   
-  obj3 = mapper->readFromString<Test3::Wrapper>("{\"float32F\": -1.32E-1 }");
+  obj3 = mapper->readFromString<oatpp::Object<Test3>>("{\"float32F\": -1.32E-1 }");
   
   OATPP_ASSERT(obj3);
   OATPP_ASSERT(obj3->float32F);
   
-  obj3 = mapper->readFromString<Test3::Wrapper>("{\"float32F\": -1.32E1 }");
+  obj3 = mapper->readFromString<oatpp::Object<Test3>>("{\"float32F\": -1.32E1 }");
   
   OATPP_ASSERT(obj3);
   OATPP_ASSERT(obj3->float32F);
@@ -161,14 +161,14 @@ void DeserializerTest::onRun(){
 
   // Empty test
 
-  auto obj4 = mapper->readFromString<Test4::Wrapper>("{\"object\": {}, \"list\": [], \"map\": {}}");
+  auto obj4 = mapper->readFromString<oatpp::Object<Test4>>("{\"object\": {}, \"list\": [], \"map\": {}}");
   OATPP_ASSERT(obj4);
   OATPP_ASSERT(obj4->object);
   OATPP_ASSERT(obj4->list);
   OATPP_ASSERT(obj4->list->size() == 0);
   OATPP_ASSERT(obj4->map->size() == 0);
 
-  obj4 = mapper->readFromString<Test4::Wrapper>("{\"object\": {\n\r\t}, \"list\": [\n\r\t], \"map\": {\n\r\t}}");
+  obj4 = mapper->readFromString<oatpp::Object<Test4>>("{\"object\": {\n\r\t}, \"list\": [\n\r\t], \"map\": {\n\r\t}}");
   OATPP_ASSERT(obj4);
   OATPP_ASSERT(obj4->object);
   OATPP_ASSERT(obj4->list);

+ 2 - 2
test/oatpp/web/FullAsyncClientTest.cpp

@@ -184,10 +184,10 @@ public:
 
   Action onResponse(const std::shared_ptr<IncomingResponse>& response) {
     OATPP_ASSERT(response->getStatusCode() == 200 && "ClientCoroutine_postBodyAsync");
-    return response->readBodyToDtoAsync<app::TestDto::Wrapper>(objectMapper).callbackTo(&ClientCoroutine_postBodyAsync::onBodyRead);
+    return response->readBodyToDtoAsync<oatpp::Object<app::TestDto>>(objectMapper).callbackTo(&ClientCoroutine_postBodyAsync::onBodyRead);
   }
 
-  Action onBodyRead(const app::TestDto::Wrapper& body) {
+  Action onBodyRead(const oatpp::Object<app::TestDto>& body) {
     OATPP_ASSERT(body);
     OATPP_ASSERT(body->testValue == "my_test_body");
     ++ SUCCESS_COUNTER;

+ 3 - 3
test/oatpp/web/FullAsyncTest.cpp

@@ -175,7 +175,7 @@ void FullAsyncTest::onRun() {
       { // test GET with path parameter
         auto response = client->getWithParams("my_test_param-Async", connection);
         OATPP_ASSERT(response->getStatusCode() == 200);
-        auto dto = response->readBodyToDto<app::TestDto::Wrapper>(objectMapper.get());
+        auto dto = response->readBodyToDto<oatpp::Object<app::TestDto>>(objectMapper.get());
         OATPP_ASSERT(dto);
         OATPP_ASSERT(dto->testValue == "my_test_param-Async");
       }
@@ -183,7 +183,7 @@ void FullAsyncTest::onRun() {
       { // test GET with header parameter
         auto response = client->getWithHeaders("my_test_header-Async", connection);
         OATPP_ASSERT(response->getStatusCode() == 200);
-        auto dto = response->readBodyToDto<app::TestDto::Wrapper>(objectMapper.get());
+        auto dto = response->readBodyToDto<oatpp::Object<app::TestDto>>(objectMapper.get());
         OATPP_ASSERT(dto);
         OATPP_ASSERT(dto->testValue == "my_test_header-Async");
       }
@@ -191,7 +191,7 @@ void FullAsyncTest::onRun() {
       { // test POST with body
         auto response = client->postBody("my_test_body-Async", connection);
         OATPP_ASSERT(response->getStatusCode() == 200);
-        auto dto = response->readBodyToDto<app::TestDto::Wrapper>(objectMapper.get());
+        auto dto = response->readBodyToDto<oatpp::Object<app::TestDto>>(objectMapper.get());
         OATPP_ASSERT(dto);
         OATPP_ASSERT(dto->testValue == "my_test_body-Async");
       }

+ 6 - 6
test/oatpp/web/FullTest.cpp

@@ -251,7 +251,7 @@ void FullTest::onRun() {
       { // test GET with path parameter
         auto response = client->getWithParams("my_test_param", connection);
         OATPP_ASSERT(response->getStatusCode() == 200);
-        auto dto = response->readBodyToDto<app::TestDto::Wrapper>(objectMapper.get());
+        auto dto = response->readBodyToDto<oatpp::Object<app::TestDto>>(objectMapper.get());
         OATPP_ASSERT(dto);
         OATPP_ASSERT(dto->testValue == "my_test_param");
       }
@@ -259,7 +259,7 @@ void FullTest::onRun() {
       { // test GET with query parameters
         auto response = client->getWithQueries("oatpp", 1, connection);
         OATPP_ASSERT(response->getStatusCode() == 200);
-        auto dto = response->readBodyToDto<app::TestDto::Wrapper>(objectMapper.get());
+        auto dto = response->readBodyToDto<oatpp::Object<app::TestDto>>(objectMapper.get());
         OATPP_ASSERT(dto);
         OATPP_ASSERT(dto->testValue == "name=oatpp&age=1");
       }
@@ -267,7 +267,7 @@ void FullTest::onRun() {
       { // test GET with query parameters
         auto response = client->getWithQueriesMap("value1", 32, 0.32f, connection);
         OATPP_ASSERT(response->getStatusCode() == 200);
-        auto dto = response->readBodyToDto<app::TestDto::Wrapper>(objectMapper.get());
+        auto dto = response->readBodyToDto<oatpp::Object<app::TestDto>>(objectMapper.get());
         OATPP_ASSERT(dto);
         OATPP_ASSERT(dto->testMap);
         OATPP_ASSERT(dto->testMap->size() == 3);
@@ -279,7 +279,7 @@ void FullTest::onRun() {
       { // test GET with header parameter
         auto response = client->getWithHeaders("my_test_header", connection);
         OATPP_ASSERT(response->getStatusCode() == 200);
-        auto dto = response->readBodyToDto<app::TestDto::Wrapper>(objectMapper.get());
+        auto dto = response->readBodyToDto<oatpp::Object<app::TestDto>>(objectMapper.get());
         OATPP_ASSERT(dto);
         OATPP_ASSERT(dto->testValue == "my_test_header");
       }
@@ -287,7 +287,7 @@ void FullTest::onRun() {
       { // test POST with body
         auto response = client->postBody("my_test_body", connection);
         OATPP_ASSERT(response->getStatusCode() == 200);
-        auto dto = response->readBodyToDto<app::TestDto::Wrapper>(objectMapper.get());
+        auto dto = response->readBodyToDto<oatpp::Object<app::TestDto>>(objectMapper.get());
         OATPP_ASSERT(dto);
         OATPP_ASSERT(dto->testValue == "my_test_body");
       }
@@ -297,7 +297,7 @@ void FullTest::onRun() {
         dtoIn->testValueInt = i;
         auto response = client->postBodyDto(dtoIn, connection);
         OATPP_ASSERT(response->getStatusCode() == 200);
-        auto dtoOut = response->readBodyToDto<app::TestDto::Wrapper>(objectMapper.get());
+        auto dtoOut = response->readBodyToDto<oatpp::Object<app::TestDto>>(objectMapper.get());
         OATPP_ASSERT(dtoOut);
         OATPP_ASSERT(dtoOut->testValueInt == i);
       }

+ 1 - 1
test/oatpp/web/app/Client.hpp

@@ -55,7 +55,7 @@ public:
   API_CALL("GET", "queries/map", getWithQueriesMap, QUERY(String, key1), QUERY(Int32, key2), QUERY(Float32, key3))
   API_CALL("GET", "headers", getWithHeaders, HEADER(String, param, "X-TEST-HEADER"))
   API_CALL("POST", "body", postBody, BODY_STRING(String, body))
-  API_CALL("POST", "body-dto", postBodyDto, BODY_DTO(TestDto::Wrapper, body))
+  API_CALL("POST", "body-dto", postBodyDto, BODY_DTO(Object<TestDto>, body))
 
   API_CALL("GET", "enum/as-string", getHeaderEnumAsString, HEADER(Enum<AllowedPathParams>::AsString, enumValue, "enum"))
   API_CALL("GET", "enum/as-number", getHeaderEnumAsNumber, HEADER(Enum<AllowedPathParams>::AsNumber, enumValue, "enum"))

+ 1 - 1
test/oatpp/web/app/Controller.hpp

@@ -140,7 +140,7 @@ public:
   }
 
   ENDPOINT("POST", "body-dto", postBodyDto,
-           BODY_DTO(TestDto::Wrapper, body)) {
+           BODY_DTO(Object<TestDto>, body)) {
     //OATPP_LOGV(TAG, "POST body %s", body->c_str());
     return createDtoResponse(Status::CODE_200, body);
   }