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

[v24.2.x] CORE-6861 Schema Registry: verbose compat checks for JSON #23299

Merged

Conversation

vbotbuildovich
Copy link
Collaborator

Backport of PR #23208

Adds a helper for constructing singleton `raw_compatibility_result`'s.

(cherry picked from commit 81fea0a)
Define `operator==` and `operator<<` for `compatibility_result` to allow
using it in `BOOST_REQUIRE_EQ` in tests.

(cherry picked from commit 7a80f8c)
Add all json incompatibility types that we expect to report with their
descriptions matching the reference implementation.

(cherry picked from commit 9c7ccc5)
Pure refactor, no behaviour change intended.

Make a small change to the method to make the diff in the following
commit simpler to read and reason about.

(cherry picked from commit a89af69)
Pure refactor, no behaviour change intended.

Make a small change to the method to make the diff in the following
commit simpler to read and reason about.

(cherry picked from commit ea4af04)
Pure refactor, no behaviour change intended.

Make a small change to the method to make the diff in the following
commit simpler to read and reason about.

New tests are also added (they passed before too).

(cherry picked from commit ff98239)
Adapt the json compatibility check code to report the exact reason of
the incompatibility that is causing the compatibility check to fail.

Tests are adapted to now make checks explicitly on the reported
incompatibilities instead of just the boolean of whether the change is
compatible or not.

Note that because our json compatibility checks are expressed as forward
compatibility checks and not backward compatibility checks, the names of
the error types are always the inverse of what the surrounding code and
comments express. For example, we report the `additional_items_removed`
error when `newer` has `additionalItems` but `older` does not.

Some general patterns in this change are:
 * return false --> add a specific error
 * return true --> return a non-error result
 * return is_superset(...) --> depending on how the reference
   implementation works one of the following is chosen:
    - Forward the result:
        return is_superset(...)
    - Merge the result and continue to gather more:
        res.merge(is_superset(...))
    - Merge the result and add a more specific error:
        res.merge(is_superset(...));
        res.emplace(...)
    - Only add a specific error if the result has an error:
        res.emplace(...)

(cherry picked from commit 337e067)
Add a smoketest to further test that multiple (as many as possible)
errors are reported for a complex schema. This is checked in both the
forward and backward direction.

(cherry picked from commit ca18cfb)
Extend the verbose compatibility message test to include json as well.

(cherry picked from commit 6b16be3)
@vbotbuildovich vbotbuildovich added this to the v24.2.x-next milestone Sep 12, 2024
@vbotbuildovich vbotbuildovich added the kind/backport PRs targeting a stable branch label Sep 12, 2024
@pgellert pgellert merged commit 8306547 into redpanda-data:v24.2.x Sep 12, 2024
20 checks passed
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/redpanda kind/backport PRs targeting a stable branch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants