Improve type validation of integrals #496
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Instead of doing string comparison, use new jackson method to determine if a number is an integral.
The
javaSemantics
config option was added in PR #343 which partially addressed issue #334. In the notes for this PR:jackson-databind has been updated to 2.12.1 so this is available but the change has not yet been made.
PR #450 which addressed #446 missed this location which is used when calling
JsonSchemaFactory.getSchema
.Issue #344 requested coercion of various types but the only type implemented in PR #379 was lossless narrowing, set with configuration option
losslessNarrowing
. I believe that setting is unnecessary now as this implementation ofjavaSemantics
addresses the original issue, but left it for backwards compatibility. It also allows you to setjavaSemantics=false
andlosslessNarrowing=true
to achieve only this specific case rather than anything thatjavaSemantics
is used for in the future. At this time, these properties do exactly the same thing.canConvertToExactIntegral
forjavaSemantics
andlosslessNarrowing
losslessNarrowing