-
Notifications
You must be signed in to change notification settings - Fork 593
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
sr/json: support drafts 201909 and 202012 with jsoncons #21473
Conversation
Fix for heap-buffer-overflow: danielaparker/jsoncons#528 |
Force-pushed to fix the failing oss build. Git cloning an untagged hash doesn't seem to work easily with FetchContent so I went with pulling it in as a tarball from github. This is similar to how the new bazel build pulls in its dependencies. |
fyi may need to update this: https://github.com/redpanda-data/redpanda/blob/dev/licenses/third_party.md |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No objections
This is needed because the next commit introduces jsoncons for validating json schemas against their draft's metaschema and jsoncons does not have support for draft 5. Other schema registries do not support draft 5 either, so it is unlikely that we would have customers that need to use draft 5 explicitly (and can't just use the largely equivalent draft 4).
* Add an error test case for a schema that is invalid for the specific draft's metaschema only. * Add an assertion that invalid schemas do raise an error.
To be used in the next commit.
rapidjson does not support validating schemas above draft 5, so previously we have been rewriting newer schemas in draft 4's metaschema in order to validate them. This is error prone and gets increasingly complicated for later drafts. Instead, this commit pulls in the jsoncons library which has support for validing schemas in drafts 4, 6, 7, 2019-09, 2020-12, which covers our expected use cases.
This adds support for validating schemas of the 2019-09 and 2020-12 drafts. The assertion keywords introduced in these drafts are not yet validated for compatibility across successive schema versions. The implementation of these keywords is going to be implemented later. https://json-schema.org/draft/2019-09/release-notes https://json-schema.org/draft/2020-12/release-notes
Force-pushed: rebased to dev and added jsoncons to third_party.md with its Boost v1 license: ada73ff |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
probably there will be merge conflicts with #21354 (or vice-versa, whichever gets merged before)
/backport v24.2.x |
rapidjson does not support validating schemas above draft 5, so previously we have been rewriting newer schemas in draft 4's metaschema in order to validate them. This is error prone and gets increasingly complicated for later drafts.
Instead, here we implement validating schemas against their metaschemas using the jsoncons library which has support for drafts 4, 6, 7, 2019-09, 2020-12, which covers our expected use cases.
As part of this, we also extend support for the 2019-09 and 2020-12 drafts.
Fixes https://redpandadata.atlassian.net/browse/CORE-5088
Fixes https://redpandadata.atlassian.net/browse/CORE-5089
Depends on https://github.com/redpanda-data/vtools/pull/2963
Backports Required
Release Notes