diff --git a/src/v/pandaproxy/json/requests/test/produce.cc b/src/v/pandaproxy/json/requests/test/produce.cc index 6f065bb224f4..b067dc8f5686 100644 --- a/src/v/pandaproxy/json/requests/test/produce.cc +++ b/src/v/pandaproxy/json/requests/test/produce.cc @@ -46,7 +46,7 @@ SEASTAR_THREAD_TEST_CASE(test_produce_binary_request) { ] })"; - auto records = ppj::rjson_parse(input, make_binary_v2_handler()); + auto records = ppj::impl::rjson_parse(input, make_binary_v2_handler()); BOOST_TEST(records.size() == 2); BOOST_TEST(!!records[0].value); @@ -77,7 +77,7 @@ SEASTAR_THREAD_TEST_CASE(test_produce_json_request) { ] })"; - auto records = ppj::rjson_parse(input, make_json_v2_handler()); + auto records = ppj::impl::rjson_parse(input, make_json_v2_handler()); BOOST_REQUIRE_EQUAL(records.size(), 2); BOOST_REQUIRE_EQUAL(records[0].partition_id, model::partition_id(0)); BOOST_REQUIRE(!records[0].key); @@ -111,7 +111,7 @@ SEASTAR_THREAD_TEST_CASE(test_produce_invalid_json_request) { })"; BOOST_CHECK_THROW( - ppj::rjson_parse(input, make_json_v2_handler()), + ppj::impl::rjson_parse(input, make_json_v2_handler()), pandaproxy::json::parse_error); } @@ -121,7 +121,7 @@ SEASTAR_THREAD_TEST_CASE(test_produce_request_empty) { "records": [] })"; - auto records = ppj::rjson_parse(input, make_binary_v2_handler()); + auto records = ppj::impl::rjson_parse(input, make_binary_v2_handler()); BOOST_TEST(records.size() == 0); } @@ -137,7 +137,7 @@ SEASTAR_THREAD_TEST_CASE(test_produce_request_error_records_name) { })"; BOOST_CHECK_EXCEPTION( - ppj::rjson_parse(input, make_binary_v2_handler()), + ppj::impl::rjson_parse(input, make_binary_v2_handler()), ppj::parse_error, [](ppj::parse_error const& e) { return e.what() == std::string_view("parse error at offset 25"); @@ -156,7 +156,7 @@ SEASTAR_THREAD_TEST_CASE(test_produce_request_error_partition_name) { })"; BOOST_CHECK_EXCEPTION( - ppj::rjson_parse(input, make_binary_v2_handler()), + ppj::impl::rjson_parse(input, make_binary_v2_handler()), ppj::parse_error, [](ppj::parse_error const& e) { return e.what() == std::string_view("parse error at offset 99"); @@ -175,7 +175,7 @@ SEASTAR_THREAD_TEST_CASE(test_produce_request_error_partition_type) { })"; BOOST_CHECK_EXCEPTION( - ppj::rjson_parse(input, make_binary_v2_handler()), + ppj::impl::rjson_parse(input, make_binary_v2_handler()), ppj::parse_error, [](ppj::parse_error const& e) { return e.what() == std::string_view("parse error at offset 112"); @@ -195,7 +195,7 @@ SEASTAR_THREAD_TEST_CASE(test_produce_request_error_before_records) { })"; BOOST_CHECK_EXCEPTION( - ppj::rjson_parse(input, make_binary_v2_handler()), + ppj::impl::rjson_parse(input, make_binary_v2_handler()), ppj::parse_error, [](ppj::parse_error const& e) { return e.what() == std::string_view("parse error at offset 28"); @@ -215,7 +215,7 @@ SEASTAR_THREAD_TEST_CASE(test_produce_request_error_after_records) { })"; BOOST_CHECK_EXCEPTION( - ppj::rjson_parse(input, make_binary_v2_handler()), + ppj::impl::rjson_parse(input, make_binary_v2_handler()), ppj::parse_error, [](ppj::parse_error const& e) { return e.what() == std::string_view("parse error at offset 152"); @@ -235,7 +235,7 @@ SEASTAR_THREAD_TEST_CASE(test_produce_request_error_between_records) { })"; BOOST_CHECK_EXCEPTION( - ppj::rjson_parse(input, make_binary_v2_handler()), + ppj::impl::rjson_parse(input, make_binary_v2_handler()), ppj::parse_error, [](ppj::parse_error const& e) { return e.what() == std::string_view("parse error at offset 144"); @@ -250,7 +250,7 @@ SEASTAR_THREAD_TEST_CASE(test_produce_request_error_no_records) { })"; BOOST_CHECK_EXCEPTION( - ppj::rjson_parse(input, make_binary_v2_handler()), + ppj::impl::rjson_parse(input, make_binary_v2_handler()), ppj::parse_error, [](ppj::parse_error const& e) { return e.what() == std::string_view("parse error at offset 24"); diff --git a/src/v/pandaproxy/json/rjson_util.h b/src/v/pandaproxy/json/rjson_util.h index 70bbb262094f..a3d3358f2078 100644 --- a/src/v/pandaproxy/json/rjson_util.h +++ b/src/v/pandaproxy/json/rjson_util.h @@ -120,8 +120,6 @@ rjson_parse_buf(Arg&& arg, Handler&& handler) { return std::forward(handler).result; } -} // namespace impl - /// \brief Parse a payload using the handler. /// /// \warning rjson_parse is preferred, since it can be chunked. @@ -132,6 +130,8 @@ rjson_parse(const char* const s, Handler&& handler) { s, std::forward(handler)); } +} // namespace impl + ///\brief Parse a payload using the handler. template typename Handler::rjson_parse_result rjson_parse(iobuf buf, Handler&& handler) { @@ -144,7 +144,7 @@ template typename ss::future rjson_parse(std::unique_ptr req, Handler handler) { if (!req->content.empty()) { - co_return rjson_parse(req->content.data(), std::move(handler)); + co_return impl::rjson_parse(req->content.data(), std::move(handler)); } iobuf buf; diff --git a/src/v/pandaproxy/json/test/parse.cc b/src/v/pandaproxy/json/test/parse.cc index cb7547064441..d7207474bf5d 100644 --- a/src/v/pandaproxy/json/test/parse.cc +++ b/src/v/pandaproxy/json/test/parse.cc @@ -43,7 +43,8 @@ inline void parse_test(size_t data_size) { auto input = gen(data_size); perf_tests::start_measuring_time(); - auto records = ppj::rjson_parse(input.c_str(), make_binary_v2_handler()); + auto records = ppj::impl::rjson_parse( + input.c_str(), make_binary_v2_handler()); perf_tests::stop_measuring_time(); } diff --git a/src/v/pandaproxy/rest/test/consumer_group.cc b/src/v/pandaproxy/rest/test/consumer_group.cc index 0c0ea3ae13bb..655d9384cfeb 100644 --- a/src/v/pandaproxy/rest/test/consumer_group.cc +++ b/src/v/pandaproxy/rest/test/consumer_group.cc @@ -84,7 +84,7 @@ FIXTURE_TEST(pandaproxy_consumer_group, pandaproxy_test_fixture) { BOOST_REQUIRE_EQUAL( res.headers.result(), boost::beast::http::status::ok); - auto res_data = ppj::rjson_parse( + auto res_data = ppj::impl::rjson_parse( res.body.data(), ppj::create_consumer_response_handler()); BOOST_REQUIRE_EQUAL(res_data.instance_id, "test_consumer"); member_id = res_data.instance_id; @@ -315,7 +315,7 @@ FIXTURE_TEST( BOOST_REQUIRE_EQUAL( res.headers.result(), boost::beast::http::status::ok); - auto res_data = ppj::rjson_parse( + auto res_data = ppj::impl::rjson_parse( res.body.data(), ppj::create_consumer_response_handler()); BOOST_REQUIRE_EQUAL(res_data.instance_id, "test_consumer"); member_id = res_data.instance_id; diff --git a/src/v/pandaproxy/schema_registry/requests/test/post_subject_versions.cc b/src/v/pandaproxy/schema_registry/requests/test/post_subject_versions.cc index 3cc171a12aba..a0befd798c81 100644 --- a/src/v/pandaproxy/schema_registry/requests/test/post_subject_versions.cc +++ b/src/v/pandaproxy/schema_registry/requests/test/post_subject_versions.cc @@ -52,7 +52,7 @@ SEASTAR_THREAD_TEST_CASE(test_post_subject_versions_parser) { const parse_result expected{ {sub, expected_schema_def}, std::nullopt, std::nullopt}; - auto result{ppj::rjson_parse( + auto result{ppj::impl::rjson_parse( payload.data(), pps::post_subject_versions_request_handler{sub})}; // canonicalisation now requires a sharded_store, for now, minify. diff --git a/src/v/pandaproxy/schema_registry/test/storage.cc b/src/v/pandaproxy/schema_registry/test/storage.cc index 72a215398337..aef243d10295 100644 --- a/src/v/pandaproxy/schema_registry/test/storage.cc +++ b/src/v/pandaproxy/schema_registry/test/storage.cc @@ -127,7 +127,7 @@ const pps::delete_subject_value delete_subject_value{ BOOST_AUTO_TEST_CASE(test_storage_serde) { { - auto key = ppj::rjson_parse( + auto key = ppj::impl::rjson_parse( avro_schema_key_sv.data(), pps::schema_key_handler<>{}); BOOST_CHECK_EQUAL(avro_schema_key, key); @@ -136,7 +136,7 @@ BOOST_AUTO_TEST_CASE(test_storage_serde) { } { - auto val = ppj::rjson_parse( + auto val = ppj::impl::rjson_parse( avro_schema_value_sv.data(), pps::canonical_schema_value_handler<>{}); BOOST_CHECK_EQUAL(avro_schema_value, val); @@ -145,7 +145,7 @@ BOOST_AUTO_TEST_CASE(test_storage_serde) { } { - auto val = ppj::rjson_parse( + auto val = ppj::impl::rjson_parse( config_key_sv.data(), pps::config_key_handler<>{}); BOOST_CHECK_EQUAL(config_key, val); @@ -154,7 +154,7 @@ BOOST_AUTO_TEST_CASE(test_storage_serde) { } { - auto val = ppj::rjson_parse( + auto val = ppj::impl::rjson_parse( config_key_sub_sv.data(), pps::config_key_handler<>{}); BOOST_CHECK_EQUAL(config_key_sub, val); @@ -163,7 +163,7 @@ BOOST_AUTO_TEST_CASE(test_storage_serde) { } { - auto val = ppj::rjson_parse( + auto val = ppj::impl::rjson_parse( config_value_sv.data(), pps::config_value_handler<>{}); BOOST_CHECK_EQUAL(config_value, val); @@ -172,7 +172,7 @@ BOOST_AUTO_TEST_CASE(test_storage_serde) { } { - auto val = ppj::rjson_parse( + auto val = ppj::impl::rjson_parse( config_value_sub_sv.data(), pps::config_value_handler<>{}); BOOST_CHECK_EQUAL(config_value_sub, val); @@ -181,7 +181,7 @@ BOOST_AUTO_TEST_CASE(test_storage_serde) { } { - auto val = ppj::rjson_parse( + auto val = ppj::impl::rjson_parse( delete_subject_key_sv.data(), pps::delete_subject_key_handler<>{}); BOOST_CHECK_EQUAL(delete_subject_key, val); @@ -190,7 +190,7 @@ BOOST_AUTO_TEST_CASE(test_storage_serde) { } { - auto val = ppj::rjson_parse( + auto val = ppj::impl::rjson_parse( delete_subject_value_sv.data(), pps::delete_subject_value_handler<>{}); BOOST_CHECK_EQUAL(delete_subject_value, val);