Merge pull request #249 from oatpp/better_api_docs

Better api docs
This commit is contained in:
Leonid Stryzhevskyi 2020-05-24 09:16:07 +03:00 committed by GitHub
commit a626de023d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 319 additions and 56 deletions

View File

@ -31,7 +31,15 @@
#define OATPP_MACRO_DTO_ENUM_PARAM_VALUE_STR(MACRO, NAME, PARAM_LIST) OATPP_MACRO_FIRSTARG_STR PARAM_LIST
#define OATPP_MACRO_DTO_ENUM_PARAM(MACRO, NAME, PARAM_LIST) (MACRO, NAME, PARAM_LIST)
#define VALUE(NAME, ...) OATPP_MACRO_DTO_ENUM_PARAM(OATPP_MACRO_DTO_ENUM_VALUE, NAME, (__VA_ARGS__))
/**
* Enum entry value.
* @param NAME - name of the enum. **required**.
* @param ORDINAL_VALUE - corresponding ordinal value. **required**.
* @param QUALIFIER - name qualifier to be used instead of the `NAME`. **optional**.
* @param DESCRIPTION - description of the enum value. **optional**.
*/
#define VALUE(NAME, ...) \
OATPP_MACRO_DTO_ENUM_PARAM(OATPP_MACRO_DTO_ENUM_VALUE, NAME, (__VA_ARGS__))
//////////////////////////////////////////////////////////////////////////
@ -150,11 +158,10 @@ OATPP_ENUM_0(NAME, ORDINAL_TYPE)
OATPP_ENUM_1(NAME, ORDINAL_TYPE, __VA_ARGS__)
/**
* Codegen macoro to be used in `oatpp::web::client::ApiClient` to generate REST API-Calls.
* @param METHOD - Http method ("GET", "POST", "PUT", etc.)
* @param PATH - Path to endpoint (without host)
* @param NAME - Name of the generated method
* @return - std::shared_ptr to &id:oatpp::web::protocol::http::incoming::Response;
* Codegen macoro to generate oatpp mapping-enabled enum.
* @param NAME - name of the enum. **required**.
* @param UNDERLYING_TYPE - underlying ordinal type. **required**.
* @param ... - enum values defined with &l:VALUE (...);. macro.
*/
#define ENUM(NAME, ...) \
OATPP_MACRO_EXPAND(OATPP_MACRO_MACRO_BINARY_SELECTOR(OATPP_ENUM_MACRO_, (__VA_ARGS__)) (NAME, __VA_ARGS__))

View File

