Skip to content

Commit 1834353

Browse files
fduttonFaron Dutton
andauthored
Adds support for handling integer overflow (#777)
Resolves #776 Co-authored-by: Faron Dutton <[email protected]>
1 parent ba4b910 commit 1834353

File tree

2 files changed

+1
-5
lines changed

2 files changed

+1
-5
lines changed

src/main/java/com/networknt/schema/utils/JsonNodeUtil.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public static boolean equalsToSchemaType(JsonNode node, JsonType schemaType, Jso
4848
if (schemaType == JsonType.NUMBER && nodeType == JsonType.INTEGER) {
4949
return true;
5050
}
51-
if (schemaType == JsonType.INTEGER && nodeType == JsonType.NUMBER && 1.0 == node.asDouble() && V6_VALUE <= detectVersion(validationContext)) {
51+
if (schemaType == JsonType.INTEGER && nodeType == JsonType.NUMBER && node.canConvertToExactIntegral() && V6_VALUE <= detectVersion(validationContext)) {
5252
return true;
5353
}
5454

src/test/java/com/networknt/schema/JsonSchemaTestSuiteTest.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,6 @@ private void disableV202012Tests() {
7676
this.disabled.add(Paths.get("src/test/suite/tests/draft2020-12/dynamicRef.json"));
7777
this.disabled.add(Paths.get("src/test/suite/tests/draft2020-12/id.json"));
7878
this.disabled.add(Paths.get("src/test/suite/tests/draft2020-12/optional/cross-draft.json"));
79-
this.disabled.add(Paths.get("src/test/suite/tests/draft2020-12/optional/float-overflow.json"));
8079
this.disabled.add(Paths.get("src/test/suite/tests/draft2020-12/optional/format-assertion.json"));
8180
this.disabled.add(Paths.get("src/test/suite/tests/draft2020-12/ref.json"));
8281
this.disabled.add(Paths.get("src/test/suite/tests/draft2020-12/refRemote.json"));
@@ -88,7 +87,6 @@ private void disableV201909Tests() {
8887
this.disabled.add(Paths.get("src/test/suite/tests/draft2019-09/defs.json"));
8988
this.disabled.add(Paths.get("src/test/suite/tests/draft2019-09/id.json"));
9089
this.disabled.add(Paths.get("src/test/suite/tests/draft2019-09/optional/cross-draft.json"));
91-
this.disabled.add(Paths.get("src/test/suite/tests/draft2019-09/optional/float-overflow.json"));
9290
this.disabled.add(Paths.get("src/test/suite/tests/draft2019-09/recursiveRef.json"));
9391
this.disabled.add(Paths.get("src/test/suite/tests/draft2019-09/ref.json"));
9492
this.disabled.add(Paths.get("src/test/suite/tests/draft2019-09/refRemote.json"));
@@ -100,13 +98,11 @@ private void disableV7Tests() {
10098
this.disabled.add(Paths.get("src/test/suite/tests/draft7/defs.json"));
10199
this.disabled.add(Paths.get("src/test/suite/tests/draft7/optional/content.json"));
102100
this.disabled.add(Paths.get("src/test/suite/tests/draft7/optional/cross-draft.json"));
103-
this.disabled.add(Paths.get("src/test/suite/tests/draft7/optional/float-overflow.json"));
104101
this.disabled.add(Paths.get("src/test/suite/tests/draft7/ref.json"));
105102
this.disabled.add(Paths.get("src/test/suite/tests/draft7/refRemote.json"));
106103
}
107104

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

0 commit comments

Comments
 (0)