Skip to content

Commit

Permalink
Adds support for handling integer overflow
Browse files Browse the repository at this point in the history
Resolves #776
  • Loading branch information
Faron Dutton committed May 20, 2023
1 parent ba4b910 commit 6b259ed
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 5 deletions.
2 changes: 1 addition & 1 deletion src/main/java/com/networknt/schema/utils/JsonNodeUtil.java
Expand Up @@ -48,7 +48,7 @@ public static boolean equalsToSchemaType(JsonNode node, JsonType schemaType, Jso
if (schemaType == JsonType.NUMBER && nodeType == JsonType.INTEGER) {
return true;
}
if (schemaType == JsonType.INTEGER && nodeType == JsonType.NUMBER && 1.0 == node.asDouble() && V6_VALUE <= detectVersion(validationContext)) {
if (schemaType == JsonType.INTEGER && nodeType == JsonType.NUMBER && node.canConvertToExactIntegral() && V6_VALUE <= detectVersion(validationContext)) {
return true;
}

Expand Down
Expand Up @@ -76,7 +76,6 @@ private void disableV202012Tests() {
this.disabled.add(Paths.get("src/test/suite/tests/draft2020-12/dynamicRef.json"));
this.disabled.add(Paths.get("src/test/suite/tests/draft2020-12/id.json"));
this.disabled.add(Paths.get("src/test/suite/tests/draft2020-12/optional/cross-draft.json"));
this.disabled.add(Paths.get("src/test/suite/tests/draft2020-12/optional/float-overflow.json"));
this.disabled.add(Paths.get("src/test/suite/tests/draft2020-12/optional/format-assertion.json"));
this.disabled.add(Paths.get("src/test/suite/tests/draft2020-12/ref.json"));
this.disabled.add(Paths.get("src/test/suite/tests/draft2020-12/refRemote.json"));
Expand All @@ -88,7 +87,6 @@ private void disableV201909Tests() {
this.disabled.add(Paths.get("src/test/suite/tests/draft2019-09/defs.json"));
this.disabled.add(Paths.get("src/test/suite/tests/draft2019-09/id.json"));
this.disabled.add(Paths.get("src/test/suite/tests/draft2019-09/optional/cross-draft.json"));
this.disabled.add(Paths.get("src/test/suite/tests/draft2019-09/optional/float-overflow.json"));
this.disabled.add(Paths.get("src/test/suite/tests/draft2019-09/recursiveRef.json"));
this.disabled.add(Paths.get("src/test/suite/tests/draft2019-09/ref.json"));
this.disabled.add(Paths.get("src/test/suite/tests/draft2019-09/refRemote.json"));
Expand All @@ -100,13 +98,11 @@ private void disableV7Tests() {
this.disabled.add(Paths.get("src/test/suite/tests/draft7/defs.json"));
this.disabled.add(Paths.get("src/test/suite/tests/draft7/optional/content.json"));
this.disabled.add(Paths.get("src/test/suite/tests/draft7/optional/cross-draft.json"));
this.disabled.add(Paths.get("src/test/suite/tests/draft7/optional/float-overflow.json"));
this.disabled.add(Paths.get("src/test/suite/tests/draft7/ref.json"));
this.disabled.add(Paths.get("src/test/suite/tests/draft7/refRemote.json"));
}

private void disableV6Tests() {
this.disabled.add(Paths.get("src/test/suite/tests/draft6/optional/float-overflow.json"));
this.disabled.add(Paths.get("src/test/suite/tests/draft6/optional/format.json"));
this.disabled.add(Paths.get("src/test/suite/tests/draft6/ref.json"));
this.disabled.add(Paths.get("src/test/suite/tests/draft6/refRemote.json"));
Expand Down

0 comments on commit 6b259ed

Please sign in to comment.