@ -36,8 +36,15 @@ namespace oatpp { namespace data { namespace mapping { namespace type {
namespace __class {
/**
* Any class.
*/
class Any {
public:
/**
* Class Id.
*/
static const ClassId CLASS_ID;
static Type *getType() {
@ -62,30 +69,70 @@ public:
};
/**
* Any - ObjectWrapper to hold Any oatpp mapping-enabled type.
*/
class Any : public ObjectWrapper<AnyHandle, __class::Any>{
public:
/**
* Default constructor.
*/
Any();
/**
* Nullptr constructor.
*/
Any(std::nullptr_t);
/**
* Copy constructor.
* @param other - other Any.
*/
Any(const Any& other);
/**
* Move constructor.
* @param other
*/
Any(Any&& other);
Any(const std::shared_ptr<base::Countable>& ptr, const Type* const type);
/**
* Constructor.
* @tparam T - Underlying type of ObjectWrapper.
* @tparam C - __class of ObjectWrapper.
* @param polymorph - any ObjectWrapper.
*/
template<class T, class C>
Any(const ObjectWrapper<T, C>& polymorph)
: ObjectWrapper(std::make_shared<AnyHandle>(polymorph.getPtr(), polymorph.valueType), __class::Any::getType())
{}
/**
* Store any ObjectWrapper in Any.
* @tparam T
* @tparam C
* @param polymorph - ObjectWrapper. Ex.: `oatpp::String`, `oatpp::List<...>`, etc.
*/
template<class T, class C>
void store(const ObjectWrapper<T, C>& polymorph) {
m_ptr = std::make_shared<AnyHandle>(polymorph.getPtr(), polymorph.valueType);
}
/**
* Get `Type` of the stored object.
* @return - &id:oatpp::data::mapping::type::Type;.
*/
const Type* getStoredType() const;
/**
* Retrieve stored object.
* @tparam WrapperType - type of the object to retrieve.
* @return - ObjectWrapper of type - `WrapperType`.
* @throws - `std::runtime_error` - if stored type and type requested (`WrapperType`) do not match.
*/
template<class WrapperType>
WrapperType retrieve() const {

View File

@ -72,6 +72,9 @@ enum class EnumInterpreterError : v_int32 {
namespace __class {
/**
* Abstract Enum class.
*/
class AbstractEnum {
public:
static const ClassId CLASS_ID;
@ -100,11 +103,32 @@ namespace __class {
}
/**
* Enum value info.
* @tparam T - underlying enum type.
*/
template<typename T>
struct EnumValueInfo {
/**
* Entry value. T - enum type.
*/
const T value;
/**
* Index of the entry.
*/
const v_int32 index;
/**
* Name of the enum entry or name-qualifier, if qualifier was specified. <br>
* &id:oatpp::data::share::StringKeyLabel;.
*/
const data::share::StringKeyLabel name;
/**
* Description of the enum etry. <br>
* &id:oatpp::data::share::StringKeyLabel;.
*/
const data::share::StringKeyLabel description;
};
@ -138,6 +162,11 @@ protected:
}
};
/**
* Enum interpreter `AsString`
* @tparam T
* @tparam notnull
*/
template<class T, bool notnull>
class EnumInterpreterAsString {
public:
@ -153,15 +182,20 @@ public:
static Type* getInterpretationType();
};
/**
* Enum interpreter `AsNumber`
* @tparam T
* @tparam notnull
*/
template<class T, bool notnull>
class EnumInterpreterAsInteger {
class EnumInterpreterAsNumber {
private:
typedef typename std::underlying_type<T>::type EnumUnderlyingType;
public:
typedef typename ObjectWrapperByUnderlyingType<EnumUnderlyingType>::ObjectWrapper UnderlyingTypeObjectWrapper;
public:
template <bool N>
using InterpreterType = EnumInterpreterAsInteger<T, N>;
using InterpreterType = EnumInterpreterAsNumber<T, N>;
public:
constexpr static bool notNull = notnull;
public:
@ -170,6 +204,11 @@ public:
static Type* getInterpretationType();
};
/**
* Template class for `oatpp::Enum<T>`.
* @tparam T - enum type.
* @tparam EnumInterpreter - enum interpreter.
*/
template<class T, class EnumInterpreter>
class EnumObjectWrapper : public ObjectWrapper<T, __class::Enum<T, EnumInterpreter>>{
template<class Type, class Interpreter>
@ -178,10 +217,25 @@ public:
typedef typename std::underlying_type<T>::type UnderlyingEnumType;
typedef T Z__EnumType;
typedef __class::Enum<T, EnumInterpreter> EnumObjectClass;
/**
* Template parameter - `Interpreter`.
*/
typedef EnumInterpreter Interpreter;
public:
/**
* Enum interpreted `AsString`.
*/
typedef EnumObjectWrapper<T, EnumInterpreterAsString<T, EnumInterpreter::notNull>> AsString;
typedef EnumObjectWrapper<T, EnumInterpreterAsInteger<T, EnumInterpreter::notNull>> AsNumber;
/**
* Enum interpreted `AsNumber`.
*/
typedef EnumObjectWrapper<T, EnumInterpreterAsNumber<T, EnumInterpreter::notNull>> AsNumber;
/**
* Enum with `NotNull` interpretation constraint.
*/
typedef EnumObjectWrapper<T, typename EnumInterpreter::template InterpreterType<true>> NotNull;
public:
@ -189,23 +243,47 @@ public:
: type::ObjectWrapper<T, EnumObjectClass>(ptr, valueType)
{}
/**
* Default constructor.
*/
EnumObjectWrapper() {}
/**
* Nullptr constructor.
*/
EnumObjectWrapper(std::nullptr_t) {}
/**
* Constructor.
* @param ptr
*/
EnumObjectWrapper(const std::shared_ptr<T>& ptr)
: type::ObjectWrapper<T, EnumObjectClass>(ptr)
{}
/**
* Constructor.
* @param ptr
*/
EnumObjectWrapper(std::shared_ptr<T>&& ptr)
: type::ObjectWrapper<T, EnumObjectClass>(std::forward<std::shared_ptr<T>>(ptr))
{}
/**
* Copy-constructor.
* @tparam OtherInter
* @param other
*/
template<class OtherInter>
EnumObjectWrapper(const EnumObjectWrapper<T, OtherInter>& other)
: type::ObjectWrapper<T, EnumObjectClass>(other.getPtr())
{}
/**
* Move-constructor.
* @tparam OtherInter
* @param other
*/
template<class OtherInter>
EnumObjectWrapper(EnumObjectWrapper<T, OtherInter>&& other)
: type::ObjectWrapper<T, EnumObjectClass>(std::move(other.getPtr()))
@ -230,6 +308,10 @@ public:
public:
/**
* Constructor by value.
* @param value
*/
EnumObjectWrapper(T value)
: type::ObjectWrapper<T, EnumObjectClass>(std::make_shared<T>(value))
{}
@ -298,6 +380,12 @@ public:
public:
/**
* Get &l:EnumValueInfo <T>; by name.
* @param name - name or name-qualifier of the enum entry.
* @return - &l:EnumValueInfo <T>;.
* @throws - `std::runtime_error` if not found.
*/
static const EnumValueInfo<T>& getEntryByName(const String& name) {
auto it = EnumMeta<T>::getInfo()->byName.find(name);
if(it != EnumMeta<T>::getInfo()->byName.end()) {
@ -306,6 +394,12 @@ public:
throw std::runtime_error("[oatpp::data::mapping::type::Enum::getEntryByName()]: Error. Entry not found.");
}
/**
* Get &l:EnumValueInfo <T>; by enum value.
* @param value - enum value.
* @return - &l:EnumValueInfo <T>;.
* @throws - `std::runtime_error` if not found.
*/
static const EnumValueInfo<T>& getEntryByValue(T value) {
auto it = EnumMeta<T>::getInfo()->byValue.find(static_cast<v_uint64>(value));
if(it != EnumMeta<T>::getInfo()->byValue.end()) {
@ -314,6 +408,12 @@ public:
throw std::runtime_error("[oatpp::data::mapping::type::Enum::getEntryByValue()]: Error. Entry not found.");
}
/**
* Get &l:EnumValueInfo <T>; by integer value.
* @param value - integer value.
* @return - &l:EnumValueInfo <T>;.
* @throws - `std::runtime_error` if not found.
*/
static const EnumValueInfo<T>& getEntryByUnderlyingValue(UnderlyingEnumType value) {
auto it = EnumMeta<T>::getInfo()->byValue.find(static_cast<v_uint64>(value));
if(it != EnumMeta<T>::getInfo()->byValue.end()) {
@ -322,6 +422,12 @@ public:
throw std::runtime_error("[oatpp::data::mapping::type::Enum::getEntryByUnderlyingValue()]: Error. Entry not found.");
}
/**
* Get &l:EnumValueInfo <T>; by index.
* @param index - index of the entry in the enum.
* @return - &l:EnumValueInfo <T>;.
* @throws - `std::runtime_error` if not found.
*/
static const EnumValueInfo<T>& getEntryByIndex(v_int32 index) {
if(index >= 0 && index < EnumMeta<T>::getInfo()->byIndex.size()) {
return EnumMeta<T>::getInfo()->byIndex[index];
@ -329,6 +435,10 @@ public:
throw std::runtime_error("[oatpp::data::mapping::type::Enum::getEntryByIndex()]: Error. Entry not found.");
}
/**
* Get `std::vector` of &l:EnumValueInfo <T>;.
* @return - `std::vector` of &l:EnumValueInfo <T>;.
*/
static const std::vector<EnumValueInfo<T>>& getEntries() {
return EnumMeta<T>::getInfo()->byIndex;
}
@ -392,9 +502,9 @@ Type* EnumInterpreterAsString<T, notnull>::getInterpretationType() {
}
template<class T, bool notnull>
Void EnumInterpreterAsInteger<T, notnull>::toInterpretation(const Void& enumValue, EnumInterpreterError& error) {
Void EnumInterpreterAsNumber<T, notnull>::toInterpretation(const Void& enumValue, EnumInterpreterError& error) {
typedef EnumObjectWrapper<T, EnumInterpreterAsInteger<T, notnull>> EnumOW;
typedef EnumObjectWrapper<T, EnumInterpreterAsNumber<T, notnull>> EnumOW;
typedef typename std::underlying_type<T>::type EnumUT;
typedef typename ObjectWrapperByUnderlyingType<EnumUT>::ObjectWrapper UTOW;
@ -417,8 +527,8 @@ Void EnumInterpreterAsInteger<T, notnull>::toInterpretation(const Void& enumValu
}
template<class T, bool notnull>
Void EnumInterpreterAsInteger<T, notnull>::fromInterpretation(const Void& interValue, EnumInterpreterError& error) {
typedef EnumObjectWrapper<T, EnumInterpreterAsInteger<T, notnull>> EnumOW;
Void EnumInterpreterAsNumber<T, notnull>::fromInterpretation(const Void& interValue, EnumInterpreterError& error) {
typedef EnumObjectWrapper<T, EnumInterpreterAsNumber<T, notnull>> EnumOW;
typedef typename std::underlying_type<T>::type EnumUT;
typedef typename ObjectWrapperByUnderlyingType<EnumUT>::ObjectWrapper OW;
@ -448,7 +558,7 @@ Void EnumInterpreterAsInteger<T, notnull>::fromInterpretation(const Void& interV
}
template<class T, bool notnull>
Type* EnumInterpreterAsInteger<T, notnull>::getInterpretationType() {
Type* EnumInterpreterAsNumber<T, notnull>::getInterpretationType() {
typedef typename std::underlying_type<T>::type EnumUT;
return ObjectWrapperByUnderlyingType<EnumUT>::ObjectWrapper::Class::getType();
}

View File

@ -34,13 +34,27 @@ namespace oatpp { namespace data { namespace mapping { namespace type {
namespace __class {
/**
* Abstract list class.
*/
class AbstractList {
public:
/**
* Class Id.
*/
static const ClassId CLASS_ID;
public:
/**
* Polymorphic Dispatcher
*/
class AbstractPolymorphicDispatcher {
public:
/**
* Add item.
* @param object - List to add item to.
* @param item - Item to add.
*/
virtual void addPolymorphicItem(const type::Void& object, const type::Void& item) const = 0;
};
@ -51,6 +65,11 @@ namespace __class {
}
/**
* `ObjectWrapper` over `std::list<T>`
* @tparam T - Item `ObjectWrapper` type.
* @tparam C - Class.
*/
template<class T, class C>
class ListObjectWrapper : public type::ObjectWrapper<std::list<T>, C> {
public:

View File

@ -102,7 +102,7 @@ public:
typedef __class::Object<ObjT> TemplateObjectClass;
public:
OATPP_DEFINE_OBJECT_WRAPPER_DEFAULTS(DTOWrapper, TemplateObjectType, TemplateObjectClass)
OATPP_DEFINE_OBJECT_WRAPPER_DEFAULTS(DTOWrapper, TemplateObjectType, TemplateObjectClass)
static DTOWrapper createShared() {
return std::make_shared<TemplateObjectType>();

View File

@ -35,23 +35,44 @@ namespace oatpp { namespace data { namespace mapping { namespace type {
namespace __class {
class AbstractPairList {
public:
static const ClassId CLASS_ID;
public:
class AbstractPolymorphicDispatcher {
/**
* Abstract PairList class.
*/
class AbstractPairList {
public:
virtual void addPolymorphicItem(const type::Void& object, const type::Void& key, const type::Void& value) const = 0;
/**
* Class id.
*/
static const ClassId CLASS_ID;
public:
/**
* Polymorphic Dispatcher.
*/
class AbstractPolymorphicDispatcher {
public:
/**
* Add key-value pair to pair-list.
* @param object - pair list.
* @param key - key.
* @param value - value.
*/
virtual void addPolymorphicItem(const type::Void& object, const type::Void& key, const type::Void& value) const = 0;
};
};
};
template<class Key, class Value>
class PairList;
template<class Key, class Value>
class PairList;
}
/**
* `ObjectWrapper` over `std::list<std::pair<Key, Value>>`
* @tparam Key - Key `ObjectWrapper` type.
* @tparam Value - Value `ObjectWrapper` type.
* @tparam C - Class.
*/
template<class Key, class Value, class C>
class PairListObjectWrapper : public type::ObjectWrapper<std::list<std::pair<Key, Value>>, C> {
public:
@ -59,7 +80,7 @@ public:
typedef C TemplateObjectClass;
public:
OATPP_DEFINE_OBJECT_WRAPPER_DEFAULTS(PairListObjectWrapper, TemplateObjectType, TemplateObjectClass)
OATPP_DEFINE_OBJECT_WRAPPER_DEFAULTS(PairListObjectWrapper, TemplateObjectType, TemplateObjectClass)
PairListObjectWrapper(std::initializer_list<std::pair<Key, Value>> ilist)
: type::ObjectWrapper<TemplateObjectType, TemplateObjectClass>(std::make_shared<TemplateObjectType>(ilist))

View File

@ -35,13 +35,28 @@ namespace oatpp { namespace data { namespace mapping { namespace type {
namespace __class {
/**
* Abstract Unordered Map class.
*/
class AbstractUnorderedMap {
public:
/**
* Class Id.
*/
static const ClassId CLASS_ID;
public:
/**
* Polymorphic Dispatcher.
*/
class AbstractPolymorphicDispatcher {
public:
/**
* Add item.
* @param object - Unordered Map.
* @param key - Key.
* @param value - Value.
*/
virtual void addPolymorphicItem(const type::Void& object, const type::Void& key, const type::Void& value) const = 0;
};
@ -52,6 +67,12 @@ namespace __class {
}
/**
* `ObjectWrapper` for `std::unordered_map<Key, Value>`
* @tparam Key - Key `ObjectWrapper` type.
* @tparam Value - Value `ObjectWrapper` type.
* @tparam C - Class.
*/
template<class Key, class Value, class C>
class UnorderedMapObjectWrapper : public type::ObjectWrapper<std::unordered_map<Key, Value>, C> {
public:
@ -59,7 +80,7 @@ public:
typedef C TemplateObjectClass;
public:
OATPP_DEFINE_OBJECT_WRAPPER_DEFAULTS(UnorderedMapObjectWrapper, TemplateObjectType, TemplateObjectClass)
OATPP_DEFINE_OBJECT_WRAPPER_DEFAULTS(UnorderedMapObjectWrapper, TemplateObjectType, TemplateObjectClass)
UnorderedMapObjectWrapper(std::initializer_list<std::pair<const Key, Value>> ilist)
: type::ObjectWrapper<TemplateObjectType, TemplateObjectClass>(std::make_shared<TemplateObjectType>(ilist))

View File

@ -34,23 +34,42 @@ namespace oatpp { namespace data { namespace mapping { namespace type {
namespace __class {
class AbstractUnorderedSet {
public:
static const ClassId CLASS_ID;
public:
class AbstractPolymorphicDispatcher {
/**
* Abstract Unordered Set class.
*/
class AbstractUnorderedSet {
public:
virtual void addPolymorphicItem(const type::Void& object, const type::Void& item) const = 0;
/**
* Class Id.
*/
static const ClassId CLASS_ID;
public:
/**
* Polymorphic Dispatcher.
*/
class AbstractPolymorphicDispatcher {
public:
/**
* Add Item.
* @param object - UnorderedSet.
* @param item - Item.
*/
virtual void addPolymorphicItem(const type::Void& object, const type::Void& item) const = 0;
};
};
};
template<class T>
class UnorderedSet;
template<class T>
class UnorderedSet;
}
/**
* `ObjectWrapper` over `std::unordered_set<T>`
* @tparam T - Key `ObjectWrapper` type.
* @tparam C - Class.
*/
template<class T, class C>
class UnorderedSetObjectWrapper : public type::ObjectWrapper<std::unordered_set<T>, C> {
public:
@ -58,7 +77,7 @@ public:
typedef C TemplateObjectClass;
public:
OATPP_DEFINE_OBJECT_WRAPPER_DEFAULTS(UnorderedSetObjectWrapper, TemplateObjectType, TemplateObjectClass)
OATPP_DEFINE_OBJECT_WRAPPER_DEFAULTS(UnorderedSetObjectWrapper, TemplateObjectType, TemplateObjectClass)
UnorderedSetObjectWrapper(std::initializer_list<T> ilist)
: type::ObjectWrapper<TemplateObjectType, TemplateObjectClass>(std::make_shared<TemplateObjectType>(ilist))

View File

@ -34,13 +34,27 @@ namespace oatpp { namespace data { namespace mapping { namespace type {
namespace __class {
/**
* Abstract Vector Class.
*/
class AbstractVector {
public:
/**
* Class Id.
*/
static const ClassId CLASS_ID;
public:
/**
* Polymorphic Dispatcher.
*/
class AbstractPolymorphicDispatcher {
public:
/**
* Add Item.
* @param object - Vector.
* @param item - Item to add.
*/
virtual void addPolymorphicItem(const type::Void& object, const type::Void& item) const = 0;
};
@ -51,6 +65,11 @@ namespace __class {
}
/**
* `ObjectWrapper` over `std::vector<T>`.
* @tparam T - Item `ObjectWrapper` type.
* @tparam C - Class.
*/
template<class T, class C>
class VectorObjectWrapper : public type::ObjectWrapper<std::vector<T>, C> {
public:

View File

@ -161,7 +161,7 @@ oatpp::Void Deserializer::deserializeFloat32(Deserializer* deserializer, parser:
(void) type;
if(caret.isAtText("null", true)){
return oatpp::Void(Float32::ObjectWrapper::Class::getType());
return oatpp::Void(Float32::Class::getType());
} else {
return Float32(caret.parseFloat32());
}
@ -173,7 +173,7 @@ oatpp::Void Deserializer::deserializeFloat64(Deserializer* deserializer, parser:
(void) type;
if(caret.isAtText("null", true)){
return oatpp::Void(Float64::ObjectWrapper::Class::getType());
return oatpp::Void(Float64::Class::getType());
} else {
return Float64(caret.parseFloat64());
}
@ -186,7 +186,7 @@ oatpp::Void Deserializer::deserializeBoolean(Deserializer* deserializer, parser:
(void) type;
if(caret.isAtText("null", true)){
return oatpp::Void(Boolean::ObjectWrapper::Class::getType());
return oatpp::Void(Boolean::Class::getType());
} else {
if(caret.isAtText("true", true)) {
return Boolean(true);
@ -194,7 +194,7 @@ oatpp::Void Deserializer::deserializeBoolean(Deserializer* deserializer, parser:
return Boolean(false);
} else {
caret.setError("[oatpp::parser::json::mapping::Deserializer::readBooleanValue()]: Error. 'true' or 'false' - expected.", ERROR_CODE_VALUE_BOOLEAN);
return oatpp::Void(Boolean::ObjectWrapper::Class::getType());
return oatpp::Void(Boolean::Class::getType());
}
}
@ -224,9 +224,9 @@ const data::mapping::type::Type* Deserializer::guessType(oatpp::parser::Caret& c
case '"':
return String::Class::getType();
case '{':
return oatpp::Fields<Any>::ObjectWrapper::Class::getType();
return oatpp::Fields<Any>::Class::getType();
case '[':
return oatpp::List<Any>::ObjectWrapper::Class::getType();
return oatpp::List<Any>::Class::getType();
case 't':
if(caret.isAtText("true")) return Boolean::Class::getType();
break;

View File

@ -118,17 +118,17 @@ public:
/**
* Read body stream, decode, and deserialize it as DTO Object (see [Data Transfer Object (DTO)](https://oatpp.io/docs/components/dto/)).
* @tparam Type - DTO object type.
* @tparam Wrapper - ObjectWrapper type.
* @param headers - Headers map. &id:oatpp::web::protocol::http::Headers;.
* @param bodyStream - pointer to &id:oatpp::data::stream::InputStream;.
* @param objectMapper - pointer to &id:oatpp::data::mapping::ObjectMapper;.
* @return - deserialized DTO object.
*/
template<class Type>
typename Type::ObjectWrapper decodeToDto(const Headers& headers,
data::stream::InputStream* bodyStream,
data::mapping::ObjectMapper* objectMapper) const {
return objectMapper->readFromString<Type>(decodeToString(headers, bodyStream));
template<class Wrapper>
Wrapper decodeToDto(const Headers& headers,
data::stream::InputStream* bodyStream,
data::mapping::ObjectMapper* objectMapper) const {
return objectMapper->readFromString<Wrapper>(decodeToString(headers, bodyStream));
}
/**

View File

@ -142,13 +142,13 @@ public:
/**
* Read body stream, decode, and deserialize it as DTO Object (see [Data Transfer Object (DTO)](https://oatpp.io/docs/components/dto/)).
* @tparam Type - DTO object type.
* @tparam Wrapper - ObjectWrapper type.
* @param objectMapper - `std::shared_ptr` to &id:oatpp::data::mapping::ObjectMapper;.
* @return - deserialized DTO object.
*/
template<class Type>
typename Type::ObjectWrapper readBodyToDto(oatpp::data::mapping::ObjectMapper* objectMapper) const {
return m_bodyDecoder->decodeToDto<Type>(m_headers, m_bodyStream.get(), objectMapper);
template<class Wrapper>
Wrapper readBodyToDto(oatpp::data::mapping::ObjectMapper* objectMapper) const {
return m_bodyDecoder->decodeToDto<Wrapper>(m_headers, m_bodyStream.get(), objectMapper);
}
// Async