From bfee4c9478a729baae4d178e4a867b80ca27cf16 Mon Sep 17 00:00:00 2001 From: Rustam Gamidov Date: Thu, 5 Mar 2026 08:13:40 +0200 Subject: [PATCH 1/2] Use Boost::json in olp-cpp-sdk-dataservice-write Migrating from RapidJSON Relates-To: OCMAM-445 Signed-off-by: Rustam Gamidov --- olp-cpp-sdk-dataservice-write/CMakeLists.txt | 20 +- .../src/generated/parser/ApiParser.cpp | 6 +- .../src/generated/parser/ApiParser.h | 6 +- .../src/generated/parser/CatalogParser.cpp | 32 ++-- .../src/generated/parser/CatalogParser.h | 30 +-- .../src/generated/parser/DetailsParser.cpp | 6 +- .../src/generated/parser/DetailsParser.h | 6 +- .../generated/parser/LayerVersionsParser.cpp | 10 +- .../generated/parser/LayerVersionsParser.h | 8 +- .../src/generated/parser/PartitionParser.h | 8 +- .../src/generated/parser/PartitionsParser.cpp | 10 +- .../src/generated/parser/PartitionsParser.h | 8 +- .../generated/parser/PublicationParser.cpp | 7 +- .../src/generated/parser/PublicationParser.h | 6 +- .../parser/PublishDataRequestParser.cpp | 8 +- .../parser/PublishDataRequestParser.h | 6 +- .../parser/PublishPartitionParser.cpp | 8 +- .../generated/parser/PublishPartitionParser.h | 6 +- .../parser/PublishPartitionsParser.cpp | 6 +- .../parser/PublishPartitionsParser.h | 6 +- .../src/generated/parser/ResponseOkParser.cpp | 13 +- .../src/generated/parser/ResponseOkParser.h | 8 +- .../parser/ResponseOkSingleParser.cpp | 6 +- .../generated/parser/ResponseOkSingleParser.h | 6 +- .../parser/VersionDependencyParser.cpp | 6 +- .../parser/VersionDependencyParser.h | 6 +- .../parser/VersionResponseParser.cpp | 6 +- .../generated/parser/VersionResponseParser.h | 6 +- .../generated/serializer/ApiSerializer.cpp | 18 +- .../src/generated/serializer/ApiSerializer.h | 7 +- .../serializer/CatalogSerializer.cpp | 177 ++++++++---------- .../generated/serializer/CatalogSerializer.h | 45 ++--- .../serializer/IndexInfoSerializer.cpp | 82 ++++---- .../serializer/IndexInfoSerializer.h | 8 +- .../src/generated/serializer/JsonSerializer.h | 23 +-- .../serializer/PublicationSerializer.cpp | 59 +++--- .../serializer/PublicationSerializer.h | 7 +- .../PublishDataRequestSerializer.cpp | 23 +-- .../serializer/PublishDataRequestSerializer.h | 7 +- .../serializer/PublishPartitionSerializer.cpp | 27 ++- .../serializer/PublishPartitionSerializer.h | 7 +- .../PublishPartitionsSerializer.cpp | 19 +- .../serializer/PublishPartitionsSerializer.h | 7 +- .../UpdateIndexRequestSerializer.cpp | 91 ++++----- .../serializer/UpdateIndexRequestSerializer.h | 7 +- .../src/utils/BoostJsonSrc.cpp | 20 ++ 46 files changed, 440 insertions(+), 454 deletions(-) create mode 100644 olp-cpp-sdk-dataservice-write/src/utils/BoostJsonSrc.cpp diff --git a/olp-cpp-sdk-dataservice-write/CMakeLists.txt b/olp-cpp-sdk-dataservice-write/CMakeLists.txt index 8678b7ecb..91f2a3d86 100644 --- a/olp-cpp-sdk-dataservice-write/CMakeLists.txt +++ b/olp-cpp-sdk-dataservice-write/CMakeLists.txt @@ -18,6 +18,8 @@ project(olp-cpp-sdk-dataservice-write VERSION 1.24.0) set(DESCRIPTION "C++ API library for writing data to OLP") +find_package(Boost REQUIRED) + set(OLP_SDK_DATASERVICE_WRITE_API_HEADERS ./include/olp/dataservice/write/DataServiceWriteApi.h ./include/olp/dataservice/write/IndexLayerClient.h @@ -159,16 +161,21 @@ set(OLP_SDK_DATASERVICE_WRITE_SOURCES ./src/generated/serializer/PublishPartitionsSerializer.h ./src/generated/serializer/UpdateIndexRequestSerializer.cpp ./src/generated/serializer/UpdateIndexRequestSerializer.h + + ./src/utils/BoostJsonSrc.cpp ) add_library(${PROJECT_NAME} ${OLP_SDK_DATASERVICE_WRITE_INCLUDES} ${OLP_SDK_DATASERVICE_WRITE_SOURCES}) -target_include_directories(${PROJECT_NAME} PUBLIC - $ - $ - PRIVATE $) +target_include_directories(${PROJECT_NAME} + PUBLIC + $ + $ + PRIVATE + $ + $) target_compile_definitions(${PROJECT_NAME} PRIVATE DATASERVICE_WRITE_LIBRARY) @@ -177,6 +184,11 @@ if(BUILD_SHARED_LIBS) PUBLIC DATASERVICE_WRITE_SHARED_LIBRARY) endif() +target_compile_definitions(${PROJECT_NAME} + PRIVATE + BOOST_ALL_NO_LIB + BOOST_JSON_NO_LIB) + # Used also in the package config file set(PROJECT_LIBS olp-cpp-sdk-core) diff --git a/olp-cpp-sdk-dataservice-write/src/generated/parser/ApiParser.cpp b/olp-cpp-sdk-dataservice-write/src/generated/parser/ApiParser.cpp index 5f47acdad..e2fb96cc9 100644 --- a/olp-cpp-sdk-dataservice-write/src/generated/parser/ApiParser.cpp +++ b/olp-cpp-sdk-dataservice-write/src/generated/parser/ApiParser.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 HERE Europe B.V. + * Copyright (C) 2019-2026 HERE Europe B.V. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,11 +19,13 @@ #include "ApiParser.h" +#include + #include namespace olp { namespace parser { -void from_json(const rapidjson::Value& value, +void from_json(const boost::json::value& value, olp::dataservice::write::model::Api& x) { x.SetApi(parse(value, "api")); x.SetVersion(parse(value, "version")); diff --git a/olp-cpp-sdk-dataservice-write/src/generated/parser/ApiParser.h b/olp-cpp-sdk-dataservice-write/src/generated/parser/ApiParser.h index e3b949c79..eef0478a8 100644 --- a/olp-cpp-sdk-dataservice-write/src/generated/parser/ApiParser.h +++ b/olp-cpp-sdk-dataservice-write/src/generated/parser/ApiParser.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 HERE Europe B.V. + * Copyright (C) 2019-2026 HERE Europe B.V. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,14 +19,14 @@ #pragma once -#include +#include #include "generated/model/Api.h" #include namespace olp { namespace parser { -void from_json(const rapidjson::Value& value, +void from_json(const boost::json::value& value, olp::dataservice::write::model::Api& x); } // namespace parser diff --git a/olp-cpp-sdk-dataservice-write/src/generated/parser/CatalogParser.cpp b/olp-cpp-sdk-dataservice-write/src/generated/parser/CatalogParser.cpp index 8e019993b..7f509a189 100644 --- a/olp-cpp-sdk-dataservice-write/src/generated/parser/CatalogParser.cpp +++ b/olp-cpp-sdk-dataservice-write/src/generated/parser/CatalogParser.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 HERE Europe B.V. + * Copyright (C) 2019-2026 HERE Europe B.V. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,48 +19,50 @@ #include "CatalogParser.h" +#include + #include namespace olp { namespace parser { -using namespace olp::dataservice::write; +namespace model = olp::dataservice::write::model; -void from_json(const rapidjson::Value& value, model::Coverage& x) { +void from_json(const boost::json::value& value, model::Coverage& x) { x.SetAdminAreas(parse >(value, "adminAreas")); } -void from_json(const rapidjson::Value& value, model::IndexDefinition& x) { +void from_json(const boost::json::value& value, model::IndexDefinition& x) { x.SetName(parse(value, "name")); x.SetType(parse(value, "type")); x.SetDuration(parse(value, "duration")); x.SetZoomLevel(parse(value, "zoomLevel")); } -void from_json(const rapidjson::Value& value, model::IndexProperties& x) { +void from_json(const boost::json::value& value, model::IndexProperties& x) { x.SetTtl(parse(value, "ttl")); x.SetIndexDefinitions( parse >(value, "indexDefinitions")); } -void from_json(const rapidjson::Value& value, model::Creator& x) { +void from_json(const boost::json::value& value, model::Creator& x) { x.SetId(parse(value, "id")); } -void from_json(const rapidjson::Value& value, model::Owner& x) { +void from_json(const boost::json::value& value, model::Owner& x) { x.SetCreator(parse(value, "creator")); x.SetOrganisation(parse(value, "organisation")); } -void from_json(const rapidjson::Value& value, model::Partitioning& x) { +void from_json(const boost::json::value& value, model::Partitioning& x) { x.SetScheme(parse(value, "scheme")); x.SetTileLevels(parse >(value, "tileLevels")); } -void from_json(const rapidjson::Value& value, model::Schema& x) { +void from_json(const boost::json::value& value, model::Schema& x) { x.SetHrn(parse(value, "hrn")); } -void from_json(const rapidjson::Value& value, model::StreamProperties& x) { +void from_json(const boost::json::value& value, model::StreamProperties& x) { // Parsing these as double even though OepnAPI sepcs says int64 because // Backend returns the value in decimal format (e.g. 1.0) and this triggers an // assert in RapidJSON when parsing. @@ -70,18 +72,18 @@ void from_json(const rapidjson::Value& value, model::StreamProperties& x) { static_cast(parse(value, "dataOutThroughputMbps"))); } -void from_json(const rapidjson::Value& value, model::Encryption& x) { +void from_json(const boost::json::value& value, model::Encryption& x) { x.SetAlgorithm(parse(value, "algorithm")); } -void from_json(const rapidjson::Value& value, model::Volume& x) { +void from_json(const boost::json::value& value, model::Volume& x) { x.SetVolumeType(parse(value, "volumeType")); x.SetMaxMemoryPolicy(parse(value, "maxMemoryPolicy")); x.SetPackageType(parse(value, "packageType")); x.SetEncryption(parse(value, "encryption")); } -void from_json(const rapidjson::Value& value, model::Layer& x) { +void from_json(const boost::json::value& value, model::Layer& x) { x.SetId(parse(value, "id")); x.SetName(parse(value, "name")); x.SetSummary(parse(value, "summary")); @@ -103,11 +105,11 @@ void from_json(const rapidjson::Value& value, model::Layer& x) { x.SetVolume(parse(value, "volume")); } -void from_json(const rapidjson::Value& value, model::Notifications& x) { +void from_json(const boost::json::value& value, model::Notifications& x) { x.SetEnabled(parse(value, "enabled")); } -void from_json(const rapidjson::Value& value, model::Catalog& x) { +void from_json(const boost::json::value& value, model::Catalog& x) { x.SetId(parse(value, "id")); x.SetHrn(parse(value, "hrn")); x.SetName(parse(value, "name")); diff --git a/olp-cpp-sdk-dataservice-write/src/generated/parser/CatalogParser.h b/olp-cpp-sdk-dataservice-write/src/generated/parser/CatalogParser.h index 5200ce64c..832e686cf 100644 --- a/olp-cpp-sdk-dataservice-write/src/generated/parser/CatalogParser.h +++ b/olp-cpp-sdk-dataservice-write/src/generated/parser/CatalogParser.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 HERE Europe B.V. + * Copyright (C) 2019-2026 HERE Europe B.V. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,49 +21,49 @@ #include -#include +#include #include namespace olp { namespace parser { -void from_json(const rapidjson::Value& value, +void from_json(const boost::json::value& value, olp::dataservice::write::model::Coverage& x); -void from_json(const rapidjson::Value& value, +void from_json(const boost::json::value& value, olp::dataservice::write::model::IndexDefinition& x); -void from_json(const rapidjson::Value& value, +void from_json(const boost::json::value& value, olp::dataservice::write::model::IndexProperties& x); -void from_json(const rapidjson::Value& value, +void from_json(const boost::json::value& value, olp::dataservice::write::model::Creator& x); -void from_json(const rapidjson::Value& value, +void from_json(const boost::json::value& value, olp::dataservice::write::model::Owner& x); -void from_json(const rapidjson::Value& value, +void from_json(const boost::json::value& value, olp::dataservice::write::model::Partitioning& x); -void from_json(const rapidjson::Value& value, +void from_json(const boost::json::value& value, olp::dataservice::write::model::Schema& x); -void from_json(const rapidjson::Value& value, +void from_json(const boost::json::value& value, olp::dataservice::write::model::StreamProperties& x); -void from_json(const rapidjson::Value& value, +void from_json(const boost::json::value& value, olp::dataservice::write::model::Encryption& x); -void from_json(const rapidjson::Value& value, +void from_json(const boost::json::value& value, olp::dataservice::write::model::Volume& x); -void from_json(const rapidjson::Value& value, +void from_json(const boost::json::value& value, olp::dataservice::write::model::Layer& x); -void from_json(const rapidjson::Value& value, +void from_json(const boost::json::value& value, olp::dataservice::write::model::Notifications& x); -void from_json(const rapidjson::Value& value, +void from_json(const boost::json::value& value, olp::dataservice::write::model::Catalog& x); } // namespace parser } // namespace olp diff --git a/olp-cpp-sdk-dataservice-write/src/generated/parser/DetailsParser.cpp b/olp-cpp-sdk-dataservice-write/src/generated/parser/DetailsParser.cpp index 25a613b02..575900c01 100644 --- a/olp-cpp-sdk-dataservice-write/src/generated/parser/DetailsParser.cpp +++ b/olp-cpp-sdk-dataservice-write/src/generated/parser/DetailsParser.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 HERE Europe B.V. + * Copyright (C) 2019-2026 HERE Europe B.V. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,11 +19,13 @@ #include "DetailsParser.h" +#include + #include namespace olp { namespace parser { -void from_json(const rapidjson::Value& value, +void from_json(const boost::json::value& value, olp::dataservice::write::model::Details& x) { x.SetState(parse(value, "state")); x.SetMessage(parse(value, "message")); diff --git a/olp-cpp-sdk-dataservice-write/src/generated/parser/DetailsParser.h b/olp-cpp-sdk-dataservice-write/src/generated/parser/DetailsParser.h index f61d37a2f..c1dfb3108 100644 --- a/olp-cpp-sdk-dataservice-write/src/generated/parser/DetailsParser.h +++ b/olp-cpp-sdk-dataservice-write/src/generated/parser/DetailsParser.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 HERE Europe B.V. + * Copyright (C) 2019-2026 HERE Europe B.V. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,13 +19,13 @@ #pragma once -#include +#include #include namespace olp { namespace parser { -void from_json(const rapidjson::Value& value, +void from_json(const boost::json::value& value, dataservice::write::model::Details& x); } // namespace parser } // namespace olp diff --git a/olp-cpp-sdk-dataservice-write/src/generated/parser/LayerVersionsParser.cpp b/olp-cpp-sdk-dataservice-write/src/generated/parser/LayerVersionsParser.cpp index 424bdcd6f..6e12f2d93 100644 --- a/olp-cpp-sdk-dataservice-write/src/generated/parser/LayerVersionsParser.cpp +++ b/olp-cpp-sdk-dataservice-write/src/generated/parser/LayerVersionsParser.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 HERE Europe B.V. + * Copyright (C) 2019-2026 HERE Europe B.V. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,19 +19,21 @@ #include "LayerVersionsParser.h" +#include + #include namespace olp { namespace parser { -using namespace olp::dataservice::write; +namespace model = olp::dataservice::write::model; -void from_json(const rapidjson::Value& value, model::LayerVersion& x) { +void from_json(const boost::json::value& value, model::LayerVersion& x) { x.SetLayer(parse(value, "layer")); x.SetVersion(parse(value, "version")); x.SetTimestamp(parse(value, "timestamp")); } -void from_json(const rapidjson::Value& value, model::LayerVersions& x) { +void from_json(const boost::json::value& value, model::LayerVersions& x) { x.SetLayerVersions( parse>(value, "layerVersions")); x.SetVersion(parse(value, "version")); diff --git a/olp-cpp-sdk-dataservice-write/src/generated/parser/LayerVersionsParser.h b/olp-cpp-sdk-dataservice-write/src/generated/parser/LayerVersionsParser.h index b3fd60089..ccda3b492 100644 --- a/olp-cpp-sdk-dataservice-write/src/generated/parser/LayerVersionsParser.h +++ b/olp-cpp-sdk-dataservice-write/src/generated/parser/LayerVersionsParser.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 HERE Europe B.V. + * Copyright (C) 2019-2026 HERE Europe B.V. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,17 +19,17 @@ #pragma once -#include +#include #include "generated/model/LayerVersions.h" #include namespace olp { namespace parser { -void from_json(const rapidjson::Value& value, +void from_json(const boost::json::value& value, olp::dataservice::write::model::LayerVersion& x); -void from_json(const rapidjson::Value& value, +void from_json(const boost::json::value& value, olp::dataservice::write::model::LayerVersions& x); } // namespace parser diff --git a/olp-cpp-sdk-dataservice-write/src/generated/parser/PartitionParser.h b/olp-cpp-sdk-dataservice-write/src/generated/parser/PartitionParser.h index b087c6094..25f6d22dc 100644 --- a/olp-cpp-sdk-dataservice-write/src/generated/parser/PartitionParser.h +++ b/olp-cpp-sdk-dataservice-write/src/generated/parser/PartitionParser.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 HERE Europe B.V. + * Copyright (C) 2019-2026 HERE Europe B.V. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,17 +19,17 @@ #pragma once -#include +#include #include "olp/dataservice/write/model/Partitions.h" #include namespace olp { namespace parser { -void from_json(const rapidjson::Value& value, +void from_json(const boost::json::value& value, olp::dataservice::write::model::Partition& x); -void from_json(const rapidjson::Value& value, +void from_json(const boost::json::value& value, olp::dataservice::write::model::Partitions& x); } // namespace parser diff --git a/olp-cpp-sdk-dataservice-write/src/generated/parser/PartitionsParser.cpp b/olp-cpp-sdk-dataservice-write/src/generated/parser/PartitionsParser.cpp index 8e3420373..3ca081962 100644 --- a/olp-cpp-sdk-dataservice-write/src/generated/parser/PartitionsParser.cpp +++ b/olp-cpp-sdk-dataservice-write/src/generated/parser/PartitionsParser.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 HERE Europe B.V. + * Copyright (C) 2019-2026 HERE Europe B.V. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,13 +19,15 @@ #include "PartitionsParser.h" +#include + #include namespace olp { namespace parser { -namespace model = dataservice::write::model; +namespace model = olp::dataservice::write::model; -void from_json(const rapidjson::Value& value, model::Partition& x) { +void from_json(const boost::json::value& value, model::Partition& x) { x.SetChecksum(parse>(value, "checksum")); x.SetCompressedDataSize( parse>(value, "compressedDataSize")); @@ -35,7 +37,7 @@ void from_json(const rapidjson::Value& value, model::Partition& x) { x.SetVersion(parse>(value, "version")); } -void from_json(const rapidjson::Value& value, model::Partitions& x) { +void from_json(const boost::json::value& value, model::Partitions& x) { x.SetPartitions(parse>(value, "partitions")); } diff --git a/olp-cpp-sdk-dataservice-write/src/generated/parser/PartitionsParser.h b/olp-cpp-sdk-dataservice-write/src/generated/parser/PartitionsParser.h index 9f45ba291..04db33058 100644 --- a/olp-cpp-sdk-dataservice-write/src/generated/parser/PartitionsParser.h +++ b/olp-cpp-sdk-dataservice-write/src/generated/parser/PartitionsParser.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 HERE Europe B.V. + * Copyright (C) 2019-2026 HERE Europe B.V. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,17 +19,17 @@ #pragma once -#include +#include #include "generated/model/Partitions.h" #include namespace olp { namespace parser { -void from_json(const rapidjson::Value& value, +void from_json(const boost::json::value& value, olp::dataservice::write::model::Partition& x); -void from_json(const rapidjson::Value& value, +void from_json(const boost::json::value& value, olp::dataservice::write::model::Partitions& x); } // namespace parser diff --git a/olp-cpp-sdk-dataservice-write/src/generated/parser/PublicationParser.cpp b/olp-cpp-sdk-dataservice-write/src/generated/parser/PublicationParser.cpp index 2eff59a0d..cf5e217e9 100644 --- a/olp-cpp-sdk-dataservice-write/src/generated/parser/PublicationParser.cpp +++ b/olp-cpp-sdk-dataservice-write/src/generated/parser/PublicationParser.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 HERE Europe B.V. + * Copyright (C) 2019-2026 HERE Europe B.V. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,6 +19,9 @@ #include "PublicationParser.h" +#include +#include + // clang-format off #include #include @@ -27,7 +30,7 @@ namespace olp { namespace parser { -void from_json(const rapidjson::Value& value, +void from_json(const boost::json::value& value, olp::dataservice::write::model::Publication& x) { x.SetId(parse(value, "id")); x.SetDetails( diff --git a/olp-cpp-sdk-dataservice-write/src/generated/parser/PublicationParser.h b/olp-cpp-sdk-dataservice-write/src/generated/parser/PublicationParser.h index eb2f67a69..1edeaa216 100644 --- a/olp-cpp-sdk-dataservice-write/src/generated/parser/PublicationParser.h +++ b/olp-cpp-sdk-dataservice-write/src/generated/parser/PublicationParser.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 HERE Europe B.V. + * Copyright (C) 2019-2026 HERE Europe B.V. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,13 +19,13 @@ #pragma once -#include +#include #include namespace olp { namespace parser { -void from_json(const rapidjson::Value& value, +void from_json(const boost::json::value& value, dataservice::write::model::Publication& x); } // namespace parser } // namespace olp diff --git a/olp-cpp-sdk-dataservice-write/src/generated/parser/PublishDataRequestParser.cpp b/olp-cpp-sdk-dataservice-write/src/generated/parser/PublishDataRequestParser.cpp index 45f514774..b3f330fb9 100644 --- a/olp-cpp-sdk-dataservice-write/src/generated/parser/PublishDataRequestParser.cpp +++ b/olp-cpp-sdk-dataservice-write/src/generated/parser/PublishDataRequestParser.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 HERE Europe B.V. + * Copyright (C) 2019-2026 HERE Europe B.V. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,13 +19,17 @@ #include "PublishDataRequestParser.h" +#include +#include +#include + // clang-format off #include // clang-format on namespace olp { namespace parser { -void from_json(const rapidjson::Value& value, +void from_json(const boost::json::value& value, olp::dataservice::write::model::PublishDataRequest& x) { x.WithData( (parse>>(value, "data"))); diff --git a/olp-cpp-sdk-dataservice-write/src/generated/parser/PublishDataRequestParser.h b/olp-cpp-sdk-dataservice-write/src/generated/parser/PublishDataRequestParser.h index 7dd60e032..abf7e89d9 100644 --- a/olp-cpp-sdk-dataservice-write/src/generated/parser/PublishDataRequestParser.h +++ b/olp-cpp-sdk-dataservice-write/src/generated/parser/PublishDataRequestParser.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 HERE Europe B.V. + * Copyright (C) 2019-2026 HERE Europe B.V. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,13 +19,13 @@ #pragma once -#include +#include #include namespace olp { namespace parser { -void from_json(const rapidjson::Value& value, +void from_json(const boost::json::value& value, dataservice::write::model::PublishDataRequest& x); } // namespace parser } // namespace olp diff --git a/olp-cpp-sdk-dataservice-write/src/generated/parser/PublishPartitionParser.cpp b/olp-cpp-sdk-dataservice-write/src/generated/parser/PublishPartitionParser.cpp index 4e4b620af..6ea93e7d7 100644 --- a/olp-cpp-sdk-dataservice-write/src/generated/parser/PublishPartitionParser.cpp +++ b/olp-cpp-sdk-dataservice-write/src/generated/parser/PublishPartitionParser.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 HERE Europe B.V. + * Copyright (C) 2019-2026 HERE Europe B.V. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,11 +19,15 @@ #include "PublishPartitionParser.h" +#include +#include +#include + #include namespace olp { namespace parser { -void from_json(const rapidjson::Value& value, +void from_json(const boost::json::value& value, olp::dataservice::write::model::PublishPartition& x) { x.SetPartition(parse(value, "partition")); x.SetChecksum(parse(value, "checksum")); diff --git a/olp-cpp-sdk-dataservice-write/src/generated/parser/PublishPartitionParser.h b/olp-cpp-sdk-dataservice-write/src/generated/parser/PublishPartitionParser.h index 80ad26a18..b0b6e469b 100644 --- a/olp-cpp-sdk-dataservice-write/src/generated/parser/PublishPartitionParser.h +++ b/olp-cpp-sdk-dataservice-write/src/generated/parser/PublishPartitionParser.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 HERE Europe B.V. + * Copyright (C) 2019-2026 HERE Europe B.V. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,13 +19,13 @@ #pragma once -#include +#include #include "generated/model/PublishPartition.h" namespace olp { namespace parser { -void from_json(const rapidjson::Value& value, +void from_json(const boost::json::value& value, dataservice::write::model::PublishPartition& x); } // namespace parser } // namespace olp diff --git a/olp-cpp-sdk-dataservice-write/src/generated/parser/PublishPartitionsParser.cpp b/olp-cpp-sdk-dataservice-write/src/generated/parser/PublishPartitionsParser.cpp index 77fa92dcd..3fc02cc55 100644 --- a/olp-cpp-sdk-dataservice-write/src/generated/parser/PublishPartitionsParser.cpp +++ b/olp-cpp-sdk-dataservice-write/src/generated/parser/PublishPartitionsParser.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 HERE Europe B.V. + * Copyright (C) 2019-2026 HERE Europe B.V. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,6 +19,8 @@ #include "PublishPartitionsParser.h" +#include + // clang-format off #include #include @@ -26,7 +28,7 @@ namespace olp { namespace parser { -void from_json(const rapidjson::Value& value, +void from_json(const boost::json::value& value, olp::dataservice::write::model::PublishPartitions& x) { x.SetPartitions( parse>( diff --git a/olp-cpp-sdk-dataservice-write/src/generated/parser/PublishPartitionsParser.h b/olp-cpp-sdk-dataservice-write/src/generated/parser/PublishPartitionsParser.h index c7b02a402..abc403199 100644 --- a/olp-cpp-sdk-dataservice-write/src/generated/parser/PublishPartitionsParser.h +++ b/olp-cpp-sdk-dataservice-write/src/generated/parser/PublishPartitionsParser.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 HERE Europe B.V. + * Copyright (C) 2019-2026 HERE Europe B.V. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,13 +19,13 @@ #pragma once -#include +#include #include "generated/model/PublishPartitions.h" namespace olp { namespace parser { -void from_json(const rapidjson::Value& value, +void from_json(const boost::json::value& value, dataservice::write::model::PublishPartitions& x); } // namespace parser } // namespace olp diff --git a/olp-cpp-sdk-dataservice-write/src/generated/parser/ResponseOkParser.cpp b/olp-cpp-sdk-dataservice-write/src/generated/parser/ResponseOkParser.cpp index 77a770f1e..4bc409ad2 100644 --- a/olp-cpp-sdk-dataservice-write/src/generated/parser/ResponseOkParser.cpp +++ b/olp-cpp-sdk-dataservice-write/src/generated/parser/ResponseOkParser.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 HERE Europe B.V. + * Copyright (C) 2019-2026 HERE Europe B.V. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,19 +19,22 @@ #include "ResponseOkParser.h" +#include +#include + #include -using namespace olp::dataservice::write::model; +namespace model = olp::dataservice::write::model; namespace olp { namespace parser { -void from_json(const rapidjson::Value& value, TraceID& x) { +void from_json(const boost::json::value& value, model::TraceID& x) { x.SetParentID(parse(value, "ParentID")); x.SetGeneratedIDs(parse >(value, "GeneratedIDs")); } -void from_json(const rapidjson::Value& value, ResponseOk& x) { - x.SetTraceID(parse(value, "TraceID")); +void from_json(const boost::json::value& value, model::ResponseOk& x) { + x.SetTraceID(parse(value, "TraceID")); } } // namespace parser diff --git a/olp-cpp-sdk-dataservice-write/src/generated/parser/ResponseOkParser.h b/olp-cpp-sdk-dataservice-write/src/generated/parser/ResponseOkParser.h index f545cd854..f4b752aac 100644 --- a/olp-cpp-sdk-dataservice-write/src/generated/parser/ResponseOkParser.h +++ b/olp-cpp-sdk-dataservice-write/src/generated/parser/ResponseOkParser.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 HERE Europe B.V. + * Copyright (C) 2019-2026 HERE Europe B.V. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,16 +19,16 @@ #pragma once -#include +#include #include namespace olp { namespace parser { -void from_json(const rapidjson::Value& value, +void from_json(const boost::json::value& value, dataservice::write::model::TraceID& x); -void from_json(const rapidjson::Value& value, +void from_json(const boost::json::value& value, dataservice::write::model::ResponseOk& x); } // namespace parser diff --git a/olp-cpp-sdk-dataservice-write/src/generated/parser/ResponseOkSingleParser.cpp b/olp-cpp-sdk-dataservice-write/src/generated/parser/ResponseOkSingleParser.cpp index 3ee2b9a09..7d171d2c2 100644 --- a/olp-cpp-sdk-dataservice-write/src/generated/parser/ResponseOkSingleParser.cpp +++ b/olp-cpp-sdk-dataservice-write/src/generated/parser/ResponseOkSingleParser.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 HERE Europe B.V. + * Copyright (C) 2019-2026 HERE Europe B.V. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,11 +19,13 @@ #include "ResponseOkSingleParser.h" +#include + #include namespace olp { namespace parser { -void from_json(const rapidjson::Value& value, +void from_json(const boost::json::value& value, dataservice::write::model::ResponseOkSingle& x) { x.SetTraceID(parse(value, "TraceID")); } diff --git a/olp-cpp-sdk-dataservice-write/src/generated/parser/ResponseOkSingleParser.h b/olp-cpp-sdk-dataservice-write/src/generated/parser/ResponseOkSingleParser.h index 96b463708..1b14212d3 100644 --- a/olp-cpp-sdk-dataservice-write/src/generated/parser/ResponseOkSingleParser.h +++ b/olp-cpp-sdk-dataservice-write/src/generated/parser/ResponseOkSingleParser.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 HERE Europe B.V. + * Copyright (C) 2019-2026 HERE Europe B.V. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,13 +19,13 @@ #pragma once -#include +#include #include namespace olp { namespace parser { -void from_json(const rapidjson::Value& value, +void from_json(const boost::json::value& value, dataservice::write::model::ResponseOkSingle& x); } // namespace parser diff --git a/olp-cpp-sdk-dataservice-write/src/generated/parser/VersionDependencyParser.cpp b/olp-cpp-sdk-dataservice-write/src/generated/parser/VersionDependencyParser.cpp index c5992657f..f0ec5cdc0 100644 --- a/olp-cpp-sdk-dataservice-write/src/generated/parser/VersionDependencyParser.cpp +++ b/olp-cpp-sdk-dataservice-write/src/generated/parser/VersionDependencyParser.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 HERE Europe B.V. + * Copyright (C) 2019-2026 HERE Europe B.V. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,11 +19,13 @@ #include "VersionDependencyParser.h" +#include + #include namespace olp { namespace parser { -void from_json(const rapidjson::Value& value, +void from_json(const boost::json::value& value, olp::dataservice::write::model::VersionDependency& x) { x.SetDirect(parse(value, "direct")); x.SetHrn(parse(value, "hrn")); diff --git a/olp-cpp-sdk-dataservice-write/src/generated/parser/VersionDependencyParser.h b/olp-cpp-sdk-dataservice-write/src/generated/parser/VersionDependencyParser.h index 7a69b4105..c7d606823 100644 --- a/olp-cpp-sdk-dataservice-write/src/generated/parser/VersionDependencyParser.h +++ b/olp-cpp-sdk-dataservice-write/src/generated/parser/VersionDependencyParser.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 HERE Europe B.V. + * Copyright (C) 2019-2026 HERE Europe B.V. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,13 +19,13 @@ #pragma once -#include +#include #include namespace olp { namespace parser { -void from_json(const rapidjson::Value& value, +void from_json(const boost::json::value& value, dataservice::write::model::VersionDependency& x); } // namespace parser } // namespace olp diff --git a/olp-cpp-sdk-dataservice-write/src/generated/parser/VersionResponseParser.cpp b/olp-cpp-sdk-dataservice-write/src/generated/parser/VersionResponseParser.cpp index 723463a62..f093028b2 100644 --- a/olp-cpp-sdk-dataservice-write/src/generated/parser/VersionResponseParser.cpp +++ b/olp-cpp-sdk-dataservice-write/src/generated/parser/VersionResponseParser.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 HERE Europe B.V. + * Copyright (C) 2019-2026 HERE Europe B.V. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,9 +23,9 @@ namespace olp { namespace parser { -using namespace olp::dataservice::write; +namespace model = olp::dataservice::write::model; -void from_json(const rapidjson::Value& value, model::VersionResponse& x) { +void from_json(const boost::json::value& value, model::VersionResponse& x) { x.SetVersion(parse(value, "version")); } diff --git a/olp-cpp-sdk-dataservice-write/src/generated/parser/VersionResponseParser.h b/olp-cpp-sdk-dataservice-write/src/generated/parser/VersionResponseParser.h index f24794631..6d26573bc 100644 --- a/olp-cpp-sdk-dataservice-write/src/generated/parser/VersionResponseParser.h +++ b/olp-cpp-sdk-dataservice-write/src/generated/parser/VersionResponseParser.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 HERE Europe B.V. + * Copyright (C) 2019-2026 HERE Europe B.V. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,14 +19,14 @@ #pragma once -#include +#include #include "olp/dataservice/write/model/VersionResponse.h" #include namespace olp { namespace parser { -void from_json(const rapidjson::Value& value, +void from_json(const boost::json::value& value, olp::dataservice::write::model::VersionResponse& x); } // namespace parser diff --git a/olp-cpp-sdk-dataservice-write/src/generated/serializer/ApiSerializer.cpp b/olp-cpp-sdk-dataservice-write/src/generated/serializer/ApiSerializer.cpp index 3e14d9a14..8a0f90c31 100644 --- a/olp-cpp-sdk-dataservice-write/src/generated/serializer/ApiSerializer.cpp +++ b/olp-cpp-sdk-dataservice-write/src/generated/serializer/ApiSerializer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2020 HERE Europe B.V. + * Copyright (C) 2020-2026 HERE Europe B.V. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,7 +17,7 @@ * License-Filename: LICENSE */ -#include +#include #include "ApiSerializer.h" @@ -25,13 +25,13 @@ namespace olp { namespace serializer { -void to_json(const dataservice::write::model::Api& x, rapidjson::Value& value, - rapidjson::Document::AllocatorType& allocator) { - value.SetObject(); - serialize("api", x.GetApi(), value, allocator); - serialize("version", x.GetVersion(), value, allocator); - serialize("baseURL", x.GetBaseUrl(), value, allocator); - serialize("parameters", x.GetParameters(), value, allocator); +void to_json(const dataservice::write::model::Api& x, + boost::json::value& value) { + auto& object = value.emplace_object(); + serialize("api", x.GetApi(), object); + serialize("version", x.GetVersion(), object); + serialize("baseURL", x.GetBaseUrl(), object); + serialize("parameters", x.GetParameters(), object); } } // namespace serializer } // namespace olp diff --git a/olp-cpp-sdk-dataservice-write/src/generated/serializer/ApiSerializer.h b/olp-cpp-sdk-dataservice-write/src/generated/serializer/ApiSerializer.h index 57ad803f3..a36962d04 100644 --- a/olp-cpp-sdk-dataservice-write/src/generated/serializer/ApiSerializer.h +++ b/olp-cpp-sdk-dataservice-write/src/generated/serializer/ApiSerializer.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2020 HERE Europe B.V. + * Copyright (C) 2020-2026 HERE Europe B.V. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,14 +21,13 @@ #include -#include +#include #include "generated/model/Api.h" namespace olp { namespace serializer { void to_json(const dataservice::write::model::Api& x, - rapidjson::Value& value, - rapidjson::Document::AllocatorType& allocator); + boost::json::value& value); } // namespace serializer } // namespace olp diff --git a/olp-cpp-sdk-dataservice-write/src/generated/serializer/CatalogSerializer.cpp b/olp-cpp-sdk-dataservice-write/src/generated/serializer/CatalogSerializer.cpp index ed6cf3643..dfa547660 100644 --- a/olp-cpp-sdk-dataservice-write/src/generated/serializer/CatalogSerializer.cpp +++ b/olp-cpp-sdk-dataservice-write/src/generated/serializer/CatalogSerializer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019-2021 HERE Europe B.V. + * Copyright (C) 2019-2026 HERE Europe B.V. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,7 +17,7 @@ * License-Filename: LICENSE */ -#include +#include #include "CatalogSerializer.h" @@ -26,133 +26,120 @@ namespace olp { namespace serializer { void to_json(const dataservice::write::model::Coverage& x, - rapidjson::Value& value, - rapidjson::Document::AllocatorType& allocator) { - value.SetObject(); - serialize("adminAreas", x.GetAdminAreas(), value, allocator); + boost::json::value& value) { + auto& object = value.emplace_object(); + serialize("adminAreas", x.GetAdminAreas(), object); } void to_json(const dataservice::write::model::IndexDefinition& x, - rapidjson::Value& value, - rapidjson::Document::AllocatorType& allocator) { - value.SetObject(); - serialize("name", x.GetName(), value, allocator); - serialize("type", x.GetType(), value, allocator); - serialize("duration", x.GetDuration(), value, allocator); - serialize("zoomLevel", x.GetZoomLevel(), value, allocator); + boost::json::value& value) { + auto& object = value.emplace_object(); + serialize("name", x.GetName(), object); + serialize("type", x.GetType(), object); + serialize("duration", x.GetDuration(), object); + serialize("zoomLevel", x.GetZoomLevel(), object); } void to_json(const dataservice::write::model::IndexProperties& x, - rapidjson::Value& value, - rapidjson::Document::AllocatorType& allocator) { - value.SetObject(); - serialize("ttl", x.GetTtl(), value, allocator); - serialize("indexDefinitions", x.GetIndexDefinitions(), value, allocator); + boost::json::value& value) { + auto& object = value.emplace_object(); + serialize("ttl", x.GetTtl(), object); + serialize("indexDefinitions", x.GetIndexDefinitions(), object); } void to_json(const dataservice::write::model::Creator& x, - rapidjson::Value& value, - rapidjson::Document::AllocatorType& allocator) { - value.SetObject(); - serialize("id", x.GetId(), value, allocator); + boost::json::value& value) { + auto& object = value.emplace_object(); + serialize("id", x.GetId(), object); } -void to_json(const dataservice::write::model::Owner& x, rapidjson::Value& value, - rapidjson::Document::AllocatorType& allocator) { - value.SetObject(); - serialize("creator", x.GetCreator(), value, allocator); - serialize("organisation", x.GetOrganisation(), value, allocator); +void to_json(const dataservice::write::model::Owner& x, + boost::json::value& value) { + auto& object = value.emplace_object(); + serialize("creator", x.GetCreator(), object); + serialize("organisation", x.GetOrganisation(), object); } void to_json(const dataservice::write::model::Partitioning& x, - rapidjson::Value& value, - rapidjson::Document::AllocatorType& allocator) { - value.SetObject(); - serialize("scheme", x.GetScheme(), value, allocator); - serialize("tileLevels", x.GetTileLevels(), value, allocator); + boost::json::value& value) { + auto& object = value.emplace_object(); + serialize("scheme", x.GetScheme(), object); + serialize("tileLevels", x.GetTileLevels(), object); } void to_json(const dataservice::write::model::Schema& x, - rapidjson::Value& value, - rapidjson::Document::AllocatorType& allocator) { - value.SetObject(); - serialize("hrn", x.GetHrn(), value, allocator); + boost::json::value& value) { + auto& object = value.emplace_object(); + serialize("hrn", x.GetHrn(), object); } void to_json(const dataservice::write::model::StreamProperties& x, - rapidjson::Value& value, - rapidjson::Document::AllocatorType& allocator) { - value.SetObject(); - serialize("dataInThroughputMbps", x.GetDataInThroughputMbps(), value, - allocator); - serialize("dataOutThroughputMbps", x.GetDataOutThroughputMbps(), value, - allocator); + boost::json::value& value) { + auto& object = value.emplace_object(); + serialize("dataInThroughputMbps", x.GetDataInThroughputMbps(), object); + serialize("dataOutThroughputMbps", x.GetDataOutThroughputMbps(), object); } void to_json(const dataservice::write::model::Encryption& x, - rapidjson::Value& value, - rapidjson::Document::AllocatorType& allocator) { - value.SetObject(); - serialize("algorithm", x.GetAlgorithm(), value, allocator); + boost::json::value& value) { + auto& object = value.emplace_object(); + serialize("algorithm", x.GetAlgorithm(), object); } void to_json(const dataservice::write::model::Volume& x, - rapidjson::Value& value, - rapidjson::Document::AllocatorType& allocator) { - value.SetObject(); - serialize("volumeType", x.GetVolumeType(), value, allocator); - serialize("maxMemoryPolicy", x.GetMaxMemoryPolicy(), value, allocator); - serialize("packageType", x.GetPackageType(), value, allocator); - serialize("encryption", x.GetEncryption(), value, allocator); + boost::json::value& value) { + auto& object = value.emplace_object(); + serialize("volumeType", x.GetVolumeType(), object); + serialize("maxMemoryPolicy", x.GetMaxMemoryPolicy(), object); + serialize("packageType", x.GetPackageType(), object); + serialize("encryption", x.GetEncryption(), object); } -void to_json(const dataservice::write::model::Layer& x, rapidjson::Value& value, - rapidjson::Document::AllocatorType& allocator) { - value.SetObject(); - serialize("id", x.GetId(), value, allocator); - serialize("name", x.GetName(), value, allocator); - serialize("summary", x.GetSummary(), value, allocator); - serialize("description", x.GetDescription(), value, allocator); - serialize("owner", x.GetOwner(), value, allocator); - serialize("coverage", x.GetCoverage(), value, allocator); - serialize("schema", x.GetSchema(), value, allocator); - serialize("contentType", x.GetContentType(), value, allocator); - serialize("contentEncoding", x.GetContentEncoding(), value, allocator); - serialize("partitioning", x.GetPartitioning(), value, allocator); - serialize("layerType", x.GetLayerType(), value, allocator); - serialize("digest", x.GetDigest(), value, allocator); - serialize("tags", x.GetTags(), value, allocator); - serialize("billingTags", x.GetBillingTags(), value, allocator); - serialize("ttl", x.GetTtl(), value, allocator); - serialize("indexProperties", x.GetIndexProperties(), value, allocator); - serialize("streamProperties", x.GetStreamProperties(), value, allocator); - serialize("volume", x.GetVolume(), value, allocator); +void to_json(const dataservice::write::model::Layer& x, + boost::json::value& value) { + auto& object = value.emplace_object(); + serialize("id", x.GetId(), object); + serialize("name", x.GetName(), object); + serialize("summary", x.GetSummary(), object); + serialize("description", x.GetDescription(), object); + serialize("owner", x.GetOwner(), object); + serialize("coverage", x.GetCoverage(), object); + serialize("schema", x.GetSchema(), object); + serialize("contentType", x.GetContentType(), object); + serialize("contentEncoding", x.GetContentEncoding(), object); + serialize("partitioning", x.GetPartitioning(), object); + serialize("layerType", x.GetLayerType(), object); + serialize("digest", x.GetDigest(), object); + serialize("tags", x.GetTags(), object); + serialize("billingTags", x.GetBillingTags(), object); + serialize("ttl", x.GetTtl(), object); + serialize("indexProperties", x.GetIndexProperties(), object); + serialize("streamProperties", x.GetStreamProperties(), object); + serialize("volume", x.GetVolume(), object); } void to_json(const dataservice::write::model::Notifications& x, - rapidjson::Value& value, - rapidjson::Document::AllocatorType& allocator) { - value.SetObject(); - serialize("enabled", x.GetEnabled(), value, allocator); + boost::json::value& value) { + auto& object = value.emplace_object(); + serialize("enabled", x.GetEnabled(), object); } void to_json(const dataservice::write::model::Catalog& x, - rapidjson::Value& value, - rapidjson::Document::AllocatorType& allocator) { - value.SetObject(); - serialize("id", x.GetId(), value, allocator); - serialize("hrn", x.GetHrn(), value, allocator); - serialize("name", x.GetName(), value, allocator); - serialize("summary", x.GetSummary(), value, allocator); - serialize("description", x.GetDescription(), value, allocator); - serialize("coverage", x.GetCoverage(), value, allocator); - serialize("owner", x.GetOwner(), value, allocator); - serialize("tags", x.GetTags(), value, allocator); - serialize("billingTags", x.GetBillingTags(), value, allocator); - serialize("created", x.GetCreated(), value, allocator); - serialize("layers", x.GetLayers(), value, allocator); - serialize("version", x.GetVersion(), value, allocator); - serialize("notifications", x.GetNotifications(), value, allocator); + boost::json::value& value) { + auto& object = value.emplace_object(); + serialize("id", x.GetId(), object); + serialize("hrn", x.GetHrn(), object); + serialize("name", x.GetName(), object); + serialize("summary", x.GetSummary(), object); + serialize("description", x.GetDescription(), object); + serialize("coverage", x.GetCoverage(), object); + serialize("owner", x.GetOwner(), object); + serialize("tags", x.GetTags(), object); + serialize("billingTags", x.GetBillingTags(), object); + serialize("created", x.GetCreated(), object); + serialize("layers", x.GetLayers(), object); + serialize("version", x.GetVersion(), object); + serialize("notifications", x.GetNotifications(), object); } } // namespace serializer diff --git a/olp-cpp-sdk-dataservice-write/src/generated/serializer/CatalogSerializer.h b/olp-cpp-sdk-dataservice-write/src/generated/serializer/CatalogSerializer.h index 934b6f516..dab097e47 100644 --- a/olp-cpp-sdk-dataservice-write/src/generated/serializer/CatalogSerializer.h +++ b/olp-cpp-sdk-dataservice-write/src/generated/serializer/CatalogSerializer.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019-2021 HERE Europe B.V. + * Copyright (C) 2019-2026 HERE Europe B.V. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,61 +19,50 @@ #pragma once -#include +#include #include "../model/Catalog.h" namespace olp { namespace serializer { void to_json(const dataservice::write::model::Coverage& x, - rapidjson::Value& value, - rapidjson::Document::AllocatorType& allocator); + boost::json::value& value); void to_json(const dataservice::write::model::IndexDefinition& x, - rapidjson::Value& value, - rapidjson::Document::AllocatorType& allocator); + boost::json::value& value); void to_json(const dataservice::write::model::IndexProperties& x, - rapidjson::Value& value, - rapidjson::Document::AllocatorType& allocator); + boost::json::value& value); void to_json(const dataservice::write::model::Creator& x, - rapidjson::Value& value, - rapidjson::Document::AllocatorType& allocator); + boost::json::value& value); -void to_json(const dataservice::write::model::Owner& x, rapidjson::Value& value, - rapidjson::Document::AllocatorType& allocator); +void to_json(const dataservice::write::model::Owner& x, + boost::json::value& value); void to_json(const dataservice::write::model::Partitioning& x, - rapidjson::Value& value, - rapidjson::Document::AllocatorType& allocator); + boost::json::value& value); void to_json(const dataservice::write::model::Schema& x, - rapidjson::Value& value, - rapidjson::Document::AllocatorType& allocator); + boost::json::value& value); void to_json(const dataservice::write::model::StreamProperties& x, - rapidjson::Value& value, - rapidjson::Document::AllocatorType& allocator); + boost::json::value& value); void to_json(const dataservice::write::model::Encryption& x, - rapidjson::Value& value, - rapidjson::Document::AllocatorType& allocator); + boost::json::value& value); void to_json(const dataservice::write::model::Volume& x, - rapidjson::Value& value, - rapidjson::Document::AllocatorType& allocator); + boost::json::value& value); -void to_json(const dataservice::write::model::Layer& x, rapidjson::Value& value, - rapidjson::Document::AllocatorType& allocator); +void to_json(const dataservice::write::model::Layer& x, + boost::json::value& value); void to_json(const dataservice::write::model::Notifications& x, - rapidjson::Value& value, - rapidjson::Document::AllocatorType& allocator); + boost::json::value& value); void to_json(const dataservice::write::model::Catalog& x, - rapidjson::Value& value, - rapidjson::Document::AllocatorType& allocator); + boost::json::value& value); } // namespace serializer } // namespace olp diff --git a/olp-cpp-sdk-dataservice-write/src/generated/serializer/IndexInfoSerializer.cpp b/olp-cpp-sdk-dataservice-write/src/generated/serializer/IndexInfoSerializer.cpp index f95c7a0f7..820d2fdbf 100644 --- a/olp-cpp-sdk-dataservice-write/src/generated/serializer/IndexInfoSerializer.cpp +++ b/olp-cpp-sdk-dataservice-write/src/generated/serializer/IndexInfoSerializer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019-2021 HERE Europe B.V. + * Copyright (C) 2019-2026 HERE Europe B.V. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,71 +19,59 @@ #include "IndexInfoSerializer.h" +#include + namespace olp { namespace serializer { -void to_json(const dataservice::write::model::Index &x, rapidjson::Value &value, - rapidjson::Document::AllocatorType &allocator) { - rapidjson::Value jsonValue(rapidjson::kObjectType); - value.SetArray(); - jsonValue.AddMember("id", rapidjson::StringRef(x.GetId().c_str()), allocator); +void to_json(const dataservice::write::model::Index &x, + boost::json::value &value) { + boost::json::object jsonValue; + value.emplace_array(); + jsonValue.emplace("id", x.GetId()); - rapidjson::Value indexFields(rapidjson::kObjectType); + boost::json::object indexFields; for (auto &field_pair : x.GetIndexFields()) { - using dataservice::write::model::BooleanIndexValue; - using dataservice::write::model::HereTileIndexValue; - using dataservice::write::model::IndexType; - using dataservice::write::model::IntIndexValue; - using dataservice::write::model::StringIndexValue; - using dataservice::write::model::TimeWindowIndexValue; - + namespace model = dataservice::write::model; const auto &field = field_pair.second; - const auto key = rapidjson::StringRef(field_pair.first.c_str()); + const auto &key = field_pair.first; auto index_type = field->getIndexType(); - if (index_type == IndexType::String) { - auto s = std::static_pointer_cast(field); - rapidjson::Value str_val; - const auto &str = s->GetValue(); - str_val.SetString( - str.c_str(), static_cast(str.size()), allocator); - indexFields.AddMember(key, str_val, allocator); - } else if (index_type == IndexType::Int) { - auto s = std::static_pointer_cast(field); - indexFields.AddMember(key, s->GetValue(), allocator); - } else if (index_type == IndexType::Bool) { - auto s = std::static_pointer_cast(field); - indexFields.AddMember(key, s->GetValue(), allocator); - } else if (index_type == IndexType::Heretile) { - auto s = std::static_pointer_cast(field); - indexFields.AddMember(key, s->GetValue(), allocator); - } else if (index_type == IndexType::TimeWindow) { - auto s = std::static_pointer_cast(field); - indexFields.AddMember(key, s->GetValue(), allocator); + if (index_type == model::IndexType::String) { + auto s = std::static_pointer_cast(field); + boost::json::string str_val{s->GetValue()}; + indexFields.emplace(key, std::move(str_val)); + } else if (index_type == model::IndexType::Int) { + auto s = std::static_pointer_cast(field); + indexFields.emplace(key, s->GetValue()); + } else if (index_type == model::IndexType::Bool) { + auto s = std::static_pointer_cast(field); + indexFields.emplace(key, s->GetValue()); + } else if (index_type == model::IndexType::Heretile) { + auto s = std::static_pointer_cast(field); + indexFields.emplace(key, s->GetValue()); + } else if (index_type == model::IndexType::TimeWindow) { + auto s = std::static_pointer_cast(field); + indexFields.emplace(key, s->GetValue()); } } - jsonValue.AddMember("fields", indexFields, allocator); + jsonValue.emplace("fields", std::move(indexFields)); // TODO: Separate Metadata Model serialization into its own file when needed // by another model. if (x.GetMetadata()) { - rapidjson::Value metadatas(rapidjson::kObjectType); - for (const auto &metadata : *x.GetMetadata()) { - auto metadata_value = metadata.second; - auto metadata_key = metadata.first.c_str(); - indexFields.AddMember( - rapidjson::StringRef(metadata_key), - rapidjson::StringRef(metadata_value.c_str(), metadata_value.size()), - allocator); + for (auto &metadata : x.GetMetadata().get()) { + auto &metadata_value = metadata.second; + auto &metadata_key = metadata.first; + indexFields.emplace(metadata_key, metadata_value); } } if (x.GetCheckSum()) { - jsonValue.AddMember( - "checksum", rapidjson::StringRef(x.GetCheckSum()->c_str()), allocator); + jsonValue.emplace("checksum", x.GetCheckSum().get()); } if (x.GetSize()) { - jsonValue.AddMember("size", *x.GetSize(), allocator); + jsonValue.emplace("size", x.GetSize().get()); } - value.PushBack(jsonValue, allocator); + value.as_array().emplace_back(std::move(jsonValue)); } } // namespace serializer diff --git a/olp-cpp-sdk-dataservice-write/src/generated/serializer/IndexInfoSerializer.h b/olp-cpp-sdk-dataservice-write/src/generated/serializer/IndexInfoSerializer.h index e7732b763..b44fdc47f 100644 --- a/olp-cpp-sdk-dataservice-write/src/generated/serializer/IndexInfoSerializer.h +++ b/olp-cpp-sdk-dataservice-write/src/generated/serializer/IndexInfoSerializer.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 HERE Europe B.V. + * Copyright (C) 2019-2026 HERE Europe B.V. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,13 +19,13 @@ #pragma once -#include +#include #include namespace olp { namespace serializer { -void to_json(const dataservice::write::model::Index& x, rapidjson::Value& value, - rapidjson::Document::AllocatorType& allocator); +void to_json(const dataservice::write::model::Index& x, + boost::json::value& value); } // namespace serializer } // namespace olp diff --git a/olp-cpp-sdk-dataservice-write/src/generated/serializer/JsonSerializer.h b/olp-cpp-sdk-dataservice-write/src/generated/serializer/JsonSerializer.h index 504c6c12a..3d6915c0e 100644 --- a/olp-cpp-sdk-dataservice-write/src/generated/serializer/JsonSerializer.h +++ b/olp-cpp-sdk-dataservice-write/src/generated/serializer/JsonSerializer.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 HERE Europe B.V. + * Copyright (C) 2019-2026 HERE Europe B.V. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,24 +19,19 @@ #pragma once -#include -#include -#include +#include + +#include +#include namespace olp { namespace serializer { template inline std::string serialize(const T& object) { - rapidjson::Document doc; - auto& allocator = doc.GetAllocator(); - - doc.SetObject(); - to_json(object, doc, allocator); - - rapidjson::StringBuffer buffer; - rapidjson::Writer writer(buffer); - doc.Accept(writer); - return buffer.GetString(); + boost::json::value value; + value.emplace_object(); + to_json(object, value); + return boost::json::serialize(value); } } // namespace serializer diff --git a/olp-cpp-sdk-dataservice-write/src/generated/serializer/PublicationSerializer.cpp b/olp-cpp-sdk-dataservice-write/src/generated/serializer/PublicationSerializer.cpp index ee1df67fa..1c73d48ff 100644 --- a/olp-cpp-sdk-dataservice-write/src/generated/serializer/PublicationSerializer.cpp +++ b/olp-cpp-sdk-dataservice-write/src/generated/serializer/PublicationSerializer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 HERE Europe B.V. + * Copyright (C) 2019-2026 HERE Europe B.V. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,59 +19,54 @@ #include "PublicationSerializer.h" +#include + namespace olp { namespace serializer { void to_json(const dataservice::write::model::Publication& x, - rapidjson::Value& value, - rapidjson::Document::AllocatorType& allocator) { + boost::json::value& value) { + auto& object = value.emplace_object(); if (x.GetId()) { - value.AddMember("id", rapidjson::StringRef(x.GetId()->c_str()), allocator); + object.emplace("id", x.GetId().get()); } // TODO: Separate Details Model serializtion into it's own file when needed by // another model. if (x.GetDetails()) { - rapidjson::Value details(rapidjson::kObjectType); - details.AddMember("state", - rapidjson::StringRef(x.GetDetails()->GetState().c_str()), - allocator); - details.AddMember( - "message", rapidjson::StringRef(x.GetDetails()->GetMessage().c_str()), - allocator); - details.AddMember("started", x.GetDetails()->GetStarted(), allocator); - details.AddMember("modified", x.GetDetails()->GetModified(), allocator); - details.AddMember("expires", x.GetDetails()->GetExpires(), allocator); - value.AddMember("details", details, allocator); + boost::json::object details; + details.emplace("state", x.GetDetails()->GetState()); + details.emplace("message", x.GetDetails()->GetMessage()); + details.emplace("started", x.GetDetails()->GetStarted()); + details.emplace("modified", x.GetDetails()->GetModified()); + details.emplace("expires", x.GetDetails()->GetExpires()); + object.emplace("details", std::move(details)); } if (x.GetLayerIds()) { - rapidjson::Value layer_ids(rapidjson::kArrayType); - for (auto& layer_id : *x.GetLayerIds()) { - layer_ids.PushBack(rapidjson::StringRef(layer_id.c_str()), allocator); + boost::json::array layer_ids; + for (auto& layer_id : x.GetLayerIds().get()) { + layer_ids.emplace_back(layer_id); } - value.AddMember("layerIds", layer_ids, allocator); + object.emplace("layerIds", std::move(layer_ids)); } if (x.GetCatalogVersion()) { - value.AddMember("catalogVersion", *x.GetCatalogVersion(), allocator); + object.emplace("catalogVersion", x.GetCatalogVersion().get()); } if (x.GetVersionDependencies()) { - rapidjson::Value version_dependencies(rapidjson::kArrayType); - for (auto& version_dependency : *x.GetVersionDependencies()) { + boost::json::array version_dependencies; + for (auto& version_dependency : x.GetVersionDependencies().get()) { // TODO: Separate VersionDependency Model serializtion into it's own file // when needed by another model. - rapidjson::Value version_dependency_json(rapidjson::kObjectType); - version_dependency_json.AddMember( - "direct", version_dependency.GetDirect(), allocator); - version_dependency_json.AddMember( - "hrn", rapidjson::StringRef(version_dependency.GetHrn().c_str()), - allocator); - version_dependency_json.AddMember( - "version", version_dependency.GetVersion(), allocator); - version_dependencies.PushBack(version_dependency_json, allocator); + boost::json::object version_dependency_json; + version_dependency_json.emplace("direct", version_dependency.GetDirect()); + version_dependency_json.emplace("hrn", version_dependency.GetHrn()); + version_dependency_json.emplace("version", + version_dependency.GetVersion()); + version_dependencies.emplace_back(std::move(version_dependency_json)); } - value.AddMember("versionDependencies", version_dependencies, allocator); + object.emplace("versionDependencies", std::move(version_dependencies)); } } diff --git a/olp-cpp-sdk-dataservice-write/src/generated/serializer/PublicationSerializer.h b/olp-cpp-sdk-dataservice-write/src/generated/serializer/PublicationSerializer.h index c00df9918..1e70410d9 100644 --- a/olp-cpp-sdk-dataservice-write/src/generated/serializer/PublicationSerializer.h +++ b/olp-cpp-sdk-dataservice-write/src/generated/serializer/PublicationSerializer.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 HERE Europe B.V. + * Copyright (C) 2019-2026 HERE Europe B.V. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,14 +19,13 @@ #pragma once -#include +#include #include namespace olp { namespace serializer { void to_json(const dataservice::write::model::Publication& x, - rapidjson::Value& value, - rapidjson::Document::AllocatorType& allocator); + boost::json::value& value); } // namespace serializer } // namespace olp diff --git a/olp-cpp-sdk-dataservice-write/src/generated/serializer/PublishDataRequestSerializer.cpp b/olp-cpp-sdk-dataservice-write/src/generated/serializer/PublishDataRequestSerializer.cpp index c23abe886..7f2669939 100644 --- a/olp-cpp-sdk-dataservice-write/src/generated/serializer/PublishDataRequestSerializer.cpp +++ b/olp-cpp-sdk-dataservice-write/src/generated/serializer/PublishDataRequestSerializer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 HERE Europe B.V. + * Copyright (C) 2019-2026 HERE Europe B.V. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -22,32 +22,27 @@ namespace olp { namespace serializer { void to_json(const dataservice::write::model::PublishDataRequest& x, - rapidjson::Value& value, - rapidjson::Document::AllocatorType& allocator) { + boost::json::value& value) { + auto& object = value.emplace_object(); if (x.GetData()) { const auto& data = x.GetData().get(); - auto data_stringref = rapidjson::StringRef( + auto data_stringref = boost::json::string_view( reinterpret_cast(data->data()), data->size()); - value.AddMember("data", std::move(data_stringref), allocator); + object.emplace("data", data_stringref); } - value.AddMember("layerId", rapidjson::StringRef(x.GetLayerId().c_str()), - allocator); + object.emplace("layerId", x.GetLayerId()); if (x.GetTraceId()) { - value.AddMember("traceId", rapidjson::StringRef(x.GetTraceId()->c_str()), - allocator); + object.emplace("traceId", x.GetTraceId().get()); } if (x.GetBillingTag()) { - value.AddMember("billingTag", - rapidjson::StringRef(x.GetBillingTag()->c_str()), - allocator); + object.emplace("billingTag", x.GetBillingTag().get()); } if (x.GetChecksum()) { - value.AddMember("checksum", rapidjson::StringRef(x.GetChecksum()->c_str()), - allocator); + object.emplace("checksum", x.GetChecksum().get()); } } diff --git a/olp-cpp-sdk-dataservice-write/src/generated/serializer/PublishDataRequestSerializer.h b/olp-cpp-sdk-dataservice-write/src/generated/serializer/PublishDataRequestSerializer.h index 687349e27..8609bebd3 100644 --- a/olp-cpp-sdk-dataservice-write/src/generated/serializer/PublishDataRequestSerializer.h +++ b/olp-cpp-sdk-dataservice-write/src/generated/serializer/PublishDataRequestSerializer.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 HERE Europe B.V. + * Copyright (C) 2019-2026 HERE Europe B.V. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,14 +19,13 @@ #pragma once -#include +#include #include namespace olp { namespace serializer { void to_json(const dataservice::write::model::PublishDataRequest& x, - rapidjson::Value& value, - rapidjson::Document::AllocatorType& allocator); + boost::json::value& value); } // namespace serializer } // namespace olp diff --git a/olp-cpp-sdk-dataservice-write/src/generated/serializer/PublishPartitionSerializer.cpp b/olp-cpp-sdk-dataservice-write/src/generated/serializer/PublishPartitionSerializer.cpp index 875fc73da..fc93a2ecc 100644 --- a/olp-cpp-sdk-dataservice-write/src/generated/serializer/PublishPartitionSerializer.cpp +++ b/olp-cpp-sdk-dataservice-write/src/generated/serializer/PublishPartitionSerializer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 HERE Europe B.V. + * Copyright (C) 2019-2026 HERE Europe B.V. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -22,42 +22,37 @@ namespace olp { namespace serializer { void to_json(const dataservice::write::model::PublishPartition& x, - rapidjson::Value& value, - rapidjson::Document::AllocatorType& allocator) { + boost::json::value& value) { + auto& object = value.emplace_object(); if (x.GetPartition()) { - value.AddMember("partition", - rapidjson::StringRef(x.GetPartition()->c_str()), allocator); + object.emplace("partition", x.GetPartition().get()); } if (x.GetChecksum()) { - value.AddMember("checksum", rapidjson::StringRef(x.GetChecksum()->c_str()), - allocator); + object.emplace("checksum", x.GetChecksum().get()); } if (x.GetCompressedDataSize()) { - value.AddMember("compressedDataSize", *x.GetCompressedDataSize(), - allocator); + object.emplace("compressedDataSize", x.GetCompressedDataSize().get()); } if (x.GetDataSize()) { - value.AddMember("dataSize", *x.GetDataSize(), allocator); + object.emplace("dataSize", x.GetDataSize().get()); } if (x.GetData()) { const auto& data = x.GetData().get(); - auto data_stringref = rapidjson::StringRef( + auto data_stringref = boost::json::string_view( reinterpret_cast(data->data()), data->size()); - value.AddMember("data", std::move(data_stringref), allocator); + object.emplace("data", data_stringref); } if (x.GetDataHandle()) { - value.AddMember("dataHandle", - rapidjson::StringRef(x.GetDataHandle()->c_str()), - allocator); + object.emplace("dataHandle", x.GetDataHandle().get()); } if (x.GetTimestamp()) { - value.AddMember("timestamp", *x.GetTimestamp(), allocator); + object.emplace("timestamp", x.GetTimestamp().get()); } } diff --git a/olp-cpp-sdk-dataservice-write/src/generated/serializer/PublishPartitionSerializer.h b/olp-cpp-sdk-dataservice-write/src/generated/serializer/PublishPartitionSerializer.h index 158b8d0df..2ddc4df67 100644 --- a/olp-cpp-sdk-dataservice-write/src/generated/serializer/PublishPartitionSerializer.h +++ b/olp-cpp-sdk-dataservice-write/src/generated/serializer/PublishPartitionSerializer.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 HERE Europe B.V. + * Copyright (C) 2019-2026 HERE Europe B.V. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,14 +19,13 @@ #pragma once -#include +#include #include "generated/model/PublishPartition.h" namespace olp { namespace serializer { void to_json(const dataservice::write::model::PublishPartition& x, - rapidjson::Value& value, - rapidjson::Document::AllocatorType& allocator); + boost::json::value& value); } // namespace serializer } // namespace olp diff --git a/olp-cpp-sdk-dataservice-write/src/generated/serializer/PublishPartitionsSerializer.cpp b/olp-cpp-sdk-dataservice-write/src/generated/serializer/PublishPartitionsSerializer.cpp index 96fa18438..3207d0c2d 100644 --- a/olp-cpp-sdk-dataservice-write/src/generated/serializer/PublishPartitionsSerializer.cpp +++ b/olp-cpp-sdk-dataservice-write/src/generated/serializer/PublishPartitionsSerializer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 HERE Europe B.V. + * Copyright (C) 2019-2026 HERE Europe B.V. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,21 +19,22 @@ #include "PublishPartitionsSerializer.h" +#include + #include "PublishPartitionSerializer.h" namespace olp { namespace serializer { void to_json(const dataservice::write::model::PublishPartitions& x, - rapidjson::Value& value, - rapidjson::Document::AllocatorType& allocator) { + boost::json::value& value) { if (x.GetPartitions()) { - rapidjson::Value partitions(rapidjson::kArrayType); - for (auto& partition : *x.GetPartitions()) { - rapidjson::Value partition_value(rapidjson::kObjectType); - to_json(partition, partition_value, allocator); - partitions.PushBack(partition_value, allocator); + boost::json::array partitions; + for (auto& partition : x.GetPartitions().get()) { + boost::json::value partition_value(boost::json::object_kind_t{}); + to_json(partition, partition_value); + partitions.emplace_back(std::move(partition_value)); } - value.AddMember("partitions", partitions, allocator); + value.as_object().emplace("partitions", std::move(partitions)); } } diff --git a/olp-cpp-sdk-dataservice-write/src/generated/serializer/PublishPartitionsSerializer.h b/olp-cpp-sdk-dataservice-write/src/generated/serializer/PublishPartitionsSerializer.h index 583ee4e2d..640afbcf4 100644 --- a/olp-cpp-sdk-dataservice-write/src/generated/serializer/PublishPartitionsSerializer.h +++ b/olp-cpp-sdk-dataservice-write/src/generated/serializer/PublishPartitionsSerializer.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 HERE Europe B.V. + * Copyright (C) 2019-2026 HERE Europe B.V. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,14 +19,13 @@ #pragma once -#include +#include #include "generated/model/PublishPartitions.h" namespace olp { namespace serializer { void to_json(const dataservice::write::model::PublishPartitions& x, - rapidjson::Value& value, - rapidjson::Document::AllocatorType& allocator); + boost::json::value& value); } // namespace serializer } // namespace olp diff --git a/olp-cpp-sdk-dataservice-write/src/generated/serializer/UpdateIndexRequestSerializer.cpp b/olp-cpp-sdk-dataservice-write/src/generated/serializer/UpdateIndexRequestSerializer.cpp index d9ce5729e..aab8da29f 100644 --- a/olp-cpp-sdk-dataservice-write/src/generated/serializer/UpdateIndexRequestSerializer.cpp +++ b/olp-cpp-sdk-dataservice-write/src/generated/serializer/UpdateIndexRequestSerializer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019-2021 HERE Europe B.V. + * Copyright (C) 2019-2026 HERE Europe B.V. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,84 +19,69 @@ #include "UpdateIndexRequestSerializer.h" +#include + namespace olp { namespace serializer { void to_json(const dataservice::write::model::UpdateIndexRequest &x, - rapidjson::Value &value, - rapidjson::Document::AllocatorType &allocator) { - rapidjson::Value additions(rapidjson::kArrayType); + boost::json::value &value) { + boost::json::array additions; + value.emplace_object(); for (auto &addition : x.GetIndexAdditions()) { - rapidjson::Value additionValue(rapidjson::kObjectType); - additionValue.AddMember( - "id", rapidjson::StringRef(addition.GetId().c_str()), allocator); + boost::json::object additionValue; + additionValue.emplace("id", addition.GetId()); - rapidjson::Value indexFields(rapidjson::kObjectType); + boost::json::object indexFields; for (const auto &field_pair : addition.GetIndexFields()) { - using dataservice::write::model::BooleanIndexValue; - using dataservice::write::model::HereTileIndexValue; - using dataservice::write::model::IndexType; - using dataservice::write::model::IntIndexValue; - using dataservice::write::model::StringIndexValue; - using dataservice::write::model::TimeWindowIndexValue; - + namespace model = dataservice::write::model; const auto &field = field_pair.second; - const auto key = rapidjson::StringRef(field_pair.first.c_str()); + const auto &key = field_pair.first; auto index_type = field->getIndexType(); - if (index_type == IndexType::String) { - auto s = std::static_pointer_cast(field); - rapidjson::Value str_val; - const auto &str = s->GetValue(); - str_val.SetString(str.c_str(), - static_cast(str.size()), - allocator); - indexFields.AddMember(key, str_val, allocator); - } else if (index_type == IndexType::Int) { - auto s = std::static_pointer_cast(field); - indexFields.AddMember(key, s->GetValue(), allocator); - } else if (index_type == IndexType::Bool) { - auto s = std::static_pointer_cast(field); - indexFields.AddMember(key, s->GetValue(), allocator); - } else if (index_type == IndexType::Heretile) { - auto s = std::static_pointer_cast(field); - indexFields.AddMember(key, s->GetValue(), allocator); - } else if (index_type == IndexType::TimeWindow) { - auto s = std::static_pointer_cast(field); - indexFields.AddMember(key, s->GetValue(), allocator); + if (index_type == model::IndexType::String) { + auto s = std::static_pointer_cast(field); + boost::json::value str_val{s->GetValue()}; + indexFields.emplace(key, std::move(str_val)); + } else if (index_type == model::IndexType::Int) { + auto s = std::static_pointer_cast(field); + indexFields.emplace(key, s->GetValue()); + } else if (index_type == model::IndexType::Bool) { + auto s = std::static_pointer_cast(field); + indexFields.emplace(key, s->GetValue()); + } else if (index_type == model::IndexType::Heretile) { + auto s = std::static_pointer_cast(field); + indexFields.emplace(key, s->GetValue()); + } else if (index_type == model::IndexType::TimeWindow) { + auto s = std::static_pointer_cast(field); + indexFields.emplace(key, s->GetValue()); } } - additionValue.AddMember("fields", indexFields, allocator); + additionValue.emplace("fields", indexFields); // TODO: Separate Details Model serializtion into it's own file when needed // by another model. if (addition.GetMetadata()) { - rapidjson::Value metadatas(rapidjson::kObjectType); - for (const auto &metadata : *addition.GetMetadata()) { + for (const auto &metadata : addition.GetMetadata().get()) { const auto &metadata_value = metadata.second; - const auto &metadata_key = metadata.first.c_str(); - indexFields.AddMember( - rapidjson::StringRef(metadata_key), - rapidjson::StringRef(metadata_value.c_str(), metadata_value.size()), - allocator); + const auto &metadata_key = metadata.first; + indexFields.emplace(metadata_key, metadata_value); } } if (addition.GetCheckSum()) { - additionValue.AddMember( - "checksum", rapidjson::StringRef(addition.GetCheckSum()->c_str()), - allocator); + additionValue.emplace("checksum", addition.GetCheckSum().get()); } if (addition.GetSize()) { - additionValue.AddMember("size", *addition.GetSize(), allocator); + additionValue.emplace("size", addition.GetSize().get()); } - additions.PushBack(additionValue, allocator); + additions.emplace_back(additionValue); } - value.AddMember("additions", additions, allocator); - rapidjson::Value removals(rapidjson::kArrayType); + value.as_object().emplace("additions", std::move(additions)); + boost::json::array removals; for (auto &removal : x.GetIndexRemovals()) { - removals.PushBack(rapidjson::StringRef(removal.c_str()), allocator); + removals.emplace_back(removal); } - value.AddMember("removals", removals, allocator); + value.as_object().emplace("removals", std::move(removals)); } } // namespace serializer diff --git a/olp-cpp-sdk-dataservice-write/src/generated/serializer/UpdateIndexRequestSerializer.h b/olp-cpp-sdk-dataservice-write/src/generated/serializer/UpdateIndexRequestSerializer.h index dd8b8b5e4..77137249d 100644 --- a/olp-cpp-sdk-dataservice-write/src/generated/serializer/UpdateIndexRequestSerializer.h +++ b/olp-cpp-sdk-dataservice-write/src/generated/serializer/UpdateIndexRequestSerializer.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 HERE Europe B.V. + * Copyright (C) 2019-2026 HERE Europe B.V. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,15 +19,14 @@ #pragma once -#include +#include #include namespace olp { namespace serializer { void to_json(const dataservice::write::model::UpdateIndexRequest& x, - rapidjson::Value& value, - rapidjson::Document::AllocatorType& allocator); + boost::json::value& value); } // namespace serializer } // namespace olp diff --git a/olp-cpp-sdk-dataservice-write/src/utils/BoostJsonSrc.cpp b/olp-cpp-sdk-dataservice-write/src/utils/BoostJsonSrc.cpp new file mode 100644 index 000000000..017758210 --- /dev/null +++ b/olp-cpp-sdk-dataservice-write/src/utils/BoostJsonSrc.cpp @@ -0,0 +1,20 @@ +/* + * Copyright (C) 2026 HERE Europe B.V. + * + * 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. + * + * SPDX-License-Identifier: Apache-2.0 + * License-Filename: LICENSE + */ + +#include From 9ea4ae2748d00d9c20e87e7905104d81e5f730fb Mon Sep 17 00:00:00 2001 From: Rustam Gamidov Date: Tue, 10 Mar 2026 19:12:39 +0200 Subject: [PATCH 2/2] Copy json implementation wrappers to write lib This allows to keep other libs untouched until fully migrated to the boost::json and remove write lib dependency from public json wrappers. Alternative solutions tried are: - add boost json wrappers to the same files in the core but to additional namespace - changes in core, json still exposed - move boost json wrappers from core to internal for the repository include location and add it to all DataSDK projects - huge change Relates-To: OCMAM-445 Signed-off-by: Rustam Gamidov --- .../src/CatalogSettings.cpp | 6 +- .../src/JsonResultParser.h | 4 +- .../src/generated/parser/ApiParser.cpp | 2 +- .../src/generated/parser/CatalogParser.cpp | 2 +- .../src/generated/parser/DetailsParser.cpp | 2 +- .../src/generated/parser/JsonParser.h | 78 ++++++++++++++ .../generated/parser/LayerVersionsParser.cpp | 2 +- .../src/generated/parser/ParserWrapper.h | 102 ++++++++++++++++++ .../src/generated/parser/PartitionsParser.cpp | 2 +- .../generated/parser/PublicationParser.cpp | 2 +- .../parser/PublishDataRequestParser.cpp | 2 +- .../parser/PublishPartitionParser.cpp | 2 +- .../parser/PublishPartitionsParser.cpp | 2 +- .../src/generated/parser/ResponseOkParser.cpp | 2 +- .../parser/ResponseOkSingleParser.cpp | 2 +- .../parser/VersionDependencyParser.cpp | 2 +- .../parser/VersionResponseParser.cpp | 2 +- .../generated/serializer/ApiSerializer.cpp | 2 +- .../serializer/CatalogSerializer.cpp | 2 +- .../generated/serializer/SerializerWrapper.h | 102 ++++++++++++++++++ .../tests/ParserTest.cpp | 4 +- ...ionedLayerClientImplPublishToBatchTest.cpp | 4 +- .../tests/VersionedLayerClientImplTest.cpp | 4 +- ...VersionedLayerClientPublishToBatchTest.cpp | 4 +- .../VersionedLayerClientTest.cpp | 4 +- 25 files changed, 313 insertions(+), 29 deletions(-) create mode 100644 olp-cpp-sdk-dataservice-write/src/generated/parser/JsonParser.h create mode 100644 olp-cpp-sdk-dataservice-write/src/generated/parser/ParserWrapper.h create mode 100644 olp-cpp-sdk-dataservice-write/src/generated/serializer/SerializerWrapper.h diff --git a/olp-cpp-sdk-dataservice-write/src/CatalogSettings.cpp b/olp-cpp-sdk-dataservice-write/src/CatalogSettings.cpp index 5d3476263..43a225c88 100644 --- a/olp-cpp-sdk-dataservice-write/src/CatalogSettings.cpp +++ b/olp-cpp-sdk-dataservice-write/src/CatalogSettings.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2020 HERE Europe B.V. + * Copyright (C) 2020-2026 HERE Europe B.V. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,6 +19,8 @@ #include "CatalogSettings.h" +#include + #include #include #include @@ -29,7 +31,7 @@ #include #include #include -#include +#include // clang-format on namespace olp { diff --git a/olp-cpp-sdk-dataservice-write/src/JsonResultParser.h b/olp-cpp-sdk-dataservice-write/src/JsonResultParser.h index a5dea90f8..de069190c 100644 --- a/olp-cpp-sdk-dataservice-write/src/JsonResultParser.h +++ b/olp-cpp-sdk-dataservice-write/src/JsonResultParser.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2020 HERE Europe B.V. + * Copyright (C) 2020-2026 HERE Europe B.V. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,8 +23,8 @@ #include #include +#include #include -#include #include namespace olp { diff --git a/olp-cpp-sdk-dataservice-write/src/generated/parser/ApiParser.cpp b/olp-cpp-sdk-dataservice-write/src/generated/parser/ApiParser.cpp index e2fb96cc9..a98304a8d 100644 --- a/olp-cpp-sdk-dataservice-write/src/generated/parser/ApiParser.cpp +++ b/olp-cpp-sdk-dataservice-write/src/generated/parser/ApiParser.cpp @@ -21,7 +21,7 @@ #include -#include +#include namespace olp { namespace parser { diff --git a/olp-cpp-sdk-dataservice-write/src/generated/parser/CatalogParser.cpp b/olp-cpp-sdk-dataservice-write/src/generated/parser/CatalogParser.cpp index 7f509a189..1d6f7ba96 100644 --- a/olp-cpp-sdk-dataservice-write/src/generated/parser/CatalogParser.cpp +++ b/olp-cpp-sdk-dataservice-write/src/generated/parser/CatalogParser.cpp @@ -21,7 +21,7 @@ #include -#include +#include namespace olp { namespace parser { diff --git a/olp-cpp-sdk-dataservice-write/src/generated/parser/DetailsParser.cpp b/olp-cpp-sdk-dataservice-write/src/generated/parser/DetailsParser.cpp index 575900c01..275807cff 100644 --- a/olp-cpp-sdk-dataservice-write/src/generated/parser/DetailsParser.cpp +++ b/olp-cpp-sdk-dataservice-write/src/generated/parser/DetailsParser.cpp @@ -21,7 +21,7 @@ #include -#include +#include namespace olp { namespace parser { diff --git a/olp-cpp-sdk-dataservice-write/src/generated/parser/JsonParser.h b/olp-cpp-sdk-dataservice-write/src/generated/parser/JsonParser.h new file mode 100644 index 000000000..48f30401e --- /dev/null +++ b/olp-cpp-sdk-dataservice-write/src/generated/parser/JsonParser.h @@ -0,0 +1,78 @@ +/* + * Copyright (C) 2019-2026 HERE Europe B.V. + * + * 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. + * + * SPDX-License-Identifier: Apache-2.0 + * License-Filename: LICENSE + */ + +#pragma once + +#include +#include +#include +#include + +#include + +#include "ParserWrapper.h" + +namespace olp { +namespace parser { + +template +inline T parse(const std::string& json) { + boost::json::error_code ec; + auto value = boost::json::parse(json, ec); + T result{}; + if (value.is_object() || value.is_array()) { + from_json(value, result); + } + return result; +} + +template +inline T parse(std::stringstream& json_stream, bool& res) { + res = false; + boost::json::error_code ec; + auto value = boost::json::parse(json_stream, ec); + T result{}; + if (value.is_object() || value.is_array()) { + from_json(value, result); + res = true; + } + return result; +} + +template +inline T parse(std::stringstream& json_stream) { + bool res = true; + return parse(json_stream, res); +} + +template +inline T parse(const std::shared_ptr>& json_bytes) { + boost::json::string_view json(reinterpret_cast(json_bytes->data()), + json_bytes->size()); + boost::json::error_code ec; + auto value = boost::json::parse(json, ec); + T result{}; + if (value.is_object() || value.is_array()) { + from_json(value, result); + } + return result; +} + +} // namespace parser +} // namespace olp diff --git a/olp-cpp-sdk-dataservice-write/src/generated/parser/LayerVersionsParser.cpp b/olp-cpp-sdk-dataservice-write/src/generated/parser/LayerVersionsParser.cpp index 6e12f2d93..845e797b4 100644 --- a/olp-cpp-sdk-dataservice-write/src/generated/parser/LayerVersionsParser.cpp +++ b/olp-cpp-sdk-dataservice-write/src/generated/parser/LayerVersionsParser.cpp @@ -21,7 +21,7 @@ #include -#include +#include namespace olp { namespace parser { diff --git a/olp-cpp-sdk-dataservice-write/src/generated/parser/ParserWrapper.h b/olp-cpp-sdk-dataservice-write/src/generated/parser/ParserWrapper.h new file mode 100644 index 000000000..284238474 --- /dev/null +++ b/olp-cpp-sdk-dataservice-write/src/generated/parser/ParserWrapper.h @@ -0,0 +1,102 @@ +/* + * Copyright (C) 2019-2026 HERE Europe B.V. + * + * 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. + * + * SPDX-License-Identifier: Apache-2.0 + * License-Filename: LICENSE + */ + +#pragma once + +#include +#include +#include +#include +#include + +#include +#include + +namespace olp { +namespace parser { + +inline void from_json(const boost::json::value& value, std::string& x) { + const auto& str = value.get_string(); + x.assign(str.begin(), str.end()); +} + +inline void from_json(const boost::json::value& value, int32_t& x) { + x = static_cast(value.to_number()); +} + +inline void from_json(const boost::json::value& value, int64_t& x) { + x = value.to_number(); +} + +inline void from_json(const boost::json::value& value, double& x) { + x = value.to_number(); +} + +inline void from_json(const boost::json::value& value, bool& x) { + x = value.get_bool(); +} + +inline void from_json(const boost::json::value& value, + std::shared_ptr>& x) { + const auto& s = value.get_string(); + x = std::make_shared>(s.begin(), s.end()); +} + +template +inline void from_json(const boost::json::value& value, + porting::optional& x) { + T result = T(); + from_json(value, result); + x = result; +} + +template +inline void from_json(const boost::json::value& value, + std::map& results) { + const auto& object = value.get_object(); + for (const auto& object_value : object) { + std::string key = object_value.key(); + from_json(object_value.value(), results[key]); + } +} + +template +inline void from_json(const boost::json::value& value, + std::vector& results) { + const auto& array = value.get_array(); + for (const auto& array_value : array) { + T result; + from_json(array_value, result); + results.emplace_back(std::move(result)); + } +} + +template +inline T parse(const boost::json::value& value, const std::string& name) { + T result = T(); + const auto& object = value.get_object(); + auto itr = object.find(name); + if (itr != object.end()) { + from_json(itr->value(), result); + } + return result; +} + +} // namespace parser +} // namespace olp diff --git a/olp-cpp-sdk-dataservice-write/src/generated/parser/PartitionsParser.cpp b/olp-cpp-sdk-dataservice-write/src/generated/parser/PartitionsParser.cpp index 3ca081962..15f6bacb3 100644 --- a/olp-cpp-sdk-dataservice-write/src/generated/parser/PartitionsParser.cpp +++ b/olp-cpp-sdk-dataservice-write/src/generated/parser/PartitionsParser.cpp @@ -21,7 +21,7 @@ #include -#include +#include namespace olp { namespace parser { diff --git a/olp-cpp-sdk-dataservice-write/src/generated/parser/PublicationParser.cpp b/olp-cpp-sdk-dataservice-write/src/generated/parser/PublicationParser.cpp index cf5e217e9..0acb2c867 100644 --- a/olp-cpp-sdk-dataservice-write/src/generated/parser/PublicationParser.cpp +++ b/olp-cpp-sdk-dataservice-write/src/generated/parser/PublicationParser.cpp @@ -25,7 +25,7 @@ // clang-format off #include #include -#include +#include // clang-format on namespace olp { diff --git a/olp-cpp-sdk-dataservice-write/src/generated/parser/PublishDataRequestParser.cpp b/olp-cpp-sdk-dataservice-write/src/generated/parser/PublishDataRequestParser.cpp index b3f330fb9..7f217012a 100644 --- a/olp-cpp-sdk-dataservice-write/src/generated/parser/PublishDataRequestParser.cpp +++ b/olp-cpp-sdk-dataservice-write/src/generated/parser/PublishDataRequestParser.cpp @@ -24,7 +24,7 @@ #include // clang-format off -#include +#include // clang-format on namespace olp { diff --git a/olp-cpp-sdk-dataservice-write/src/generated/parser/PublishPartitionParser.cpp b/olp-cpp-sdk-dataservice-write/src/generated/parser/PublishPartitionParser.cpp index 6ea93e7d7..ec8d6a75d 100644 --- a/olp-cpp-sdk-dataservice-write/src/generated/parser/PublishPartitionParser.cpp +++ b/olp-cpp-sdk-dataservice-write/src/generated/parser/PublishPartitionParser.cpp @@ -23,7 +23,7 @@ #include #include -#include +#include "generated/parser/ParserWrapper.h" namespace olp { namespace parser { diff --git a/olp-cpp-sdk-dataservice-write/src/generated/parser/PublishPartitionsParser.cpp b/olp-cpp-sdk-dataservice-write/src/generated/parser/PublishPartitionsParser.cpp index 3fc02cc55..37392cf15 100644 --- a/olp-cpp-sdk-dataservice-write/src/generated/parser/PublishPartitionsParser.cpp +++ b/olp-cpp-sdk-dataservice-write/src/generated/parser/PublishPartitionsParser.cpp @@ -23,7 +23,7 @@ // clang-format off #include -#include +#include // clang-format on namespace olp { diff --git a/olp-cpp-sdk-dataservice-write/src/generated/parser/ResponseOkParser.cpp b/olp-cpp-sdk-dataservice-write/src/generated/parser/ResponseOkParser.cpp index 4bc409ad2..c8b4153fc 100644 --- a/olp-cpp-sdk-dataservice-write/src/generated/parser/ResponseOkParser.cpp +++ b/olp-cpp-sdk-dataservice-write/src/generated/parser/ResponseOkParser.cpp @@ -22,7 +22,7 @@ #include #include -#include +#include namespace model = olp::dataservice::write::model; diff --git a/olp-cpp-sdk-dataservice-write/src/generated/parser/ResponseOkSingleParser.cpp b/olp-cpp-sdk-dataservice-write/src/generated/parser/ResponseOkSingleParser.cpp index 7d171d2c2..172488c3d 100644 --- a/olp-cpp-sdk-dataservice-write/src/generated/parser/ResponseOkSingleParser.cpp +++ b/olp-cpp-sdk-dataservice-write/src/generated/parser/ResponseOkSingleParser.cpp @@ -21,7 +21,7 @@ #include -#include +#include namespace olp { namespace parser { diff --git a/olp-cpp-sdk-dataservice-write/src/generated/parser/VersionDependencyParser.cpp b/olp-cpp-sdk-dataservice-write/src/generated/parser/VersionDependencyParser.cpp index f0ec5cdc0..0a830bb66 100644 --- a/olp-cpp-sdk-dataservice-write/src/generated/parser/VersionDependencyParser.cpp +++ b/olp-cpp-sdk-dataservice-write/src/generated/parser/VersionDependencyParser.cpp @@ -21,7 +21,7 @@ #include -#include +#include namespace olp { namespace parser { diff --git a/olp-cpp-sdk-dataservice-write/src/generated/parser/VersionResponseParser.cpp b/olp-cpp-sdk-dataservice-write/src/generated/parser/VersionResponseParser.cpp index f093028b2..233233139 100644 --- a/olp-cpp-sdk-dataservice-write/src/generated/parser/VersionResponseParser.cpp +++ b/olp-cpp-sdk-dataservice-write/src/generated/parser/VersionResponseParser.cpp @@ -19,7 +19,7 @@ #include "VersionResponseParser.h" -#include +#include namespace olp { namespace parser { diff --git a/olp-cpp-sdk-dataservice-write/src/generated/serializer/ApiSerializer.cpp b/olp-cpp-sdk-dataservice-write/src/generated/serializer/ApiSerializer.cpp index 8a0f90c31..67bdb0c75 100644 --- a/olp-cpp-sdk-dataservice-write/src/generated/serializer/ApiSerializer.cpp +++ b/olp-cpp-sdk-dataservice-write/src/generated/serializer/ApiSerializer.cpp @@ -21,7 +21,7 @@ #include "ApiSerializer.h" -#include +#include namespace olp { namespace serializer { diff --git a/olp-cpp-sdk-dataservice-write/src/generated/serializer/CatalogSerializer.cpp b/olp-cpp-sdk-dataservice-write/src/generated/serializer/CatalogSerializer.cpp index dfa547660..1dd1ff303 100644 --- a/olp-cpp-sdk-dataservice-write/src/generated/serializer/CatalogSerializer.cpp +++ b/olp-cpp-sdk-dataservice-write/src/generated/serializer/CatalogSerializer.cpp @@ -21,7 +21,7 @@ #include "CatalogSerializer.h" -#include +#include namespace olp { namespace serializer { diff --git a/olp-cpp-sdk-dataservice-write/src/generated/serializer/SerializerWrapper.h b/olp-cpp-sdk-dataservice-write/src/generated/serializer/SerializerWrapper.h new file mode 100644 index 000000000..7005b9cec --- /dev/null +++ b/olp-cpp-sdk-dataservice-write/src/generated/serializer/SerializerWrapper.h @@ -0,0 +1,102 @@ +/* + * Copyright (C) 2019-2026 HERE Europe B.V. + * + * 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. + * + * SPDX-License-Identifier: Apache-2.0 + * License-Filename: LICENSE + */ + +#pragma once + +#include +#include +#include +#include +#include + +#include +#include + +namespace olp { +namespace serializer { + +inline void to_json(const std::string& x, boost::json::value& value) { + value.emplace_string() = x; +} + +inline void to_json(int32_t x, boost::json::value& value) { + value.emplace_int64() = x; +} + +inline void to_json(int64_t x, boost::json::value& value) { + value.emplace_int64() = x; +} + +inline void to_json(double x, boost::json::value& value) { + value.emplace_double() = x; +} +inline void to_json(bool x, boost::json::value& value) { + value.emplace_bool() = x; +} + +inline void to_json(const std::shared_ptr>& x, + boost::json::value& value) { + value.emplace_string().assign(x->begin(), x->end()); +} + +template +inline void to_json(const porting::optional& x, boost::json::value& value) { + if (x) { + to_json(*x, value); + } else { + value.emplace_null(); + } +} + +template +inline void to_json(const std::map& x, + boost::json::value& value) { + auto& object = value.emplace_object(); + for (auto itr = x.begin(); itr != x.end(); ++itr) { + const auto& key = itr->first; + boost::json::value item_value; + to_json(itr->second, item_value); + object.emplace(key, std::move(item_value)); + } +} + +template +inline void to_json(const std::vector& x, boost::json::value& value) { + auto& array = value.emplace_array(); + array.reserve(x.size()); + for (typename std::vector::const_iterator itr = x.begin(); itr != x.end(); + ++itr) { + boost::json::value item_value; + to_json(*itr, item_value); + array.emplace_back(std::move(item_value)); + } +} + +template +inline void serialize(const std::string& key, const T& x, + boost::json::object& value) { + boost::json::value item_value; + to_json(x, item_value); + if (!item_value.is_null()) { + value.emplace(key, std::move(item_value)); + } +} + +} // namespace serializer +} // namespace olp diff --git a/olp-cpp-sdk-dataservice-write/tests/ParserTest.cpp b/olp-cpp-sdk-dataservice-write/tests/ParserTest.cpp index 746ec330f..60c7bf37d 100644 --- a/olp-cpp-sdk-dataservice-write/tests/ParserTest.cpp +++ b/olp-cpp-sdk-dataservice-write/tests/ParserTest.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 HERE Europe B.V. + * Copyright (C) 2019-2026 HERE Europe B.V. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -36,7 +36,7 @@ #include #include #include -#include +#include // clang-format on namespace { diff --git a/olp-cpp-sdk-dataservice-write/tests/VersionedLayerClientImplPublishToBatchTest.cpp b/olp-cpp-sdk-dataservice-write/tests/VersionedLayerClientImplPublishToBatchTest.cpp index b58adfcda..e54b04987 100644 --- a/olp-cpp-sdk-dataservice-write/tests/VersionedLayerClientImplPublishToBatchTest.cpp +++ b/olp-cpp-sdk-dataservice-write/tests/VersionedLayerClientImplPublishToBatchTest.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2020-2024 HERE Europe B.V. + * Copyright (C) 2020-2026 HERE Europe B.V. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -29,7 +29,7 @@ #include "generated/serializer/ApiSerializer.h" #include "generated/serializer/PublicationSerializer.h" #include "generated/serializer/CatalogSerializer.h" -#include +#include #include "generated/serializer/JsonSerializer.h" // clang-format on diff --git a/olp-cpp-sdk-dataservice-write/tests/VersionedLayerClientImplTest.cpp b/olp-cpp-sdk-dataservice-write/tests/VersionedLayerClientImplTest.cpp index e19ca97be..29b936da1 100644 --- a/olp-cpp-sdk-dataservice-write/tests/VersionedLayerClientImplTest.cpp +++ b/olp-cpp-sdk-dataservice-write/tests/VersionedLayerClientImplTest.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2020-2021 HERE Europe B.V. + * Copyright (C) 2020-2026 HERE Europe B.V. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -28,7 +28,7 @@ // clang-format off #include "generated/serializer/ApiSerializer.h" #include "generated/serializer/PublicationSerializer.h" -#include +#include #include "generated/serializer/JsonSerializer.h" // clang-format on diff --git a/tests/integration/olp-cpp-sdk-dataservice-write/VersionedLayerClientPublishToBatchTest.cpp b/tests/integration/olp-cpp-sdk-dataservice-write/VersionedLayerClientPublishToBatchTest.cpp index 74e5c8504..36ab71bf2 100644 --- a/tests/integration/olp-cpp-sdk-dataservice-write/VersionedLayerClientPublishToBatchTest.cpp +++ b/tests/integration/olp-cpp-sdk-dataservice-write/VersionedLayerClientPublishToBatchTest.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2020-2024 HERE Europe B.V. + * Copyright (C) 2020-2026 HERE Europe B.V. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -31,7 +31,7 @@ #include "generated/serializer/ApiSerializer.h" #include "generated/serializer/CatalogSerializer.h" #include "generated/serializer/PublicationSerializer.h" -#include +#include #include "generated/serializer/JsonSerializer.h" // clang-format on diff --git a/tests/integration/olp-cpp-sdk-dataservice-write/VersionedLayerClientTest.cpp b/tests/integration/olp-cpp-sdk-dataservice-write/VersionedLayerClientTest.cpp index 2389ad6f3..085f92791 100644 --- a/tests/integration/olp-cpp-sdk-dataservice-write/VersionedLayerClientTest.cpp +++ b/tests/integration/olp-cpp-sdk-dataservice-write/VersionedLayerClientTest.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2020-2021 HERE Europe B.V. + * Copyright (C) 2020-2026 HERE Europe B.V. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -30,7 +30,7 @@ // clang-format off #include "generated/serializer/ApiSerializer.h" #include "generated/serializer/PublicationSerializer.h" -#include +#include #include "generated/serializer/JsonSerializer.h" // clang-format on