diff --git a/olp-cpp-sdk-authentication/src/AuthenticationClientImpl.cpp b/olp-cpp-sdk-authentication/src/AuthenticationClientImpl.cpp index 8c0f9d719..ae7e7cc88 100644 --- a/olp-cpp-sdk-authentication/src/AuthenticationClientImpl.cpp +++ b/olp-cpp-sdk-authentication/src/AuthenticationClientImpl.cpp @@ -216,7 +216,7 @@ olp::client::HttpResponse AuthenticationClientImpl::CallAuth( SignInResult AuthenticationClientImpl::ParseAuthResponse( int status, std::stringstream& auth_response) { - boost::json::error_code ec; + boost::system::error_code ec; auto document = boost::json::parse(auth_response, ec); return std::make_shared( status, olp::http::HttpErrorToString(status), @@ -228,7 +228,7 @@ SignInResult AuthenticationClientImpl::ParseAuthResponse( SignInUserResult AuthenticationClientImpl::ParseUserAuthResponse( int status, std::stringstream& auth_response) { - boost::json::error_code ec; + boost::system::error_code ec; auto document = boost::json::parse(auth_response, ec); return std::make_shared( status, olp::http::HttpErrorToString(status), @@ -462,7 +462,7 @@ client::CancellationToken AuthenticationClientImpl::SignInMtls( TimeResponse AuthenticationClientImpl::ParseTimeResponse( std::stringstream& payload) { - boost::json::error_code ec; + boost::system::error_code ec; auto json_value = boost::json::parse(payload, ec); if (ec.failed() || !json_value.is_object()) { @@ -688,7 +688,7 @@ client::CancellationToken AuthenticationClientImpl::SignUpHereUser( return client::ApiError(status, response_text); } - boost::json::error_code ec; + boost::system::error_code ec; auto document = boost::json::parse(response_text, ec); return {std::make_shared( status, olp::http::HttpErrorToString(status), @@ -737,7 +737,7 @@ client::CancellationToken AuthenticationClientImpl::SignOut( return client::ApiError(status, response_text); } - boost::json::error_code ec; + boost::system::error_code ec; auto document = boost::json::parse(response_text, ec); return {std::make_shared( status, olp::http::HttpErrorToString(status), @@ -774,7 +774,7 @@ client::CancellationToken AuthenticationClientImpl::IntrospectApp( auto http_result = client.CallApi(kIntrospectAppEndpoint, "GET", {}, {}, {}, nullptr, {}, context); - boost::json::error_code ec; + boost::system::error_code ec; auto document = boost::json::parse(http_result.GetRawResponse(), ec); if (http_result.GetStatus() != http::HttpStatusCode::OK) { // HttpResult response can be error message or valid json with it. @@ -820,7 +820,7 @@ client::CancellationToken AuthenticationClientImpl::Authorize( GenerateAuthorizeBody(request), kApplicationJson, context); - boost::json::error_code ec; + boost::system::error_code ec; auto document = boost::json::parse(http_result.GetRawResponse(), ec); if (http_result.GetStatus() != http::HttpStatusCode::OK) { // HttpResult response can be error message or valid json with it. diff --git a/olp-cpp-sdk-authentication/src/AuthenticationClientUtils.cpp b/olp-cpp-sdk-authentication/src/AuthenticationClientUtils.cpp index 3fc9715a8..10b364949 100644 --- a/olp-cpp-sdk-authentication/src/AuthenticationClientUtils.cpp +++ b/olp-cpp-sdk-authentication/src/AuthenticationClientUtils.cpp @@ -72,7 +72,7 @@ std::string Base64Encode(const Crypto::Sha256Digest& digest) { } Response Parse(client::HttpResponse& http_response) { - boost::json::error_code ec; + boost::system::error_code ec; auto document = boost::json::parse(http_response.GetRawResponse(), ec); if (http_response.GetStatus() != http::HttpStatusCode::OK) { // HttpResult response can be error message or valid json with it. diff --git a/olp-cpp-sdk-authentication/src/TokenEndpointImpl.cpp b/olp-cpp-sdk-authentication/src/TokenEndpointImpl.cpp index d30fb9e05..2564c2b53 100644 --- a/olp-cpp-sdk-authentication/src/TokenEndpointImpl.cpp +++ b/olp-cpp-sdk-authentication/src/TokenEndpointImpl.cpp @@ -101,7 +101,7 @@ void RetryDelay(const client::RetrySettings& retry_settings, size_t retry) { } TimeResponse ParseTimeResponse(const std::string& payload) { - boost::json::error_code ec; + boost::system::error_code ec; auto document = boost::json::parse(payload, ec); if (!document.is_object()) { @@ -330,7 +330,7 @@ SignInResponse TokenEndpointImpl::SignInClient( SignInResult TokenEndpointImpl::ParseAuthResponse( int status, std::stringstream& auth_response) { - boost::json::error_code ec; + boost::system::error_code ec; auto document = boost::json::parse(auth_response, ec); return std::make_shared( status, http::HttpErrorToString(status), diff --git a/olp-cpp-sdk-core/include/olp/core/porting/optional.h b/olp-cpp-sdk-core/include/olp/core/porting/optional.h index a0c4334a3..dea766daf 100644 --- a/olp-cpp-sdk-core/include/olp/core/porting/optional.h +++ b/olp-cpp-sdk-core/include/olp/core/porting/optional.h @@ -53,6 +53,7 @@ optional> make_optional(T&& v) { } // namespace olp #else +#include #include namespace olp { diff --git a/olp-cpp-sdk-core/src/generated/parser/JsonParser.h b/olp-cpp-sdk-core/src/generated/parser/JsonParser.h index 48f30401e..d30181246 100644 --- a/olp-cpp-sdk-core/src/generated/parser/JsonParser.h +++ b/olp-cpp-sdk-core/src/generated/parser/JsonParser.h @@ -25,6 +25,7 @@ #include #include +#include #include "ParserWrapper.h" @@ -33,7 +34,7 @@ namespace parser { template inline T parse(const std::string& json) { - boost::json::error_code ec; + boost::system::error_code ec; auto value = boost::json::parse(json, ec); T result{}; if (value.is_object() || value.is_array()) { @@ -45,7 +46,7 @@ inline T parse(const std::string& json) { template inline T parse(std::stringstream& json_stream, bool& res) { res = false; - boost::json::error_code ec; + boost::system::error_code ec; auto value = boost::json::parse(json_stream, ec); T result{}; if (value.is_object() || value.is_array()) { @@ -65,7 +66,7 @@ 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; + boost::system::error_code ec; auto value = boost::json::parse(json, ec); T result{}; if (value.is_object() || value.is_array()) { diff --git a/olp-cpp-sdk-dataservice-read/src/generated/parser/JsonParser.h b/olp-cpp-sdk-dataservice-read/src/generated/parser/JsonParser.h index 48f30401e..d30181246 100644 --- a/olp-cpp-sdk-dataservice-read/src/generated/parser/JsonParser.h +++ b/olp-cpp-sdk-dataservice-read/src/generated/parser/JsonParser.h @@ -25,6 +25,7 @@ #include #include +#include #include "ParserWrapper.h" @@ -33,7 +34,7 @@ namespace parser { template inline T parse(const std::string& json) { - boost::json::error_code ec; + boost::system::error_code ec; auto value = boost::json::parse(json, ec); T result{}; if (value.is_object() || value.is_array()) { @@ -45,7 +46,7 @@ inline T parse(const std::string& json) { template inline T parse(std::stringstream& json_stream, bool& res) { res = false; - boost::json::error_code ec; + boost::system::error_code ec; auto value = boost::json::parse(json_stream, ec); T result{}; if (value.is_object() || value.is_array()) { @@ -65,7 +66,7 @@ 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; + boost::system::error_code ec; auto value = boost::json::parse(json, ec); T result{}; if (value.is_object() || value.is_array()) { diff --git a/olp-cpp-sdk-dataservice-read/src/repositories/PartitionsSaxHandler.cpp b/olp-cpp-sdk-dataservice-read/src/repositories/PartitionsSaxHandler.cpp index bc67df12c..631539794 100644 --- a/olp-cpp-sdk-dataservice-read/src/repositories/PartitionsSaxHandler.cpp +++ b/olp-cpp-sdk-dataservice-read/src/repositories/PartitionsSaxHandler.cpp @@ -35,7 +35,7 @@ constexpr unsigned long long int HashStringToInt( PartitionsSaxHandler::PartitionsSaxHandler(PartitionCallback partition_callback) : partition_callback_(std::move(partition_callback)) {} -bool PartitionsSaxHandler::on_object_begin(boost::json::error_code& ec) { +bool PartitionsSaxHandler::on_object_begin(boost::system::error_code& ec) { if (state_ == State::kWaitForRootObject) { state_ = State::kWaitForRootPartitions; return CanContinue(ec); @@ -131,7 +131,7 @@ bool PartitionsSaxHandler::on_object_end(std::size_t, error_code& ec) { return CanContinue(ec); } -bool PartitionsSaxHandler::on_array_begin(boost::json::error_code& ec) { +bool PartitionsSaxHandler::on_array_begin(boost::system::error_code& ec) { // We expect only a single array in whol response if (state_ != State::kWaitPartitionsArray) { return NotSupported(ec); @@ -143,7 +143,7 @@ bool PartitionsSaxHandler::on_array_begin(boost::json::error_code& ec) { } bool PartitionsSaxHandler::on_array_end(std::size_t, - boost::json::error_code& ec) { + boost::system::error_code& ec) { if (state_ != State::kWaitForNextPartition) { return NotSupported(ec); } diff --git a/olp-cpp-sdk-dataservice-read/src/repositories/PartitionsSaxHandler.h b/olp-cpp-sdk-dataservice-read/src/repositories/PartitionsSaxHandler.h index f638eb631..5c0c5781f 100644 --- a/olp-cpp-sdk-dataservice-read/src/repositories/PartitionsSaxHandler.h +++ b/olp-cpp-sdk-dataservice-read/src/repositories/PartitionsSaxHandler.h @@ -24,7 +24,7 @@ #include #include -#include +#include #include @@ -37,7 +37,7 @@ class PartitionsSaxHandler { public: using PartitionCallback = std::function; using string_view = boost::json::string_view; - using error_code = boost::json::error_code; + using error_code = boost::system::error_code; explicit PartitionsSaxHandler(PartitionCallback partition_callback); diff --git a/olp-cpp-sdk-dataservice-read/src/repositories/QuadTreeIndex.cpp b/olp-cpp-sdk-dataservice-read/src/repositories/QuadTreeIndex.cpp index 8a946b015..cd1d64833 100644 --- a/olp-cpp-sdk-dataservice-read/src/repositories/QuadTreeIndex.cpp +++ b/olp-cpp-sdk-dataservice-read/src/repositories/QuadTreeIndex.cpp @@ -104,7 +104,7 @@ QuadTreeIndex::QuadTreeIndex(const cache::KeyValueCache::ValueTypePtr& data) { QuadTreeIndex::QuadTreeIndex(const geo::TileKey& root, int depth, std::stringstream& json_stream) { - boost::json::error_code ec; + boost::system::error_code ec; auto parsed_value = boost::json::parse(json_stream, ec); if (!parsed_value.is_object()) { diff --git a/olp-cpp-sdk-dataservice-read/tests/PartitionsSaxHandlerTest.cpp b/olp-cpp-sdk-dataservice-read/tests/PartitionsSaxHandlerTest.cpp index cb995dcfb..b825aa7ae 100644 --- a/olp-cpp-sdk-dataservice-read/tests/PartitionsSaxHandlerTest.cpp +++ b/olp-cpp-sdk-dataservice-read/tests/PartitionsSaxHandlerTest.cpp @@ -53,7 +53,7 @@ TEST(PartitionsSaxHandlerTest, NormalFlow) { repository::PartitionsSaxHandler handler(callback); - boost::json::error_code error_code; + boost::system::error_code error_code; ASSERT_TRUE(handler.on_object_begin(error_code)); ASSERT_TRUE(handler.on_key(kPartitions, len(kPartitions), error_code)); ASSERT_TRUE(handler.on_array_begin(error_code)); @@ -118,7 +118,7 @@ TEST(PartitionsSaxHandlerTest, WrongJSONStructure) { auto callback = [&](model::Partition) {}; repository::PartitionsSaxHandler handler(callback); - boost::json::error_code error_code; + boost::system::error_code error_code; // Initial state expects an object ASSERT_FALSE(handler.on_key(kPartitions, len(kPartitions), error_code)); diff --git a/olp-cpp-sdk-dataservice-write/src/generated/parser/JsonParser.h b/olp-cpp-sdk-dataservice-write/src/generated/parser/JsonParser.h index 48f30401e..d30181246 100644 --- a/olp-cpp-sdk-dataservice-write/src/generated/parser/JsonParser.h +++ b/olp-cpp-sdk-dataservice-write/src/generated/parser/JsonParser.h @@ -25,6 +25,7 @@ #include #include +#include #include "ParserWrapper.h" @@ -33,7 +34,7 @@ namespace parser { template inline T parse(const std::string& json) { - boost::json::error_code ec; + boost::system::error_code ec; auto value = boost::json::parse(json, ec); T result{}; if (value.is_object() || value.is_array()) { @@ -45,7 +46,7 @@ inline T parse(const std::string& json) { template inline T parse(std::stringstream& json_stream, bool& res) { res = false; - boost::json::error_code ec; + boost::system::error_code ec; auto value = boost::json::parse(json_stream, ec); T result{}; if (value.is_object() || value.is_array()) { @@ -65,7 +66,7 @@ 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; + boost::system::error_code ec; auto value = boost::json::parse(json, ec); T result{}; if (value.is_object() || value.is_array()) { diff --git a/tests/functional/olp-cpp-sdk-authentication/AuthenticationTestUtils.cpp b/tests/functional/olp-cpp-sdk-authentication/AuthenticationTestUtils.cpp index 00313d280..50c31cebf 100644 --- a/tests/functional/olp-cpp-sdk-authentication/AuthenticationTestUtils.cpp +++ b/tests/functional/olp-cpp-sdk-authentication/AuthenticationTestUtils.cpp @@ -103,7 +103,7 @@ bool AuthenticationTestUtils::CreateFacebookTestUser( &user](const olp::http::NetworkResponse &network_response) { user.token.status = network_response.GetStatus(); if (user.token.status == olp::http::HttpStatusCode::OK) { - boost::json::error_code ec; + boost::system::error_code ec; auto document = boost::json::parse(*payload, ec); const bool is_valid = !ec.failed() && document.is_object() && document.as_object().contains(kAccessToken) && @@ -243,7 +243,7 @@ bool AuthenticationTestUtils::GetAccessTokenImpl( &token](const olp::http::NetworkResponse &network_response) { token.status = network_response.GetStatus(); if (token.status == olp::http::HttpStatusCode::OK) { - boost::json::error_code ec; + boost::system::error_code ec; auto document = boost::json::parse(*payload, ec); const bool is_valid = !ec.failed() && document.is_object() && document.as_object().contains(kAccessToken); diff --git a/tests/utils/mock-server-client/JsonHelpers.h b/tests/utils/mock-server-client/JsonHelpers.h index 386174845..1dab56fc5 100644 --- a/tests/utils/mock-server-client/JsonHelpers.h +++ b/tests/utils/mock-server-client/JsonHelpers.h @@ -27,6 +27,7 @@ #include #include +#include namespace mockserver { @@ -123,7 +124,7 @@ inline T parse(const boost::json::value& value, const std::string& name) { template inline T parse(std::stringstream& json_stream) { - boost::json::error_code ec; + boost::system::error_code ec; auto doc = boost::json::parse(json_stream, ec); T result{}; if (doc.is_object() || doc.is_array()) {