File tree Expand file tree Collapse file tree 4 files changed +19
-3
lines changed
src/main/java/com/networknt/schema Expand file tree Collapse file tree 4 files changed +19
-3
lines changed Original file line number Diff line number Diff line change @@ -9,6 +9,14 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
9
9
10
10
### Changed
11
11
12
+ ## 1.0.9 - 2019-05-21
13
+
14
+ ### Added
15
+
16
+ ### Changed
17
+
18
+ - fixes #147 Fails to validate MIN and MAX when number type is converted to BigInteger. Thanks @jiachen1120
19
+
12
20
## 1.0.8 - 2019-05-17
13
21
14
22
### Added
Original file line number Diff line number Diff line change 19
19
<modelVersion >4.0.0</modelVersion >
20
20
<groupId >com.networknt</groupId >
21
21
<artifactId >json-schema-validator</artifactId >
22
- <version >1.0.8 </version >
22
+ <version >1.0.9 </version >
23
23
<packaging >bundle</packaging >
24
24
<description >A json schema validator that supports draft v4</description >
25
25
<url >https://github.com/networknt/json-schema-validator</url >
Original file line number Diff line number Diff line change @@ -71,7 +71,11 @@ public String thresholdValue() {
71
71
@ Override
72
72
public boolean crossesThreshold (JsonNode node ) {
73
73
long val = node .asLong ();
74
- return node .isBigInteger () || lm < val || (excludeEqual && lm <= val );
74
+ if (node .isBigInteger ()) {
75
+ //node.isBigInteger is not trustable, the type BigInteger doesn't mean it is a big number.
76
+ return node .bigIntegerValue ().compareTo (new BigInteger (String .valueOf (Long .MAX_VALUE ))) > 0 ;
77
+ }
78
+ return lm < val || (excludeEqual && lm <= val );
75
79
}
76
80
77
81
@ Override
Original file line number Diff line number Diff line change @@ -74,7 +74,11 @@ public String thresholdValue() {
74
74
@ Override
75
75
public boolean crossesThreshold (JsonNode node ) {
76
76
long val = node .asLong ();
77
- return node .isBigInteger () || lmin > val || (excluded && lmin >= val );
77
+ if (node .isBigInteger ()) {
78
+ //node.isBigInteger is not trustable, the type BigInteger doesn't mean it is a big number.
79
+ return node .bigIntegerValue ().compareTo (new BigInteger (String .valueOf (Long .MIN_VALUE ))) < 0 ;
80
+ }
81
+ return lmin > val || (excluded && lmin >= val );
78
82
}
79
83
80
84
@ Override
You can’t perform that action at this time.
0 commit comments