Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[v22.3.x] schema_registry/test: Support JSON custom attributes on fields #7352

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cmake/oss.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ ExternalProject_Add(ctre

ExternalProject_Add(avro
GIT_REPOSITORY https://github.com/redpanda-data/avro
GIT_TAG 53250636b5223e434a9819a34e7b5b89e829ffb8
GIT_TAG 6b2896c2720e799371ea6f35b492d62171872e39
INSTALL_DIR @REDPANDA_DEPS_INSTALL_DIR@
CMAKE_COMMAND ${CMAKE_COMMAND} -E env ${cmake_build_env} ${CMAKE_COMMAND}
CMAKE_ARGS
Expand Down
25 changes: 25 additions & 0 deletions src/v/pandaproxy/schema_registry/test/compatibility_avro.cc
Original file line number Diff line number Diff line change
Expand Up @@ -250,3 +250,28 @@ SEASTAR_THREAD_TEST_CASE(test_avro_schema_definition) {
pps::canonical_schema_definition avro_conversion{valid};
BOOST_CHECK_EQUAL(expected, avro_conversion);
}

SEASTAR_THREAD_TEST_CASE(test_avro_schema_definition_custom_attributes) {
// https://github.com/redpanda-data/redpanda/issues/7274
// custom attributes supported only at field level
const auto avro_metadata_schema
= pps::sanitize_avro_schema_definition(
{R"({"type":"record","name":"foo","ignored_attr":true,"fields":[{"name":"bar","type":"float","extra_attr":true}]})",
pps::schema_type::avro})
.value();
pps::canonical_schema_definition expected{
R"({"type":"record","name":"foo","fields":[{"name":"bar","type":"float","extra_attr":true}]})",
pps::schema_type::avro};
pps::sharded_store s;
auto valid = pps::make_avro_schema_definition(
s,
{pps::subject("s2"),
{avro_metadata_schema.raw(), pps::schema_type::avro}})
.get();
static_assert(
std::
is_same_v<std::decay_t<decltype(valid)>, pps::avro_schema_definition>,
"schema2 is an avro_schema_definition");
pps::canonical_schema_definition avro_conversion{valid};
BOOST_CHECK_EQUAL(expected, avro_conversion);
}