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
DGS-8542 Add support for JSON Schema Draft 2020-12 #2781
Conversation
1f579a2
to
e21611d
Compare
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.
thanks @rayokota. this is great!
...hema-provider/src/main/java/io/confluent/kafka/schemaregistry/json/SpecificationVersion.java
Outdated
Show resolved
Hide resolved
...hema-provider/src/main/java/io/confluent/kafka/schemaregistry/json/SpecificationVersion.java
Show resolved
Hide resolved
BigDecimal updateMultipleOf = update.getMultipleOf() != null | ||
? new BigDecimal(update.getMultipleOf().toString()) | ||
: null; | ||
BigDecimal originalMultipleOf = original.getMultipleOf() != null | ||
? new BigDecimal(original.getMultipleOf().toString()) | ||
: null; |
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.
for my own understanding, why are we doing the conversion to BigDecimal
here?
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.
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.
...r/src/main/java/io/confluent/kafka/schemaregistry/json/jackson/JsonSkemaArraySerializer.java
Show resolved
Hide resolved
.../src/main/java/io/confluent/kafka/schemaregistry/json/jackson/JsonSkemaObjectSerializer.java
Show resolved
Hide resolved
hi! when is the next release? I see a release from a few days before this merge |
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