Skip to content

fix: show correct compatibility on schema registry - #794

Open
robturner-kaluza wants to merge 2 commits into
andrewinci:mainfrom
robturner-kaluza:compat-bug
Open

robturner-kaluza wants to merge 2 commits into
andrewinci:mainfrom
robturner-kaluza:compat-bug

Conversation

@robturner-kaluza

Copy link
Copy Markdown

Summary

  • get_compatibility_level was deserializing the Schema Registry config response into a struct that only matched the JSON key "compatibilityLevel" (Confluent's global-config response shape).
  • Confluent also returns "compatibility" (no "Level" suffix) for subjects with a subject-specific override set. Karapace always uses this shape.
  • With no alias for "compatibility", serde would throw a deserialization error for those subjects, causing get_subject to fail entirely — meaning any subject with a non-default compatibility level couldn't be loaded. Only subjects inheriting the global BACKWARD default would display successfully, making it appear that all subjects were BACKWARD.

Fix

Added alias = "compatibility" alongside the existing alias = "compatibilityLevel" on the CompatibilityResponse struct so both response shapes are handled correctly.

Test plan

  • Added two unit tests in backend/src/core/schema_registry/client.rs using httpmock:
    • test_get_subject_compatibility_level_field — covers {"compatibilityLevel": "..."} (Confluent global fallback, pre-existing behaviour)
    • test_get_subject_compatibility_field — covers {"compatibility": "..."} (Confluent subject-specific override / Karapace; this test would have failed before the fix)
  • Manually verify a subject with an explicit non-default compatibility level (e.g. FORWARD) now displays correctly rather than failing to load

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant