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

[CORE-4279] Wire up schema_registry/json #20136

Conversation

andijcr
Copy link
Contributor

@andijcr andijcr commented Jun 25, 2024

Wire up schema_registry support for json schema.

this pr enables json schema inputs and adds a ducktape test for json schema compatibility

Backports Required

  • none - not a bug fix
  • none - this is a backport
  • none - issue does not exist in previous branches
  • none - papercut/not impactful enough to backport
  • v24.1.x
  • v23.3.x
  • v23.2.x

Release Notes

  • none

@andijcr andijcr changed the title [CORE-4435schema_registry/json: fix backward<->forward compatibility inversion [CORE-4435] schema_registry/json: fix backward<->forward compatibility inversion Jun 25, 2024
@andijcr andijcr marked this pull request as ready for review June 25, 2024 16:39
@andijcr andijcr requested review from BenPope and a team June 25, 2024 16:39
Copy link
Member

@BenPope BenPope left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please put a compatibility test (such as from the demo) into ducktape, along with something like this:

index fbb6b972b2..cc5de47f7d 100644
--- a/src/v/pandaproxy/schema_registry/sharded_store.cc
+++ b/src/v/pandaproxy/schema_registry/sharded_store.cc
@@ -686,12 +686,18 @@ ss::future<bool> sharded_store::is_compatible(
         co_return true;
     }
 
-    // Currently support PROTOBUF, AVRO
-    if (
-      new_schema.type() != schema_type::avro
-      && new_schema.type() != schema_type::protobuf) {
+    // Currently support JSON, PROTOBUF, AVRO
+    if (![type = new_schema.type()] {
+            switch (type) {
+            case schema_type::avro:
+            case schema_type::protobuf:
+            case schema_type::json:
+                return true;
+            }
+            return false;
+        }()) {
         throw as_exception(invalid_schema_type(new_schema.type()));
-    }
+    };
 
     // if transitive, search all, otherwise seach forwards from version
     if (

accept schema_type::json in is_compatible
…version

to allow in the next commit to use a different schema type
add a JSON dataset to
test_post_compatibility_subject_version
@andijcr andijcr force-pushed the fix/core-4435/schema_registry_backward_forward branch from 393bff2 to 715a0df Compare June 26, 2024 16:17
Copy link
Member

@BenPope BenPope left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔥

@andijcr andijcr changed the title [CORE-4435] schema_registry/json: fix backward<->forward compatibility inversion [CORE-4279] Wire up schema_registry/json Jun 26, 2024
@andijcr andijcr merged commit d8ee188 into redpanda-data:dev Jun 27, 2024
21 checks passed
@andijcr andijcr deleted the fix/core-4435/schema_registry_backward_forward branch June 27, 2024 11:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants