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

DGS-8542 Add support for JSON Schema Draft 2020-12 #2781

Merged
merged 4 commits into from Oct 10, 2023

Conversation

rayokota
Copy link
Member

@rayokota rayokota commented Oct 5, 2023

Add support for JSON Schema Draft 2020-12.

We use the json-skema library for draft 2020-12 and the everit library for previous drafts. When iterating over a schema, we use the object model from everit since it is easier to work with. We therefore translate from the json-skema classes to the everit classes whenever we need an object model to traverse.

Fixes #2534 , fixes #2580

@rayokota rayokota requested a review from a team as a code owner October 5, 2023 15:49
Copy link
Member

@akhileshm1 akhileshm1 left a comment

Choose a reason for hiding this comment

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

thanks @rayokota. this is great!

Comment on lines +101 to +106
BigDecimal updateMultipleOf = update.getMultipleOf() != null
? new BigDecimal(update.getMultipleOf().toString())
: null;
BigDecimal originalMultipleOf = original.getMultipleOf() != null
? new BigDecimal(original.getMultipleOf().toString())
: null;
Copy link
Member

Choose a reason for hiding this comment

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

for my own understanding, why are we doing the conversion to BigDecimal here?

Copy link
Member Author

@rayokota rayokota Oct 9, 2023

Choose a reason for hiding this comment

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

We convert to BigDecimal so we can accurately tell if the new multipleOf value is a multiple of the old multipleOf value when the values are decimals. For example, to tell if 0.002 is a multiple of 0.001. Otherwise this ends being a modulus of floating point numbers, which is not always accurate.

@rayokota rayokota merged commit 8944db1 into confluentinc:master Oct 10, 2023
4 checks passed
@rayokota rayokota deleted the json-schema-2020-12-master branch October 10, 2023 00:09
@paul-feuer
Copy link

hi! when is the next release? I see a release from a few days before this merge

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants