From 06232810f7c23cc8a91864a504df412255a370b6 Mon Sep 17 00:00:00 2001 From: Leonid Stryzhevskyi Date: Tue, 23 Apr 2024 01:20:20 +0300 Subject: [PATCH] refactor json namespaces --- CMakeLists.txt | 2 +- changelog/1.4.0.md | 9 +++ .../json/mapping => json}/ObjectMapper.cpp | 8 +- src/CMakeLists.txt | 20 ++--- src/oatpp/core/base/Environment.hpp | 2 +- src/oatpp/{parser => }/json/Beautifier.cpp | 4 +- src/oatpp/{parser => }/json/Beautifier.hpp | 10 +-- .../json/mapping => json}/Deserializer.cpp | 42 +++++----- .../json/mapping => json}/Deserializer.hpp | 12 +-- .../json/mapping => json}/ObjectMapper.cpp | 13 ++-- .../json/mapping => json}/ObjectMapper.hpp | 18 ++--- .../json/mapping => json}/Serializer.cpp | 16 ++-- .../json/mapping => json}/Serializer.hpp | 14 ++-- src/oatpp/{parser => }/json/Utils.cpp | 12 +-- src/oatpp/{parser => }/json/Utils.hpp | 12 +-- test/CMakeLists.txt | 24 +++--- test/oatpp/AllTestsMain.cpp | 24 +++--- test/oatpp/core/data/mapping/type/AnyTest.cpp | 2 +- .../data/mapping/type/InterpretationTest.cpp | 4 +- .../core/data/mapping/type/ObjectTest.cpp | 8 +- .../oatpp/core/data/mapping/type/TypeTest.cpp | 1 - .../BooleanTest.hpp => json/BooleanTest.cpp} | 59 ++++++++------ test/oatpp/json/BooleanTest.hpp | 40 ++++++++++ .../mapping => json}/DTOMapperPerfTest.cpp | 22 +++--- .../mapping => json}/DTOMapperPerfTest.hpp | 14 ++-- .../json/mapping => json}/DTOMapperTest.cpp | 8 +- .../json/mapping => json}/DTOMapperTest.hpp | 14 ++-- .../mapping => json}/DeserializerTest.cpp | 12 +-- .../mapping => json}/DeserializerTest.hpp | 14 ++-- .../json/mapping => json}/EnumTest.cpp | 8 +- .../json/mapping => json}/EnumTest.hpp | 14 ++-- .../mapping => json}/UnorderedSetTest.cpp | 8 +- .../mapping => json}/UnorderedSetTest.hpp | 14 ++-- .../oatpp/parser/json/mapping/BooleanTest.cpp | 78 ------------------- test/oatpp/web/ClientRetryTest.cpp | 6 +- test/oatpp/web/FullAsyncClientTest.cpp | 4 +- test/oatpp/web/FullAsyncTest.cpp | 4 +- test/oatpp/web/FullTest.cpp | 4 +- test/oatpp/web/PipelineAsyncTest.cpp | 4 +- test/oatpp/web/PipelineTest.cpp | 4 +- .../web/app/BasicAuthorizationController.hpp | 2 +- .../web/app/BearerAuthorizationController.hpp | 2 +- test/oatpp/web/app/Controller.hpp | 2 +- test/oatpp/web/app/ControllerAsync.hpp | 2 +- .../web/app/ControllerWithErrorHandler.hpp | 2 +- .../web/app/ControllerWithInterceptors.hpp | 2 +- .../app/ControllerWithInterceptorsAsync.hpp | 2 +- 47 files changed, 291 insertions(+), 311 deletions(-) rename fuzzers/oatpp/{parser/json/mapping => json}/ObjectMapper.cpp (68%) rename src/oatpp/{parser => }/json/Beautifier.cpp (98%) rename src/oatpp/{parser => }/json/Beautifier.hpp (93%) rename src/oatpp/{parser/json/mapping => json}/Deserializer.cpp (85%) rename src/oatpp/{parser/json/mapping => json}/Deserializer.hpp (95%) rename src/oatpp/{parser/json/mapping => json}/ObjectMapper.cpp (87%) rename src/oatpp/{parser/json/mapping => json}/ObjectMapper.hpp (86%) rename src/oatpp/{parser/json/mapping => json}/Serializer.cpp (94%) rename src/oatpp/{parser/json/mapping => json}/Serializer.hpp (95%) rename src/oatpp/{parser => }/json/Utils.cpp (96%) rename src/oatpp/{parser => }/json/Utils.hpp (94%) rename test/oatpp/{parser/json/mapping/BooleanTest.hpp => json/BooleanTest.cpp} (52%) create mode 100644 test/oatpp/json/BooleanTest.hpp rename test/oatpp/{parser/json/mapping => json}/DTOMapperPerfTest.cpp (78%) rename test/oatpp/{parser/json/mapping => json}/DTOMapperPerfTest.hpp (72%) rename test/oatpp/{parser/json/mapping => json}/DTOMapperTest.cpp (98%) rename test/oatpp/{parser/json/mapping => json}/DTOMapperTest.hpp (73%) rename test/oatpp/{parser/json/mapping => json}/DeserializerTest.cpp (96%) rename test/oatpp/{parser/json/mapping => json}/DeserializerTest.hpp (72%) rename test/oatpp/{parser/json/mapping => json}/EnumTest.cpp (96%) rename test/oatpp/{parser/json/mapping => json}/EnumTest.hpp (75%) rename test/oatpp/{parser/json/mapping => json}/UnorderedSetTest.cpp (88%) rename test/oatpp/{parser/json/mapping => json}/UnorderedSetTest.hpp (72%) delete mode 100644 test/oatpp/parser/json/mapping/BooleanTest.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt index 9d41c8b2..14ab71ac 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.1 FATAL_ERROR) +cmake_minimum_required(VERSION 3.25 FATAL_ERROR) file(STRINGS "${CMAKE_CURRENT_LIST_DIR}/src/oatpp/core/base/Environment.hpp" OATPP_VERSION_MACRO REGEX "#define OATPP_VERSION \"[0-9]+.[0-9]+.[0-9]+\"$") string(REGEX REPLACE "#define OATPP_VERSION \"([0-9]+.[0-9]+.[0-9]+)\"$" "\\1" oatpp_VERSION "${OATPP_VERSION_MACRO}") diff --git a/changelog/1.4.0.md b/changelog/1.4.0.md index 9002c918..063b20cc 100644 --- a/changelog/1.4.0.md +++ b/changelog/1.4.0.md @@ -8,6 +8,7 @@ Contents: - [URL Encoder And Decoder](#url-encoder-and-decoder) - [Introduce async::ConditionVariable](#async-condition-variable) +- [Restructuring](#restructuring) ## URL Encoder And Decoder @@ -47,3 +48,11 @@ OATPP_ASSERT(decoded == data) } ... ``` + +## Restructuring + +| old namespace | new namespace | +|-----------------------------------|-----------------| +| `oatpp::parser::json::*` | `oatpp::json::*`| +| `oatpp::parser::json::mapping::*` | `oatpp::json::*`| + diff --git a/fuzzers/oatpp/parser/json/mapping/ObjectMapper.cpp b/fuzzers/oatpp/json/ObjectMapper.cpp similarity index 68% rename from fuzzers/oatpp/parser/json/mapping/ObjectMapper.cpp rename to fuzzers/oatpp/json/ObjectMapper.cpp index 5b3781e3..21789f32 100644 --- a/fuzzers/oatpp/parser/json/mapping/ObjectMapper.cpp +++ b/fuzzers/oatpp/json/ObjectMapper.cpp @@ -1,9 +1,9 @@ -#include "oatpp/parser/json/mapping/ObjectMapper.hpp" +#include "oatpp/json/ObjectMapper.hpp" #include "oatpp/core/macro/codegen.hpp" typedef oatpp::parser::Caret ParsingCaret; -typedef oatpp::parser::json::mapping::Serializer Serializer; -typedef oatpp::parser::json::mapping::Deserializer Deserializer; +typedef oatpp::json::Serializer Serializer; +typedef oatpp::json::Deserializer Deserializer; #include OATPP_CODEGEN_BEGIN(DTO) @@ -18,7 +18,7 @@ class Test1 : public oatpp::DTO { extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { oatpp::String input(reinterpret_cast(data), size); - oatpp::parser::json::mapping::ObjectMapper mapper; + oatpp::json::ObjectMapper mapper; try { mapper.readFromString>(input); } catch(...) {} diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index dc352f09..3ba3d006 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -148,6 +148,16 @@ add_library(oatpp oatpp/encoding/Unicode.hpp oatpp/encoding/Url.cpp oatpp/encoding/Url.hpp + oatpp/json/Beautifier.cpp + oatpp/json/Beautifier.hpp + oatpp/json/Deserializer.cpp + oatpp/json/Deserializer.hpp + oatpp/json/ObjectMapper.cpp + oatpp/json/ObjectMapper.hpp + oatpp/json/Serializer.cpp + oatpp/json/Serializer.hpp + oatpp/json/Utils.cpp + oatpp/json/Utils.hpp oatpp/network/Address.cpp oatpp/network/Address.hpp oatpp/network/ConnectionHandler.hpp @@ -197,16 +207,6 @@ add_library(oatpp oatpp/orm/SchemaMigration.hpp oatpp/orm/Transaction.cpp oatpp/orm/Transaction.hpp - oatpp/parser/json/Beautifier.cpp - oatpp/parser/json/Beautifier.hpp - oatpp/parser/json/Utils.cpp - oatpp/parser/json/Utils.hpp - oatpp/parser/json/mapping/Deserializer.cpp - oatpp/parser/json/mapping/Deserializer.hpp - oatpp/parser/json/mapping/ObjectMapper.cpp - oatpp/parser/json/mapping/ObjectMapper.hpp - oatpp/parser/json/mapping/Serializer.cpp - oatpp/parser/json/mapping/Serializer.hpp oatpp/web/client/ApiClient.cpp oatpp/web/client/ApiClient.hpp oatpp/web/client/HttpRequestExecutor.cpp diff --git a/src/oatpp/core/base/Environment.hpp b/src/oatpp/core/base/Environment.hpp index 05d5c949..d6cf5f59 100644 --- a/src/oatpp/core/base/Environment.hpp +++ b/src/oatpp/core/base/Environment.hpp @@ -39,7 +39,7 @@ #include #include -#define OATPP_VERSION "1.3.0" +#define OATPP_VERSION "1.4.0" typedef unsigned char v_char8; typedef v_char8 *p_char8; diff --git a/src/oatpp/parser/json/Beautifier.cpp b/src/oatpp/json/Beautifier.cpp similarity index 98% rename from src/oatpp/parser/json/Beautifier.cpp rename to src/oatpp/json/Beautifier.cpp index b6808ede..840e4691 100644 --- a/src/oatpp/parser/json/Beautifier.cpp +++ b/src/oatpp/json/Beautifier.cpp @@ -26,7 +26,7 @@ #include "oatpp/core/data/stream/BufferStream.hpp" -namespace oatpp { namespace parser { namespace json { +namespace oatpp { namespace json { Beautifier::Beautifier(ConsistentOutputStream* outputStream, const oatpp::String& indent, const oatpp::String& newLine) : m_outputStream(outputStream) @@ -163,4 +163,4 @@ Beautifier::Context& Beautifier::getOutputStreamContext() { return m_outputStream->getOutputStreamContext(); } -}}} +}} diff --git a/src/oatpp/parser/json/Beautifier.hpp b/src/oatpp/json/Beautifier.hpp similarity index 93% rename from src/oatpp/parser/json/Beautifier.hpp rename to src/oatpp/json/Beautifier.hpp index 25861ed3..cbcea4ff 100644 --- a/src/oatpp/parser/json/Beautifier.hpp +++ b/src/oatpp/json/Beautifier.hpp @@ -22,12 +22,12 @@ * ***************************************************************************/ -#ifndef oatpp_parser_json_Beautifier_hpp -#define oatpp_parser_json_Beautifier_hpp +#ifndef oatpp_json_Beautifier_hpp +#define oatpp_json_Beautifier_hpp #include "oatpp/core/data/stream/Stream.hpp" -namespace oatpp { namespace parser { namespace json { +namespace oatpp { namespace json { /** * JSON output stream beautifier. @@ -87,6 +87,6 @@ public: }; -}}} +}} -#endif // oatpp_parser_json_Beautifier_hpp +#endif // oatpp_json_Beautifier_hpp diff --git a/src/oatpp/parser/json/mapping/Deserializer.cpp b/src/oatpp/json/Deserializer.cpp similarity index 85% rename from src/oatpp/parser/json/mapping/Deserializer.cpp rename to src/oatpp/json/Deserializer.cpp index 073d7b12..c62e2eeb 100644 --- a/src/oatpp/parser/json/mapping/Deserializer.cpp +++ b/src/oatpp/json/Deserializer.cpp @@ -26,7 +26,7 @@ #include "oatpp/core/utils/ConversionUtils.hpp" -namespace oatpp { namespace parser { namespace json { namespace mapping { +namespace oatpp { namespace json { Deserializer::Deserializer(const std::shared_ptr& config) : m_config(config) @@ -192,7 +192,7 @@ oatpp::Void Deserializer::deserializeBoolean(Deserializer* deserializer, parser: } else if(caret.isAtText("false", true)) { return Boolean(false); } else { - caret.setError("[oatpp::parser::json::mapping::Deserializer::readBooleanValue()]: Error. 'true' or 'false' - expected.", ERROR_CODE_VALUE_BOOLEAN); + caret.setError("[oatpp::json::Deserializer::readBooleanValue()]: Error. 'true' or 'false' - expected.", ERROR_CODE_VALUE_BOOLEAN); return oatpp::Void(Boolean::Class::getType()); } } @@ -207,7 +207,7 @@ oatpp::Void Deserializer::deserializeString(Deserializer* deserializer, parser:: if(caret.isAtText("null", true)){ return oatpp::Void(String::Class::getType()); } else { - return oatpp::Void(oatpp::parser::json::Utils::parseString(caret).getPtr(), String::Class::getType()); + return oatpp::Void(Utils::parseString(caret).getPtr(), String::Class::getType()); } } @@ -245,7 +245,7 @@ const data::mapping::type::Type* Deserializer::guessType(oatpp::parser::Caret& c } } } - caret.setError("[oatpp::parser::json::mapping::Deserializer::guessType()]: Error. Can't guess type for oatpp::Any."); + caret.setError("[oatpp::json::Deserializer::guessType()]: Error. Can't guess type for oatpp::Any."); return nullptr; } @@ -283,14 +283,14 @@ oatpp::Void Deserializer::deserializeEnum(Deserializer* deserializer, parser::Ca switch(e) { case data::mapping::type::EnumInterpreterError::CONSTRAINT_NOT_NULL: - caret.setError("[oatpp::parser::json::mapping::Deserializer::deserializeEnum()]: Error. Enum constraint violated - 'NotNull'."); + caret.setError("[oatpp::json::Deserializer::deserializeEnum()]: Error. Enum constraint violated - 'NotNull'."); break; case data::mapping::type::EnumInterpreterError::OK: case data::mapping::type::EnumInterpreterError::TYPE_MISMATCH_ENUM: case data::mapping::type::EnumInterpreterError::TYPE_MISMATCH_ENUM_VALUE: case data::mapping::type::EnumInterpreterError::ENTRY_NOT_FOUND: default: - caret.setError("[oatpp::parser::json::mapping::Deserializer::deserializeEnum()]: Error. Can't deserialize Enum."); + caret.setError("[oatpp::json::Deserializer::deserializeEnum()]: Error. Can't deserialize Enum."); } return nullptr; @@ -329,7 +329,7 @@ oatpp::Void Deserializer::deserializeCollection(Deserializer* deserializer, pars if(!caret.canContinueAtChar(']', 1)){ if(!caret.hasError()){ - caret.setError("[oatpp::parser::json::mapping::Deserializer::deserializeCollection()]: Error. ']' - expected", ERROR_CODE_ARRAY_SCOPE_CLOSE); + caret.setError("[oatpp::json::Deserializer::deserializeCollection()]: Error. ']' - expected", ERROR_CODE_ARRAY_SCOPE_CLOSE); } return nullptr; } @@ -337,7 +337,7 @@ oatpp::Void Deserializer::deserializeCollection(Deserializer* deserializer, pars return collection; } else { - caret.setError("[oatpp::parser::json::mapping::Deserializer::deserializeCollection()]: Error. '[' - expected", ERROR_CODE_ARRAY_SCOPE_OPEN); + caret.setError("[oatpp::json::Deserializer::deserializeCollection()]: Error. '[' - expected", ERROR_CODE_ARRAY_SCOPE_OPEN); return nullptr; } @@ -356,7 +356,7 @@ oatpp::Void Deserializer::deserializeMap(Deserializer* deserializer, parser::Car auto keyType = dispatcher->getKeyType(); if(keyType->classId != oatpp::String::Class::CLASS_ID){ - throw std::runtime_error("[oatpp::parser::json::mapping::Deserializer::deserializeMap()]: Invalid json map key. Key should be String"); + throw std::runtime_error("[oatpp::json::Deserializer::deserializeMap()]: Invalid json map key. Key should be String"); } auto valueType = dispatcher->getValueType(); @@ -372,7 +372,7 @@ oatpp::Void Deserializer::deserializeMap(Deserializer* deserializer, parser::Car caret.skipBlankChars(); if(!caret.canContinueAtChar(':', 1)){ - caret.setError("[oatpp::parser::json::mapping::Deserializer::deserializeMap()]: Error. ':' - expected", ERROR_CODE_OBJECT_SCOPE_COLON_MISSING); + caret.setError("[oatpp::json::Deserializer::deserializeMap()]: Error. ':' - expected", ERROR_CODE_OBJECT_SCOPE_COLON_MISSING); return nullptr; } @@ -391,7 +391,7 @@ oatpp::Void Deserializer::deserializeMap(Deserializer* deserializer, parser::Car if(!caret.canContinueAtChar('}', 1)){ if(!caret.hasError()){ - caret.setError("[oatpp::parser::json::mapping::Deserializer::deserializeMap()]: Error. '}' - expected", ERROR_CODE_OBJECT_SCOPE_CLOSE); + caret.setError("[oatpp::json::Deserializer::deserializeMap()]: Error. '}' - expected", ERROR_CODE_OBJECT_SCOPE_CLOSE); } return nullptr; } @@ -399,7 +399,7 @@ oatpp::Void Deserializer::deserializeMap(Deserializer* deserializer, parser::Car return map; } else { - caret.setError("[oatpp::parser::json::mapping::Deserializer::deserializeMap()]: Error. '{' - expected", ERROR_CODE_OBJECT_SCOPE_OPEN); + caret.setError("[oatpp::json::Deserializer::deserializeMap()]: Error. '{' - expected", ERROR_CODE_OBJECT_SCOPE_OPEN); } return nullptr; @@ -434,7 +434,7 @@ oatpp::Void Deserializer::deserializeObject(Deserializer* deserializer, parser:: caret.skipBlankChars(); if(!caret.canContinueAtChar(':', 1)){ - caret.setError("[oatpp::parser::json::mapping::Deserializer::readObject()]: Error. ':' - expected", ERROR_CODE_OBJECT_SCOPE_COLON_MISSING); + caret.setError("[oatpp::json::Deserializer::readObject()]: Error. ':' - expected", ERROR_CODE_OBJECT_SCOPE_COLON_MISSING); return nullptr; } @@ -449,7 +449,7 @@ oatpp::Void Deserializer::deserializeObject(Deserializer* deserializer, parser:: } else { auto value = deserializer->deserialize(caret, field->type); if(field->info.required && value == nullptr) { - throw std::runtime_error("[oatpp::parser::json::mapping::Deserializer::deserialize()]: " + throw std::runtime_error("[oatpp::json::Deserializer::deserialize()]: " "Error. " + std::string(type->nameQualifier) + "::" + std::string(field->name) + " is required!"); } @@ -459,13 +459,13 @@ oatpp::Void Deserializer::deserializeObject(Deserializer* deserializer, parser:: } else if (deserializer->getConfig()->allowUnknownFields) { caret.skipBlankChars(); if(!caret.canContinueAtChar(':', 1)){ - caret.setError("[oatpp::parser::json::mapping::Deserializer::readObject()/if(config->allowUnknownFields){}]: Error. ':' - expected", ERROR_CODE_OBJECT_SCOPE_COLON_MISSING); + caret.setError("[oatpp::json::Deserializer::readObject()/if(config->allowUnknownFields){}]: Error. ':' - expected", ERROR_CODE_OBJECT_SCOPE_COLON_MISSING); return nullptr; } caret.skipBlankChars(); skipValue(caret); } else { - caret.setError("[oatpp::parser::json::mapping::Deserializer::readObject()]: Error. Unknown field", ERROR_CODE_OBJECT_SCOPE_UNKNOWN_FIELD); + caret.setError("[oatpp::json::Deserializer::readObject()]: Error. Unknown field", ERROR_CODE_OBJECT_SCOPE_UNKNOWN_FIELD); return nullptr; } @@ -476,7 +476,7 @@ oatpp::Void Deserializer::deserializeObject(Deserializer* deserializer, parser:: if(!caret.canContinueAtChar('}', 1)){ if(!caret.hasError()){ - caret.setError("[oatpp::parser::json::mapping::Deserializer::readObject()]: Error. '}' - expected", ERROR_CODE_OBJECT_SCOPE_CLOSE); + caret.setError("[oatpp::json::Deserializer::readObject()]: Error. '}' - expected", ERROR_CODE_OBJECT_SCOPE_CLOSE); } return nullptr; } @@ -486,7 +486,7 @@ oatpp::Void Deserializer::deserializeObject(Deserializer* deserializer, parser:: auto selectedType = p.first->info.typeSelector->selectType(static_cast(object.get())); auto value = deserializer->deserialize(polyCaret, selectedType); if(p.first->info.required && value == nullptr) { - throw std::runtime_error("[oatpp::parser::json::mapping::Deserializer::deserialize()]: " + throw std::runtime_error("[oatpp::json::Deserializer::deserialize()]: " "Error. " + std::string(type->nameQualifier) + "::" + std::string(p.first->name) + " is required!"); } @@ -497,7 +497,7 @@ oatpp::Void Deserializer::deserializeObject(Deserializer* deserializer, parser:: return object; } else { - caret.setError("[oatpp::parser::json::mapping::Deserializer::readObject()]: Error. '{' - expected", ERROR_CODE_OBJECT_SCOPE_OPEN); + caret.setError("[oatpp::json::Deserializer::readObject()]: Error. '{' - expected", ERROR_CODE_OBJECT_SCOPE_OPEN); } return nullptr; @@ -516,7 +516,7 @@ oatpp::Void Deserializer::deserialize(parser::Caret& caret, const Type* const ty return interpretation->fromInterpretation(deserialize(caret, interpretation->getInterpretationType())); } - throw std::runtime_error("[oatpp::parser::json::mapping::Deserializer::deserialize()]: " + throw std::runtime_error("[oatpp::json::Deserializer::deserialize()]: " "Error. No deserialize method for type '" + std::string(type->classId.name) + "'"); } } @@ -525,4 +525,4 @@ const std::shared_ptr& Deserializer::getConfig() { return m_config; } -}}}} +}} diff --git a/src/oatpp/parser/json/mapping/Deserializer.hpp b/src/oatpp/json/Deserializer.hpp similarity index 95% rename from src/oatpp/parser/json/mapping/Deserializer.hpp rename to src/oatpp/json/Deserializer.hpp index 09572aad..f94290f2 100644 --- a/src/oatpp/parser/json/mapping/Deserializer.hpp +++ b/src/oatpp/json/Deserializer.hpp @@ -22,16 +22,16 @@ * ***************************************************************************/ -#ifndef oatpp_parser_json_mapping_Deserializer_hpp -#define oatpp_parser_json_mapping_Deserializer_hpp +#ifndef oatpp_json_Deserializer_hpp +#define oatpp_json_Deserializer_hpp -#include "oatpp/parser/json/Utils.hpp" +#include "./Utils.hpp" #include "oatpp/core/parser/Caret.hpp" #include "oatpp/core/Types.hpp" #include -namespace oatpp { namespace parser { namespace json { namespace mapping { +namespace oatpp { namespace json { /** * Json Deserializer. @@ -209,6 +209,6 @@ public: }; -}}}} +}} -#endif /* oatpp_parser_json_mapping_Deserializer_hpp */ +#endif /* oatpp_json_Deserializer_hpp */ diff --git a/src/oatpp/parser/json/mapping/ObjectMapper.cpp b/src/oatpp/json/ObjectMapper.cpp similarity index 87% rename from src/oatpp/parser/json/mapping/ObjectMapper.cpp rename to src/oatpp/json/ObjectMapper.cpp index 9c8d3034..cc86182e 100644 --- a/src/oatpp/parser/json/mapping/ObjectMapper.cpp +++ b/src/oatpp/json/ObjectMapper.cpp @@ -24,7 +24,7 @@ #include "ObjectMapper.hpp" -namespace oatpp { namespace parser { namespace json { namespace mapping { +namespace oatpp { namespace json { ObjectMapper::ObjectMapper(const std::shared_ptr& serializerConfig, const std::shared_ptr& deserializerConfig) @@ -41,12 +41,14 @@ ObjectMapper::ObjectMapper(const std::shared_ptr& serializer, {} std::shared_ptr ObjectMapper::createShared(const std::shared_ptr& serializerConfig, - const std::shared_ptr& deserializerConfig){ + const std::shared_ptr& deserializerConfig) +{ return std::make_shared(serializerConfig, deserializerConfig); } std::shared_ptr ObjectMapper::createShared(const std::shared_ptr& serializer, - const std::shared_ptr& deserializer){ + const std::shared_ptr& deserializer) +{ return std::make_shared(serializer, deserializer); } @@ -55,8 +57,7 @@ void ObjectMapper::write(data::stream::ConsistentOutputStream* stream, m_serializer->serializeToStream(stream, variant); } -oatpp::Void ObjectMapper::read(oatpp::parser::Caret& caret, - const oatpp::data::mapping::type::Type* const type) const { +oatpp::Void ObjectMapper::read(oatpp::parser::Caret& caret, const oatpp::data::mapping::type::Type* const type) const { return m_deserializer->deserialize(caret, type); } @@ -68,4 +69,4 @@ std::shared_ptr ObjectMapper::getDeserializer() { return m_deserializer; } -}}}} +}} diff --git a/src/oatpp/parser/json/mapping/ObjectMapper.hpp b/src/oatpp/json/ObjectMapper.hpp similarity index 86% rename from src/oatpp/parser/json/mapping/ObjectMapper.hpp rename to src/oatpp/json/ObjectMapper.hpp index 8a05cb4e..98ca5b47 100644 --- a/src/oatpp/parser/json/mapping/ObjectMapper.hpp +++ b/src/oatpp/json/ObjectMapper.hpp @@ -22,15 +22,15 @@ * ***************************************************************************/ -#ifndef oatpp_parser_json_mapping_ObjectMapper_hpp -#define oatpp_parser_json_mapping_ObjectMapper_hpp +#ifndef oatpp_json_ObjectMapper_hpp +#define oatpp_json_ObjectMapper_hpp #include "./Serializer.hpp" #include "./Deserializer.hpp" #include "oatpp/core/data/mapping/ObjectMapper.hpp" -namespace oatpp { namespace parser { namespace json { namespace mapping { +namespace oatpp { namespace json { /** * Json ObjectMapper. Serialized/Deserializes oatpp DTO objects to/from JSON. @@ -49,8 +49,8 @@ private: public: /** * Constructor. - * @param serializerConfig - &id:oatpp::parser::json::mapping::Serializer::Config;. - * @param deserializerConfig - &id:oatpp::parser::json::mapping::Deserializer::Config;. + * @param serializerConfig - &id:oatpp::json::Serializer::Config;. + * @param deserializerConfig - &id:oatpp::json::Deserializer::Config;. */ ObjectMapper(const std::shared_ptr& serializerConfig, const std::shared_ptr& deserializerConfig); @@ -66,8 +66,8 @@ public: /** * Create shared ObjectMapper. - * @param serializerConfig - &id:oatpp::parser::json::mapping::Serializer::Config;. - * @param deserializerConfig - &id:oatpp::parser::json::mapping::Deserializer::Config;. + * @param serializerConfig - &id:oatpp::json::Serializer::Config;. + * @param deserializerConfig - &id:oatpp::json::Deserializer::Config;. * @return - `std::shared_ptr` to ObjectMapper. */ static std::shared_ptr @@ -114,6 +114,6 @@ public: }; -}}}} +}} -#endif /* oatpp_parser_json_mapping_ObjectMapper_hpp */ +#endif /* oatpp_json_ObjectMapper_hpp */ diff --git a/src/oatpp/parser/json/mapping/Serializer.cpp b/src/oatpp/json/Serializer.cpp similarity index 94% rename from src/oatpp/parser/json/mapping/Serializer.cpp rename to src/oatpp/json/Serializer.cpp index 69524c76..d4a04d36 100644 --- a/src/oatpp/parser/json/mapping/Serializer.cpp +++ b/src/oatpp/json/Serializer.cpp @@ -24,10 +24,10 @@ #include "Serializer.hpp" -#include "oatpp/parser/json/Utils.hpp" +#include "./Utils.hpp" #include "oatpp/core/data/mapping/type/Any.hpp" -namespace oatpp { namespace parser { namespace json { namespace mapping { +namespace oatpp { namespace json { Serializer::Serializer(const std::shared_ptr& config) : m_config(config) @@ -129,13 +129,13 @@ void Serializer::serializeEnum(Serializer* serializer, switch(e) { case data::mapping::type::EnumInterpreterError::CONSTRAINT_NOT_NULL: - throw std::runtime_error("[oatpp::parser::json::mapping::Serializer::serializeEnum()]: Error. Enum constraint violated - 'NotNull'."); + throw std::runtime_error("[oatpp::json::Serializer::serializeEnum()]: Error. Enum constraint violated - 'NotNull'."); case data::mapping::type::EnumInterpreterError::OK: case data::mapping::type::EnumInterpreterError::TYPE_MISMATCH_ENUM: case data::mapping::type::EnumInterpreterError::TYPE_MISMATCH_ENUM_VALUE: case data::mapping::type::EnumInterpreterError::ENTRY_NOT_FOUND: default: - throw std::runtime_error("[oatpp::parser::json::mapping::Serializer::serializeEnum()]: Error. Can't serialize Enum."); + throw std::runtime_error("[oatpp::json::Serializer::serializeEnum()]: Error. Can't serialize Enum."); } } @@ -188,7 +188,7 @@ void Serializer::serializeMap(Serializer* serializer, auto keyType = dispatcher->getKeyType(); if(keyType->classId != oatpp::String::Class::CLASS_ID){ - throw std::runtime_error("[oatpp::parser::json::mapping::Serializer::serializeMap()]: Invalid json map key. Key should be String"); + throw std::runtime_error("[oatpp::json::Serializer::serializeMap()]: Invalid json map key. Key should be String"); } stream->writeCharSimple('{'); @@ -245,7 +245,7 @@ void Serializer::serializeObject(Serializer* serializer, } if(field->info.required && value == nullptr) { - throw std::runtime_error("[oatpp::parser::json::mapping::Serializer::serialize()]: " + throw std::runtime_error("[oatpp::json::Serializer::serialize()]: " "Error. " + std::string(type->nameQualifier) + "::" + std::string(field->name) + " is required!"); } @@ -276,7 +276,7 @@ void Serializer::serialize(data::stream::ConsistentOutputStream* stream, if(interpretation) { serialize(stream, interpretation->toInterpretation(polymorph)); } else { - throw std::runtime_error("[oatpp::parser::json::mapping::Serializer::serialize()]: " + throw std::runtime_error("[oatpp::json::Serializer::serialize()]: " "Error. No serialize method for type '" + std::string(polymorph.getValueType()->classId.name) + "'"); } @@ -299,4 +299,4 @@ const std::shared_ptr& Serializer::getConfig() { return m_config; } -}}}} +}} diff --git a/src/oatpp/parser/json/mapping/Serializer.hpp b/src/oatpp/json/Serializer.hpp similarity index 95% rename from src/oatpp/parser/json/mapping/Serializer.hpp rename to src/oatpp/json/Serializer.hpp index 6795cb4e..8ee6dd88 100644 --- a/src/oatpp/parser/json/mapping/Serializer.hpp +++ b/src/oatpp/json/Serializer.hpp @@ -22,15 +22,15 @@ * ***************************************************************************/ -#ifndef oatpp_parser_json_mapping_Serializer_hpp -#define oatpp_parser_json_mapping_Serializer_hpp +#ifndef oatpp_json_Serializer_hpp +#define oatpp_json_Serializer_hpp -#include "oatpp/parser/json/Utils.hpp" -#include "oatpp/parser/json/Beautifier.hpp" +#include "./Utils.hpp" +#include "./Beautifier.hpp" #include "oatpp/core/Types.hpp" #include -namespace oatpp { namespace parser { namespace json { namespace mapping { +namespace oatpp { namespace json { /** * Json Serializer. @@ -197,6 +197,6 @@ public: }; -}}}} +}} -#endif /* oatpp_parser_json_mapping_Serializer_hpp */ +#endif /* oatpp_json_Serializer_hpp */ diff --git a/src/oatpp/parser/json/Utils.cpp b/src/oatpp/json/Utils.cpp similarity index 96% rename from src/oatpp/parser/json/Utils.cpp rename to src/oatpp/json/Utils.cpp index 0ca78a87..4cec7fbd 100644 --- a/src/oatpp/parser/json/Utils.cpp +++ b/src/oatpp/json/Utils.cpp @@ -27,7 +27,7 @@ #include "oatpp/encoding/Unicode.hpp" #include "oatpp/encoding/Hex.hpp" -namespace oatpp { namespace parser { namespace json{ +namespace oatpp { namespace json{ v_buff_size Utils::calcEscapedStringSize(const char* data, v_buff_size size, v_buff_size& safeSize, v_uint32 flags) { v_buff_size result = 0; @@ -423,9 +423,9 @@ const char* Utils::preparseString(ParsingCaret& caret, v_buff_size& size){ } } caret.setPosition(caret.getDataSize()); - caret.setError("[oatpp::parser::json::Utils::preparseString()]: Error. '\"' - expected", ERROR_CODE_PARSER_QUOTE_EXPECTED); + caret.setError("[oatpp::json::Utils::preparseString()]: Error. '\"' - expected", ERROR_CODE_PARSER_QUOTE_EXPECTED); } else { - caret.setError("[oatpp::parser::json::Utils::preparseString()]: Error. '\"' - expected", ERROR_CODE_PARSER_QUOTE_EXPECTED); + caret.setError("[oatpp::json::Utils::preparseString()]: Error. '\"' - expected", ERROR_CODE_PARSER_QUOTE_EXPECTED); } return nullptr; @@ -445,7 +445,7 @@ oatpp::String Utils::parseString(ParsingCaret& caret) { v_buff_size errorPosition; auto result = unescapeString(data, size, errorCode, errorPosition); if(errorCode != 0){ - caret.setError("[oatpp::parser::json::Utils::parseString()]: Error. Call to unescapeString() failed", errorCode); + caret.setError("[oatpp::json::Utils::parseString()]: Error. Call to unescapeString() failed", errorCode); caret.setPosition(pos + errorPosition); } else { caret.setPosition(pos + size + 1); @@ -472,7 +472,7 @@ std::string Utils::parseStringToStdString(ParsingCaret& caret){ v_buff_size errorPosition; const std::string& result = unescapeStringToStdString(data, size, errorCode, errorPosition); if(errorCode != 0){ - caret.setError("[oatpp::parser::json::Utils::parseStringToStdString()]: Error. Call to unescapeStringToStdString() failed", errorCode); + caret.setError("[oatpp::json::Utils::parseStringToStdString()]: Error. Call to unescapeStringToStdString() failed", errorCode); caret.setPosition(pos + errorPosition); } else { caret.setPosition(pos + size + 1); @@ -502,4 +502,4 @@ bool Utils::findDecimalSeparatorInCurrentNumber(ParsingCaret& caret) { return false; } -}}} +}} diff --git a/src/oatpp/parser/json/Utils.hpp b/src/oatpp/json/Utils.hpp similarity index 94% rename from src/oatpp/parser/json/Utils.hpp rename to src/oatpp/json/Utils.hpp index 022c8407..060359c4 100644 --- a/src/oatpp/parser/json/Utils.hpp +++ b/src/oatpp/json/Utils.hpp @@ -22,19 +22,19 @@ * ***************************************************************************/ -#ifndef oatpp_parser_json_Utils_hpp -#define oatpp_parser_json_Utils_hpp +#ifndef oatpp_json_Utils_hpp +#define oatpp_json_Utils_hpp #include "oatpp/core/parser/Caret.hpp" #include "oatpp/core/Types.hpp" #include -namespace oatpp { namespace parser { namespace json { +namespace oatpp { namespace json { /** * Utility class for json serializer/deserializer. - * Used by &id:oatpp::parser::json::mapping::Serializer;, &id:oatpp::parser::json::mapping::Deserializer;. + * Used by &id:oatpp::json::Serializer;, &id:oatpp::json::Deserializer;. */ class Utils { public: @@ -143,6 +143,6 @@ public: }; -}}} +}} -#endif /* oatpp_parser_json_Utils_hpp */ +#endif /* oatpp_json_Utils_hpp */ diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 6d9dbd24..8fb234f9 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -61,6 +61,18 @@ add_executable(oatppAllTests oatpp/encoding/UnicodeTest.hpp oatpp/encoding/UrlTest.cpp oatpp/encoding/UrlTest.hpp + oatpp/json/BooleanTest.cpp + oatpp/json/BooleanTest.hpp + oatpp/json/DeserializerTest.cpp + oatpp/json/DeserializerTest.hpp + oatpp/json/DTOMapperPerfTest.cpp + oatpp/json/DTOMapperPerfTest.hpp + oatpp/json/DTOMapperTest.cpp + oatpp/json/DTOMapperTest.hpp + oatpp/json/EnumTest.cpp + oatpp/json/EnumTest.hpp + oatpp/json/UnorderedSetTest.cpp + oatpp/json/UnorderedSetTest.hpp oatpp/network/ConnectionPoolTest.cpp oatpp/network/ConnectionPoolTest.hpp oatpp/network/UrlTest.cpp @@ -71,18 +83,6 @@ add_executable(oatppAllTests oatpp/network/virtual_/InterfaceTest.hpp oatpp/network/virtual_/PipeTest.cpp oatpp/network/virtual_/PipeTest.hpp - oatpp/parser/json/mapping/BooleanTest.cpp - oatpp/parser/json/mapping/BooleanTest.hpp - oatpp/parser/json/mapping/DeserializerTest.cpp - oatpp/parser/json/mapping/DeserializerTest.hpp - oatpp/parser/json/mapping/DTOMapperPerfTest.cpp - oatpp/parser/json/mapping/DTOMapperPerfTest.hpp - oatpp/parser/json/mapping/DTOMapperTest.cpp - oatpp/parser/json/mapping/DTOMapperTest.hpp - oatpp/parser/json/mapping/EnumTest.cpp - oatpp/parser/json/mapping/EnumTest.hpp - oatpp/parser/json/mapping/UnorderedSetTest.cpp - oatpp/parser/json/mapping/UnorderedSetTest.hpp oatpp/web/ClientRetryTest.cpp oatpp/web/ClientRetryTest.hpp oatpp/web/FullAsyncClientTest.cpp diff --git a/test/oatpp/AllTestsMain.cpp b/test/oatpp/AllTestsMain.cpp index b3ac3177..55e9b297 100644 --- a/test/oatpp/AllTestsMain.cpp +++ b/test/oatpp/AllTestsMain.cpp @@ -18,12 +18,12 @@ #include "oatpp/network/ConnectionPoolTest.hpp" #include "oatpp/network/monitor/ConnectionMonitorTest.hpp" -#include "oatpp/parser/json/mapping/DeserializerTest.hpp" -#include "oatpp/parser/json/mapping/DTOMapperPerfTest.hpp" -#include "oatpp/parser/json/mapping/DTOMapperTest.hpp" -#include "oatpp/parser/json/mapping/EnumTest.hpp" -#include "oatpp/parser/json/mapping/BooleanTest.hpp" -#include "oatpp/parser/json/mapping/UnorderedSetTest.hpp" +#include "oatpp/json/DeserializerTest.hpp" +#include "oatpp/json/DTOMapperPerfTest.hpp" +#include "oatpp/json/DTOMapperTest.hpp" +#include "oatpp/json/EnumTest.hpp" +#include "oatpp/json/BooleanTest.hpp" +#include "oatpp/json/UnorderedSetTest.hpp" #include "oatpp/encoding/Base64Test.hpp" #include "oatpp/encoding/UnicodeTest.hpp" @@ -126,14 +126,14 @@ void runTests() { OATPP_RUN_TEST(oatpp::test::core::provider::PoolTest); OATPP_RUN_TEST(oatpp::test::core::provider::PoolTemplateTest); - OATPP_RUN_TEST(oatpp::test::parser::json::mapping::EnumTest); - OATPP_RUN_TEST(oatpp::test::parser::json::mapping::BooleanTest); + OATPP_RUN_TEST(oatpp::json::test::EnumTest); + OATPP_RUN_TEST(oatpp::json::test::BooleanTest); - OATPP_RUN_TEST(oatpp::test::parser::json::mapping::UnorderedSetTest); + OATPP_RUN_TEST(oatpp::json::test::UnorderedSetTest); - OATPP_RUN_TEST(oatpp::test::parser::json::mapping::DeserializerTest); - OATPP_RUN_TEST(oatpp::test::parser::json::mapping::DTOMapperPerfTest); - OATPP_RUN_TEST(oatpp::test::parser::json::mapping::DTOMapperTest); + OATPP_RUN_TEST(oatpp::json::test::DeserializerTest); + OATPP_RUN_TEST(oatpp::json::test::DTOMapperPerfTest); + OATPP_RUN_TEST(oatpp::json::test::DTOMapperTest); OATPP_RUN_TEST(oatpp::test::encoding::Base64Test); OATPP_RUN_TEST(oatpp::test::encoding::UnicodeTest); diff --git a/test/oatpp/core/data/mapping/type/AnyTest.cpp b/test/oatpp/core/data/mapping/type/AnyTest.cpp index abc98230..a6fdd544 100644 --- a/test/oatpp/core/data/mapping/type/AnyTest.cpp +++ b/test/oatpp/core/data/mapping/type/AnyTest.cpp @@ -26,7 +26,7 @@ #include "oatpp/core/data/mapping/type/Any.hpp" -#include "oatpp/parser/json/mapping/ObjectMapper.hpp" +#include "oatpp/json/ObjectMapper.hpp" #include "oatpp/core/macro/codegen.hpp" namespace oatpp { namespace test { namespace core { namespace data { namespace mapping { namespace type { diff --git a/test/oatpp/core/data/mapping/type/InterpretationTest.cpp b/test/oatpp/core/data/mapping/type/InterpretationTest.cpp index d2fd27eb..493bc743 100644 --- a/test/oatpp/core/data/mapping/type/InterpretationTest.cpp +++ b/test/oatpp/core/data/mapping/type/InterpretationTest.cpp @@ -24,7 +24,7 @@ #include "InterpretationTest.hpp" -#include "oatpp/parser/json/mapping/ObjectMapper.hpp" +#include "oatpp/json/ObjectMapper.hpp" #include "oatpp/core/data/mapping/TypeResolver.hpp" #include "oatpp/core/Types.hpp" #include "oatpp/core/macro/codegen.hpp" @@ -173,7 +173,7 @@ namespace __class { void InterpretationTest::onRun() { - oatpp::parser::json::mapping::ObjectMapper mapper; + oatpp::json::ObjectMapper mapper; { auto config = mapper.getSerializer()->getConfig(); diff --git a/test/oatpp/core/data/mapping/type/ObjectTest.cpp b/test/oatpp/core/data/mapping/type/ObjectTest.cpp index 646cfb61..1a75e545 100644 --- a/test/oatpp/core/data/mapping/type/ObjectTest.cpp +++ b/test/oatpp/core/data/mapping/type/ObjectTest.cpp @@ -24,7 +24,7 @@ #include "ObjectTest.hpp" -#include "oatpp/parser/json/mapping/ObjectMapper.hpp" +#include "oatpp/json/ObjectMapper.hpp" #include "oatpp/core/macro/codegen.hpp" #include "oatpp/core/Types.hpp" @@ -477,7 +477,7 @@ void ObjectTest::onRun() { { OATPP_LOGI(TAG, "Test 16...") - oatpp::parser::json::mapping::ObjectMapper mapper; + oatpp::json::ObjectMapper mapper; auto dto = PolymorphicDto1::createShared(); @@ -509,7 +509,7 @@ void ObjectTest::onRun() { { OATPP_LOGI(TAG, "Test 17...") - oatpp::parser::json::mapping::ObjectMapper mapper; + oatpp::json::ObjectMapper mapper; auto dto = PolymorphicDto3::createShared(); @@ -541,7 +541,7 @@ void ObjectTest::onRun() { { OATPP_LOGI(TAG, "Test 18...") - oatpp::parser::json::mapping::ObjectMapper mapper; + oatpp::json::ObjectMapper mapper; auto dto = PolymorphicDto3::createShared(); diff --git a/test/oatpp/core/data/mapping/type/TypeTest.cpp b/test/oatpp/core/data/mapping/type/TypeTest.cpp index 7de1a47b..3985b721 100644 --- a/test/oatpp/core/data/mapping/type/TypeTest.cpp +++ b/test/oatpp/core/data/mapping/type/TypeTest.cpp @@ -24,7 +24,6 @@ #include "TypeTest.hpp" -#include "oatpp/parser/json/mapping/ObjectMapper.hpp" #include "oatpp/core/macro/codegen.hpp" #include "oatpp/core/Types.hpp" diff --git a/test/oatpp/parser/json/mapping/BooleanTest.hpp b/test/oatpp/json/BooleanTest.cpp similarity index 52% rename from test/oatpp/parser/json/mapping/BooleanTest.hpp rename to test/oatpp/json/BooleanTest.cpp index a2ff2884..1cb927ad 100644 --- a/test/oatpp/parser/json/mapping/BooleanTest.hpp +++ b/test/oatpp/json/BooleanTest.cpp @@ -22,33 +22,42 @@ * ***************************************************************************/ -#ifndef oatpp_test_parser_json_mapping_BooleanTest_hpp -#define oatpp_test_parser_json_mapping_BooleanTest_hpp +#include "BooleanTest.hpp" -#include "oatpp-test/UnitTest.hpp" +#include "oatpp/json/ObjectMapper.hpp" -namespace oatpp -{ -namespace test -{ -namespace parser -{ -namespace json -{ -namespace mapping -{ +namespace oatpp { namespace json { namespace test { -class BooleanTest : public UnitTest -{ -public: - BooleanTest() : UnitTest("TEST[parser::json::mapping::BooleanTest]") {} - void onRun() override; -}; +void BooleanTest::onRun() { + oatpp::json::ObjectMapper mapper; -} // namespace mapping -} // namespace json -} // namespace parser -} // namespace test -} // namespace oatpp + { + OATPP_LOGI(TAG, "Serialize true to string...") + auto value = mapper.writeToString(Boolean(true)); + OATPP_ASSERT(value == "true") + OATPP_LOGI(TAG, "OK") + } -#endif /* oatpp_test_parser_json_mapping_BooleanTest_hpp */ + { + OATPP_LOGI(TAG, "Serialize false to string...") + auto value = mapper.writeToString(Boolean(false)); + OATPP_ASSERT(value == "false") + OATPP_LOGI(TAG, "OK") + } + + { + OATPP_LOGI(TAG, "Deserialize true string...") + Boolean value = mapper.readFromString("true"); + OATPP_ASSERT(static_cast(value)) + OATPP_LOGI(TAG, "OK") + } + + { + OATPP_LOGI(TAG, "Deserialize false string...") + Boolean value = mapper.readFromString("false"); + OATPP_ASSERT(!static_cast(value)) + OATPP_LOGI(TAG, "OK") + } +} + +}}} \ No newline at end of file diff --git a/test/oatpp/json/BooleanTest.hpp b/test/oatpp/json/BooleanTest.hpp new file mode 100644 index 00000000..de6ad34d --- /dev/null +++ b/test/oatpp/json/BooleanTest.hpp @@ -0,0 +1,40 @@ +/*************************************************************************** + * + * Project _____ __ ____ _ _ + * ( _ ) /__\ (_ _)_| |_ _| |_ + * )(_)( /(__)\ )( (_ _)(_ _) + * (_____)(__)(__)(__) |_| |_| + * + * + * Copyright 2018-present, Leonid Stryzhevskyi + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + ***************************************************************************/ + +#ifndef oatpp_json_test_BooleanTest_hpp +#define oatpp_json_test_BooleanTest_hpp + +#include "oatpp-test/UnitTest.hpp" + +namespace oatpp { namespace json { namespace test { + +class BooleanTest : public oatpp::test::UnitTest { +public: + BooleanTest() : UnitTest("TEST[oatpp::json::BooleanTest]") {} + void onRun() override; +}; + +}}} + +#endif /* oatpp_json_test_BooleanTest_hpp */ diff --git a/test/oatpp/parser/json/mapping/DTOMapperPerfTest.cpp b/test/oatpp/json/DTOMapperPerfTest.cpp similarity index 78% rename from test/oatpp/parser/json/mapping/DTOMapperPerfTest.cpp rename to test/oatpp/json/DTOMapperPerfTest.cpp index 9396eb93..9f208bb7 100644 --- a/test/oatpp/parser/json/mapping/DTOMapperPerfTest.cpp +++ b/test/oatpp/json/DTOMapperPerfTest.cpp @@ -24,9 +24,9 @@ #include "DTOMapperPerfTest.hpp" -#include "oatpp/parser/json/mapping/ObjectMapper.hpp" -#include "oatpp/parser/json/mapping/Serializer.hpp" -#include "oatpp/parser/json/mapping/Deserializer.hpp" +#include "oatpp/json/ObjectMapper.hpp" +#include "oatpp/json/Serializer.hpp" +#include "oatpp/json/Deserializer.hpp" #include "oatpp/core/data/stream/BufferStream.hpp" @@ -35,12 +35,12 @@ #include "oatpp-test/Checker.hpp" -namespace oatpp { namespace test { namespace parser { namespace json { namespace mapping { +namespace oatpp { namespace json { namespace test { namespace { -typedef oatpp::parser::json::mapping::Serializer Serializer; -typedef oatpp::parser::json::mapping::Deserializer Deserializer; +typedef oatpp::json::Serializer Serializer; +typedef oatpp::json::Deserializer Deserializer; #include OATPP_CODEGEN_BEGIN(DTO) @@ -73,22 +73,22 @@ void DTOMapperPerfTest::onRun() { v_int32 numIterations = 1000000; - auto serializer2 = std::make_shared(); - auto mapper = oatpp::parser::json::mapping::ObjectMapper::createShared(); + auto serializer2 = std::make_shared(); + auto mapper = oatpp::json::ObjectMapper::createShared(); auto test1 = Test1::createTestInstance(); auto test1_Text = mapper->writeToString(test1); OATPP_LOGV(TAG, "json='%s'", test1_Text->c_str()) { - PerformanceChecker checker("Serializer"); + oatpp::test::PerformanceChecker checker("Serializer"); for(v_int32 i = 0; i < numIterations; i ++) { mapper->writeToString(test1); } } { - PerformanceChecker checker("Deserializer"); + oatpp::test::PerformanceChecker checker("Deserializer"); oatpp::parser::Caret caret(test1_Text); for(v_int32 i = 0; i < numIterations; i ++) { caret.setPosition(0); @@ -98,4 +98,4 @@ void DTOMapperPerfTest::onRun() { } -}}}}} +}}} diff --git a/test/oatpp/parser/json/mapping/DTOMapperPerfTest.hpp b/test/oatpp/json/DTOMapperPerfTest.hpp similarity index 72% rename from test/oatpp/parser/json/mapping/DTOMapperPerfTest.hpp rename to test/oatpp/json/DTOMapperPerfTest.hpp index 399220bf..7608a8a4 100644 --- a/test/oatpp/parser/json/mapping/DTOMapperPerfTest.hpp +++ b/test/oatpp/json/DTOMapperPerfTest.hpp @@ -22,21 +22,21 @@ * ***************************************************************************/ -#ifndef oatpp_test_parser_json_mapping_DTOMapperPerfTest_hpp -#define oatpp_test_parser_json_mapping_DTOMapperPerfTest_hpp +#ifndef oatpp_json_test_DTOMapperPerfTest_hpp +#define oatpp_json_test_DTOMapperPerfTest_hpp #include "oatpp-test/UnitTest.hpp" -namespace oatpp { namespace test { namespace parser { namespace json { namespace mapping { +namespace oatpp { namespace json { namespace test { -class DTOMapperPerfTest : public UnitTest{ +class DTOMapperPerfTest : public oatpp::test::UnitTest { public: - DTOMapperPerfTest():UnitTest("TEST[parser::json::mapping::DTOMapperPerfTest]"){} + DTOMapperPerfTest():UnitTest("TEST[oatpp::json::DTOMapperPerfTest]"){} void onRun() override; }; -}}}}} +}}} -#endif /* oatpp_test_parser_json_mapping_DTOMapperPerfTest_hpp */ +#endif /* oatpp_json_test_DTOMapperPerfTest_hpp */ diff --git a/test/oatpp/parser/json/mapping/DTOMapperTest.cpp b/test/oatpp/json/DTOMapperTest.cpp similarity index 98% rename from test/oatpp/parser/json/mapping/DTOMapperTest.cpp rename to test/oatpp/json/DTOMapperTest.cpp index 05d38a71..d2efb2e4 100644 --- a/test/oatpp/parser/json/mapping/DTOMapperTest.cpp +++ b/test/oatpp/json/DTOMapperTest.cpp @@ -26,7 +26,7 @@ #include -#include "oatpp/parser/json/mapping/ObjectMapper.hpp" +#include "oatpp/json/ObjectMapper.hpp" #include "oatpp/core/data/mapping/type/Object.hpp" #include "oatpp/core/data/mapping/type/List.hpp" @@ -36,7 +36,7 @@ #include "oatpp/core/macro/codegen.hpp" -namespace oatpp { namespace test { namespace parser { namespace json { namespace mapping { +namespace oatpp { namespace json { namespace test { namespace { @@ -164,7 +164,7 @@ class TestAnyNested : public oatpp::DTO { void DTOMapperTest::onRun(){ - auto mapper = oatpp::parser::json::mapping::ObjectMapper::createShared(); + auto mapper = oatpp::json::ObjectMapper::createShared(); mapper->getSerializer()->getConfig()->useBeautifier = true; { @@ -402,4 +402,4 @@ void DTOMapperTest::onRun(){ #include OATPP_CODEGEN_END(DTO) -}}}}} +}}} diff --git a/test/oatpp/parser/json/mapping/DTOMapperTest.hpp b/test/oatpp/json/DTOMapperTest.hpp similarity index 73% rename from test/oatpp/parser/json/mapping/DTOMapperTest.hpp rename to test/oatpp/json/DTOMapperTest.hpp index cd72508c..43faf67a 100644 --- a/test/oatpp/parser/json/mapping/DTOMapperTest.hpp +++ b/test/oatpp/json/DTOMapperTest.hpp @@ -22,21 +22,21 @@ * ***************************************************************************/ -#ifndef oatpp_test_parser_json_mapping_DTOMapperTest_hpp -#define oatpp_test_parser_json_mapping_DTOMapperTest_hpp +#ifndef oatpp_json_test_DTOMapperTest_hpp +#define oatpp_json_test_DTOMapperTest_hpp #include "oatpp-test/UnitTest.hpp" -namespace oatpp { namespace test { namespace parser { namespace json { namespace mapping { +namespace oatpp { namespace json { namespace test { -class DTOMapperTest : public UnitTest{ +class DTOMapperTest : public oatpp::test::UnitTest { public: - DTOMapperTest():UnitTest("TEST[parser::json::mapping::DTOMapperTest]"){} + DTOMapperTest():UnitTest("TEST[oatpp::json::DTOMapperTest]"){} void onRun() override; }; -}}}}} +}}} -#endif /* oatpp_test_parser_json_mapping_DTOMapperTest_hpp */ +#endif /* oatpp_json_test_DTOMapperTest_hpp */ diff --git a/test/oatpp/parser/json/mapping/DeserializerTest.cpp b/test/oatpp/json/DeserializerTest.cpp similarity index 96% rename from test/oatpp/parser/json/mapping/DeserializerTest.cpp rename to test/oatpp/json/DeserializerTest.cpp index feba43c8..036d689a 100644 --- a/test/oatpp/parser/json/mapping/DeserializerTest.cpp +++ b/test/oatpp/json/DeserializerTest.cpp @@ -26,18 +26,18 @@ #include -#include "oatpp/parser/json/mapping/ObjectMapper.hpp" +#include "oatpp/json/ObjectMapper.hpp" #include "oatpp/core/macro/codegen.hpp" -namespace oatpp { namespace test { namespace parser { namespace json { namespace mapping { +namespace oatpp { namespace json { namespace test { namespace { #include OATPP_CODEGEN_BEGIN(DTO) typedef oatpp::parser::Caret ParsingCaret; -typedef oatpp::parser::json::mapping::Serializer Serializer; -typedef oatpp::parser::json::mapping::Deserializer Deserializer; +typedef oatpp::json::Serializer Serializer; +typedef oatpp::json::Deserializer Deserializer; class EmptyDto : public oatpp::DTO { @@ -145,7 +145,7 @@ class AnyDto : public oatpp::DTO { void DeserializerTest::onRun(){ - auto mapper = oatpp::parser::json::mapping::ObjectMapper::createShared(); + auto mapper = oatpp::json::ObjectMapper::createShared(); auto obj1 = mapper->readFromString>("{}"); @@ -324,4 +324,4 @@ void DeserializerTest::onRun(){ } -}}}}} +}}} diff --git a/test/oatpp/parser/json/mapping/DeserializerTest.hpp b/test/oatpp/json/DeserializerTest.hpp similarity index 72% rename from test/oatpp/parser/json/mapping/DeserializerTest.hpp rename to test/oatpp/json/DeserializerTest.hpp index 2173ce3d..33ec5f32 100644 --- a/test/oatpp/parser/json/mapping/DeserializerTest.hpp +++ b/test/oatpp/json/DeserializerTest.hpp @@ -22,21 +22,21 @@ * ***************************************************************************/ -#ifndef oatpp_test_parser_json_mapping_DeserializerTest_hpp -#define oatpp_test_parser_json_mapping_DeserializerTest_hpp +#ifndef oatpp_json_test_DeserializerTest_hpp +#define oatpp_json_test_DeserializerTest_hpp #include "oatpp-test/UnitTest.hpp" -namespace oatpp { namespace test { namespace parser { namespace json { namespace mapping { +namespace oatpp { namespace json { namespace test { -class DeserializerTest : public UnitTest{ +class DeserializerTest : public oatpp::test::UnitTest { public: - DeserializerTest():UnitTest("TEST[parser::json::mapping::DeserializerTest]"){} + DeserializerTest():UnitTest("TEST[oatpp::json::DeserializerTest]"){} void onRun() override; }; -}}}}} +}}} -#endif /* oatpp_test_parser_json_mapping_DeserializerTest_hpp */ +#endif /* oatpp_json_test_DeserializerTest_hpp */ diff --git a/test/oatpp/parser/json/mapping/EnumTest.cpp b/test/oatpp/json/EnumTest.cpp similarity index 96% rename from test/oatpp/parser/json/mapping/EnumTest.cpp rename to test/oatpp/json/EnumTest.cpp index 4d8f9c35..b2dfbe39 100644 --- a/test/oatpp/parser/json/mapping/EnumTest.cpp +++ b/test/oatpp/json/EnumTest.cpp @@ -24,11 +24,11 @@ #include "EnumTest.hpp" -#include "oatpp/parser/json/mapping/ObjectMapper.hpp" +#include "oatpp/json/ObjectMapper.hpp" #include "oatpp/core/macro/codegen.hpp" -namespace oatpp { namespace test { namespace parser { namespace json { namespace mapping { +namespace oatpp { namespace json { namespace test { namespace { @@ -56,7 +56,7 @@ class DTO1 : public oatpp::DTO { void EnumTest::onRun() { - oatpp::parser::json::mapping::ObjectMapper mapper; + oatpp::json::ObjectMapper mapper; { OATPP_LOGI(TAG, "Serializer as string...") @@ -184,4 +184,4 @@ void EnumTest::onRun() { } -}}}}} +}}} diff --git a/test/oatpp/parser/json/mapping/EnumTest.hpp b/test/oatpp/json/EnumTest.hpp similarity index 75% rename from test/oatpp/parser/json/mapping/EnumTest.hpp rename to test/oatpp/json/EnumTest.hpp index 15b1d2c2..ab327113 100644 --- a/test/oatpp/parser/json/mapping/EnumTest.hpp +++ b/test/oatpp/json/EnumTest.hpp @@ -22,21 +22,21 @@ * ***************************************************************************/ -#ifndef oatpp_test_parser_json_mapping_EnumTest_hpp -#define oatpp_test_parser_json_mapping_EnumTest_hpp +#ifndef oatpp_json_test_EnumTest_hpp +#define oatpp_json_test_EnumTest_hpp #include "oatpp-test/UnitTest.hpp" -namespace oatpp { namespace test { namespace parser { namespace json { namespace mapping { +namespace oatpp { namespace json { namespace test { -class EnumTest : public UnitTest{ +class EnumTest : public oatpp::test::UnitTest { public: - EnumTest():UnitTest("TEST[parser::json::mapping::EnumTest]"){} + EnumTest():UnitTest("TEST[oatpp::json::EnumTest]"){} void onRun() override; }; -}}}}} +}}} -#endif /* oatpp_test_parser_json_mapping_EnumTest_hpp */ +#endif /* oatpp_json_test_EnumTest_hpp */ diff --git a/test/oatpp/parser/json/mapping/UnorderedSetTest.cpp b/test/oatpp/json/UnorderedSetTest.cpp similarity index 88% rename from test/oatpp/parser/json/mapping/UnorderedSetTest.cpp rename to test/oatpp/json/UnorderedSetTest.cpp index 486297e4..ffa497ab 100644 --- a/test/oatpp/parser/json/mapping/UnorderedSetTest.cpp +++ b/test/oatpp/json/UnorderedSetTest.cpp @@ -24,13 +24,13 @@ #include "UnorderedSetTest.hpp" -#include "oatpp/parser/json/mapping/ObjectMapper.hpp" +#include "oatpp/json/ObjectMapper.hpp" -namespace oatpp { namespace test { namespace parser { namespace json { namespace mapping { +namespace oatpp { namespace json { namespace test { void UnorderedSetTest::onRun() { - oatpp::parser::json::mapping::ObjectMapper mapper; + oatpp::json::ObjectMapper mapper; { oatpp::UnorderedSet set = {"Hello", "World", "!"}; @@ -50,4 +50,4 @@ void UnorderedSetTest::onRun() { } -}}}}} +}}} diff --git a/test/oatpp/parser/json/mapping/UnorderedSetTest.hpp b/test/oatpp/json/UnorderedSetTest.hpp similarity index 72% rename from test/oatpp/parser/json/mapping/UnorderedSetTest.hpp rename to test/oatpp/json/UnorderedSetTest.hpp index 593806d6..9a216ffd 100644 --- a/test/oatpp/parser/json/mapping/UnorderedSetTest.hpp +++ b/test/oatpp/json/UnorderedSetTest.hpp @@ -22,21 +22,21 @@ * ***************************************************************************/ -#ifndef oatpp_test_parser_json_mapping_UnorderedSetTest_hpp -#define oatpp_test_parser_json_mapping_UnorderedSetTest_hpp +#ifndef oatpp_json_test_UnorderedSetTest_hpp +#define oatpp_json_test_UnorderedSetTest_hpp #include "oatpp-test/UnitTest.hpp" -namespace oatpp { namespace test { namespace parser { namespace json { namespace mapping { +namespace oatpp { namespace json { namespace test { -class UnorderedSetTest : public UnitTest{ +class UnorderedSetTest : public oatpp::test::UnitTest { public: - UnorderedSetTest():UnitTest("TEST[parser::json::mapping::UnorderedSetTest]"){} + UnorderedSetTest():UnitTest("TEST[oatpp::json::UnorderedSetTest]"){} void onRun() override; }; -}}}}} +}}} -#endif /* oatpp_test_parser_json_mapping_UnorderedSetTest_hpp */ +#endif /* oatpp_json_test_UnorderedSetTest_hpp */ diff --git a/test/oatpp/parser/json/mapping/BooleanTest.cpp b/test/oatpp/parser/json/mapping/BooleanTest.cpp deleted file mode 100644 index 06695f46..00000000 --- a/test/oatpp/parser/json/mapping/BooleanTest.cpp +++ /dev/null @@ -1,78 +0,0 @@ -/*************************************************************************** - * - * Project _____ __ ____ _ _ - * ( _ ) /__\ (_ _)_| |_ _| |_ - * )(_)( /(__)\ )( (_ _)(_ _) - * (_____)(__)(__)(__) |_| |_| - * - * - * Copyright 2018-present, Leonid Stryzhevskyi - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - ***************************************************************************/ - -#include "BooleanTest.hpp" - -#include "oatpp/parser/json/mapping/ObjectMapper.hpp" - -#include "oatpp/core/macro/codegen.hpp" - -namespace oatpp -{ -namespace test -{ -namespace parser -{ -namespace json -{ -namespace mapping -{ -void BooleanTest::onRun() -{ - oatpp::parser::json::mapping::ObjectMapper mapper; - - { - OATPP_LOGI(TAG, "Serialize true to string...") - auto value = mapper.writeToString(Boolean(true)); - OATPP_ASSERT(value == "true") - OATPP_LOGI(TAG, "OK") - } - - { - OATPP_LOGI(TAG, "Serialize false to string...") - auto value = mapper.writeToString(Boolean(false)); - OATPP_ASSERT(value == "false") - OATPP_LOGI(TAG, "OK") - } - - { - OATPP_LOGI(TAG, "Deserialize true string...") - Boolean value = mapper.readFromString("true"); - OATPP_ASSERT(static_cast(value)) - OATPP_LOGI(TAG, "OK") - } - - { - OATPP_LOGI(TAG, "Deserialize false string...") - Boolean value = mapper.readFromString("false"); - OATPP_ASSERT(!static_cast(value)) - OATPP_LOGI(TAG, "OK") - } -} - -} // namespace mapping -} // namespace json -} // namespace parser -} // namespace test -} // namespace oatpp diff --git a/test/oatpp/web/ClientRetryTest.cpp b/test/oatpp/web/ClientRetryTest.cpp index c44e8f93..52305966 100644 --- a/test/oatpp/web/ClientRetryTest.cpp +++ b/test/oatpp/web/ClientRetryTest.cpp @@ -36,7 +36,7 @@ #include "oatpp/web/server/HttpConnectionHandler.hpp" #include "oatpp/web/server/HttpRouter.hpp" -#include "oatpp/parser/json/mapping/ObjectMapper.hpp" +#include "oatpp/json/ObjectMapper.hpp" #include "oatpp/network/tcp/server/ConnectionProvider.hpp" #include "oatpp/network/tcp/client/ConnectionProvider.hpp" @@ -92,7 +92,7 @@ public: }()); OATPP_CREATE_COMPONENT(std::shared_ptr, objectMapper)([] { - return oatpp::parser::json::mapping::ObjectMapper::createShared(); + return oatpp::json::ObjectMapper::createShared(); }()); }; @@ -153,7 +153,7 @@ void ClientRetryTest::onRun() { TestClientComponent component(m_port); - auto objectMapper = oatpp::parser::json::mapping::ObjectMapper::createShared(); + auto objectMapper = oatpp::json::ObjectMapper::createShared(); auto controller = app::Controller::createShared(objectMapper); OATPP_COMPONENT(std::shared_ptr, connectionProvider); diff --git a/test/oatpp/web/FullAsyncClientTest.cpp b/test/oatpp/web/FullAsyncClientTest.cpp index 8635d031..306b0ddb 100644 --- a/test/oatpp/web/FullAsyncClientTest.cpp +++ b/test/oatpp/web/FullAsyncClientTest.cpp @@ -33,7 +33,7 @@ #include "oatpp/web/server/AsyncHttpConnectionHandler.hpp" #include "oatpp/web/server/HttpRouter.hpp" -#include "oatpp/parser/json/mapping/ObjectMapper.hpp" +#include "oatpp/json/ObjectMapper.hpp" #include "oatpp/network/tcp/server/ConnectionProvider.hpp" #include "oatpp/network/tcp/client/ConnectionProvider.hpp" @@ -95,7 +95,7 @@ public: }()); OATPP_CREATE_COMPONENT(std::shared_ptr, objectMapper)([] { - return oatpp::parser::json::mapping::ObjectMapper::createShared(); + return oatpp::json::ObjectMapper::createShared(); }()); OATPP_CREATE_COMPONENT(std::shared_ptr, clientConnectionProvider)([this] { diff --git a/test/oatpp/web/FullAsyncTest.cpp b/test/oatpp/web/FullAsyncTest.cpp index 9d21e805..179b60d2 100644 --- a/test/oatpp/web/FullAsyncTest.cpp +++ b/test/oatpp/web/FullAsyncTest.cpp @@ -34,7 +34,7 @@ #include "oatpp/web/server/AsyncHttpConnectionHandler.hpp" #include "oatpp/web/server/HttpRouter.hpp" -#include "oatpp/parser/json/mapping/ObjectMapper.hpp" +#include "oatpp/json/ObjectMapper.hpp" #include "oatpp/network/tcp/server/ConnectionProvider.hpp" #include "oatpp/network/tcp/client/ConnectionProvider.hpp" @@ -98,7 +98,7 @@ public: }()); OATPP_CREATE_COMPONENT(std::shared_ptr, objectMapper)([] { - return oatpp::parser::json::mapping::ObjectMapper::createShared(); + return oatpp::json::ObjectMapper::createShared(); }()); OATPP_CREATE_COMPONENT(std::shared_ptr, clientConnectionProvider)([this] { diff --git a/test/oatpp/web/FullTest.cpp b/test/oatpp/web/FullTest.cpp index e528e152..2e835e96 100644 --- a/test/oatpp/web/FullTest.cpp +++ b/test/oatpp/web/FullTest.cpp @@ -37,7 +37,7 @@ #include "oatpp/web/server/HttpConnectionHandler.hpp" #include "oatpp/web/server/HttpRouter.hpp" -#include "oatpp/parser/json/mapping/ObjectMapper.hpp" +#include "oatpp/json/ObjectMapper.hpp" #include "oatpp/network/tcp/server/ConnectionProvider.hpp" #include "oatpp/network/tcp/client/ConnectionProvider.hpp" @@ -96,7 +96,7 @@ public: }()); OATPP_CREATE_COMPONENT(std::shared_ptr, objectMapper)([] { - return oatpp::parser::json::mapping::ObjectMapper::createShared(); + return oatpp::json::ObjectMapper::createShared(); }()); OATPP_CREATE_COMPONENT(std::shared_ptr, clientConnectionProvider)([this] { diff --git a/test/oatpp/web/PipelineAsyncTest.cpp b/test/oatpp/web/PipelineAsyncTest.cpp index b7d732c8..2a40728f 100644 --- a/test/oatpp/web/PipelineAsyncTest.cpp +++ b/test/oatpp/web/PipelineAsyncTest.cpp @@ -29,7 +29,7 @@ #include "oatpp/web/server/AsyncHttpConnectionHandler.hpp" #include "oatpp/web/server/HttpRouter.hpp" -#include "oatpp/parser/json/mapping/ObjectMapper.hpp" +#include "oatpp/json/ObjectMapper.hpp" #include "oatpp/network/tcp/server/ConnectionProvider.hpp" #include "oatpp/network/tcp/client/ConnectionProvider.hpp" @@ -90,7 +90,7 @@ public: }()); OATPP_CREATE_COMPONENT(std::shared_ptr, objectMapper)([] { - return oatpp::parser::json::mapping::ObjectMapper::createShared(); + return oatpp::json::ObjectMapper::createShared(); }()); OATPP_CREATE_COMPONENT(std::shared_ptr, clientConnectionProvider)([this] { diff --git a/test/oatpp/web/PipelineTest.cpp b/test/oatpp/web/PipelineTest.cpp index c111c3bf..690db038 100644 --- a/test/oatpp/web/PipelineTest.cpp +++ b/test/oatpp/web/PipelineTest.cpp @@ -29,7 +29,7 @@ #include "oatpp/web/server/HttpConnectionHandler.hpp" #include "oatpp/web/server/HttpRouter.hpp" -#include "oatpp/parser/json/mapping/ObjectMapper.hpp" +#include "oatpp/json/ObjectMapper.hpp" #include "oatpp/network/tcp/server/ConnectionProvider.hpp" #include "oatpp/network/tcp/client/ConnectionProvider.hpp" @@ -85,7 +85,7 @@ public: }()); OATPP_CREATE_COMPONENT(std::shared_ptr, objectMapper)([] { - return oatpp::parser::json::mapping::ObjectMapper::createShared(); + return oatpp::json::ObjectMapper::createShared(); }()); OATPP_CREATE_COMPONENT(std::shared_ptr, clientConnectionProvider)([this] { diff --git a/test/oatpp/web/app/BasicAuthorizationController.hpp b/test/oatpp/web/app/BasicAuthorizationController.hpp index 4157e2ea..40e7de2f 100644 --- a/test/oatpp/web/app/BasicAuthorizationController.hpp +++ b/test/oatpp/web/app/BasicAuthorizationController.hpp @@ -28,7 +28,7 @@ #include "./DTOs.hpp" #include "oatpp/web/server/api/ApiController.hpp" -#include "oatpp/parser/json/mapping/ObjectMapper.hpp" +#include "oatpp/json/ObjectMapper.hpp" #include "oatpp/core/utils/ConversionUtils.hpp" #include "oatpp/core/macro/codegen.hpp" #include "oatpp/core/macro/component.hpp" diff --git a/test/oatpp/web/app/BearerAuthorizationController.hpp b/test/oatpp/web/app/BearerAuthorizationController.hpp index e18d524e..f66b51d9 100644 --- a/test/oatpp/web/app/BearerAuthorizationController.hpp +++ b/test/oatpp/web/app/BearerAuthorizationController.hpp @@ -28,7 +28,7 @@ #include "./DTOs.hpp" #include "oatpp/web/server/api/ApiController.hpp" -#include "oatpp/parser/json/mapping/ObjectMapper.hpp" +#include "oatpp/json/ObjectMapper.hpp" #include "oatpp/core/utils/ConversionUtils.hpp" #include "oatpp/core/macro/codegen.hpp" #include "oatpp/core/macro/component.hpp" diff --git a/test/oatpp/web/app/Controller.hpp b/test/oatpp/web/app/Controller.hpp index 460dc91c..8598f925 100644 --- a/test/oatpp/web/app/Controller.hpp +++ b/test/oatpp/web/app/Controller.hpp @@ -36,7 +36,7 @@ #include "oatpp/web/protocol/http/outgoing/StreamingBody.hpp" #include "oatpp/web/server/api/ApiController.hpp" -#include "oatpp/parser/json/mapping/ObjectMapper.hpp" +#include "oatpp/json/ObjectMapper.hpp" #include "oatpp/core/data/resource/File.hpp" #include "oatpp/core/data/stream/FileStream.hpp" diff --git a/test/oatpp/web/app/ControllerAsync.hpp b/test/oatpp/web/app/ControllerAsync.hpp index cacc3029..e90f2db4 100644 --- a/test/oatpp/web/app/ControllerAsync.hpp +++ b/test/oatpp/web/app/ControllerAsync.hpp @@ -36,7 +36,7 @@ #include "oatpp/web/protocol/http/outgoing/StreamingBody.hpp" #include "oatpp/web/server/api/ApiController.hpp" -#include "oatpp/parser/json/mapping/ObjectMapper.hpp" +#include "oatpp/json/ObjectMapper.hpp" #include "oatpp/core/data/resource/File.hpp" #include "oatpp/core/data/stream/FileStream.hpp" diff --git a/test/oatpp/web/app/ControllerWithErrorHandler.hpp b/test/oatpp/web/app/ControllerWithErrorHandler.hpp index 36aa13c0..2c54d85c 100644 --- a/test/oatpp/web/app/ControllerWithErrorHandler.hpp +++ b/test/oatpp/web/app/ControllerWithErrorHandler.hpp @@ -26,7 +26,7 @@ #define oatpp_test_web_app_ControllerWithErrorHandler_hpp #include "oatpp/web/server/api/ApiController.hpp" -#include "oatpp/parser/json/mapping/ObjectMapper.hpp" +#include "oatpp/json/ObjectMapper.hpp" #include "oatpp/core/utils/ConversionUtils.hpp" #include "oatpp/core/macro/codegen.hpp" #include "oatpp/core/macro/component.hpp" diff --git a/test/oatpp/web/app/ControllerWithInterceptors.hpp b/test/oatpp/web/app/ControllerWithInterceptors.hpp index ca733d7c..1ce474d0 100644 --- a/test/oatpp/web/app/ControllerWithInterceptors.hpp +++ b/test/oatpp/web/app/ControllerWithInterceptors.hpp @@ -26,7 +26,7 @@ #define oatpp_test_web_app_ControllerWithInterceptors_hpp #include "oatpp/web/server/api/ApiController.hpp" -#include "oatpp/parser/json/mapping/ObjectMapper.hpp" +#include "oatpp/json/ObjectMapper.hpp" #include "oatpp/core/utils/ConversionUtils.hpp" #include "oatpp/core/macro/codegen.hpp" #include "oatpp/core/macro/component.hpp" diff --git a/test/oatpp/web/app/ControllerWithInterceptorsAsync.hpp b/test/oatpp/web/app/ControllerWithInterceptorsAsync.hpp index 6858b2bf..e8aa910e 100644 --- a/test/oatpp/web/app/ControllerWithInterceptorsAsync.hpp +++ b/test/oatpp/web/app/ControllerWithInterceptorsAsync.hpp @@ -26,7 +26,7 @@ #define oatpp_test_web_app_ControllerWithInterceptorsAsync_hpp #include "oatpp/web/server/api/ApiController.hpp" -#include "oatpp/parser/json/mapping/ObjectMapper.hpp" +#include "oatpp/json/ObjectMapper.hpp" #include "oatpp/core/utils/ConversionUtils.hpp" #include "oatpp/core/macro/codegen.hpp" #include "oatpp/core/macro/component.hpp"