Skip to content

Commit eca5f52

Browse files
committed
Require JSON Schema bignum support for arbitrary sized numbers
Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>
1 parent 1a2f01f commit eca5f52

36 files changed

Lines changed: 364 additions & 831 deletions

schemas/w3c/xmlschema/2001/decimal.json

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,9 @@
22
"$schema": "https://json-schema.org/draft/2020-12/schema",
33
"title": "W3C XML Schema decimal",
44
"description": "The decimal datatype represents arbitrary precision decimal numbers (§3.2.3)",
5-
"$comment": "XML Schema requires minimally conforming processors to support decimal numbers with a minimum of 18 decimal digits (totalDigits). JSON's number type (IEEE 754 double-precision) provides only 15-17 significant decimal digits, which does not meet this minimum requirement. This schema uses string representation to maintain XML Schema conformance",
6-
"examples": [
7-
"-1.23",
8-
"12678967.543233",
9-
"+100000.00",
10-
"210",
11-
"0",
12-
"-0",
13-
"3.14159265358979323846"
14-
],
5+
"$comment": "XML Schema requires minimally conforming processors to support decimal numbers with a minimum of 18 decimal digits (totalDigits). JSON's number type (IEEE 754 double-precision) provides only 15-17 significant decimal digits. To properly validate arbitrary precision decimals, use a JSON Schema evaluator that supports arbitrary precision number handling",
6+
"examples": [ -1.23, 1.2679e+07, 100000.0, 210, 0, 3.14159 ],
157
"x-license": "https://github.com/sourcemeta/std/blob/main/LICENSE",
168
"x-links": [ "https://www.w3.org/TR/xmlschema-2/#decimal" ],
17-
"type": "string",
18-
"pattern": "^[+-]?([0-9]+\\.[0-9]+|[0-9]+)$"
9+
"type": "number"
1910
}

schemas/w3c/xmlschema/2001/integer.json

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,9 @@
22
"$schema": "https://json-schema.org/draft/2020-12/schema",
33
"title": "W3C XML Schema integer",
44
"description": "Represents arbitrary-sized integers derived from decimal (§3.3.13)",
5-
"$comment": "XML Schema supports arbitrary precision. JSON Schema's integer type is limited to the 64-bit range for safe interoperability per RFC 8259. This schema uses string representation to maintain XML Schema's arbitrary precision semantics",
6-
"examples": [
7-
"0",
8-
"1",
9-
"-1",
10-
"42",
11-
"-273",
12-
"12678967543233",
13-
"-9999999999999999",
14-
"999999999999999999999999999999"
15-
],
5+
"$comment": "XML Schema supports arbitrary precision integers. JSON's number type is limited to the safe integer range (±2^53-1) per IEEE 754. To properly validate arbitrary precision integers, use a JSON Schema evaluator that supports arbitrary precision integer handling",
6+
"examples": [ 0, 1, -1, 42, -273, 12678967543233, -9999999999999999 ],
167
"x-license": "https://github.com/sourcemeta/std/blob/main/LICENSE",
178
"x-links": [ "https://www.w3.org/TR/xmlschema-2/#integer" ],
18-
"type": "string",
19-
"pattern": "^[+-]?(0|[1-9][0-9]*)$"
9+
"type": "integer"
2010
}

schemas/w3c/xmlschema/2001/negative-integer.json

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,10 @@
22
"$schema": "https://json-schema.org/draft/2020-12/schema",
33
"title": "W3C XML Schema negativeInteger",
44
"description": "Represents strictly negative integers (§3.3.15)",
5-
"$comment": "XML Schema supports arbitrary precision. JSON Schema's integer type is limited to the 64-bit range for safe interoperability per RFC 8259. This schema uses string representation to maintain XML Schema's arbitrary precision semantics",
6-
"examples": [
7-
"-1",
8-
"-42",
9-
"-1000",
10-
"-9223372036854775808",
11-
"-999999999999999999999999999999"
12-
],
5+
"$comment": "XML Schema supports arbitrary precision integers. JSON's number type is limited to the safe integer range (±2^53-1) per IEEE 754. To properly validate arbitrary precision integers, use a JSON Schema evaluator that supports arbitrary precision integer handling",
6+
"examples": [ -1, -42, -1000, -9223372036854775808 ],
137
"x-license": "https://github.com/sourcemeta/std/blob/main/LICENSE",
148
"x-links": [ "https://www.w3.org/TR/xmlschema-2/#negativeInteger" ],
15-
"type": "string",
16-
"pattern": "^-[1-9][0-9]*$"
9+
"type": "integer",
10+
"maximum": -1
1711
}

schemas/w3c/xmlschema/2001/non-negative-integer.json

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,10 @@
22
"$schema": "https://json-schema.org/draft/2020-12/schema",
33
"title": "W3C XML Schema nonNegativeInteger",
44
"description": "Represents integers greater than or equal to zero (§3.3.20)",
5-
"$comment": "XML Schema supports arbitrary precision. JSON Schema's integer type is limited to the 64-bit range for safe interoperability per RFC 8259. This schema uses string representation to maintain XML Schema's arbitrary precision semantics",
6-
"examples": [
7-
"0",
8-
"1",
9-
"42",
10-
"1000",
11-
"9223372036854775807",
12-
"999999999999999999999999999999"
13-
],
5+
"$comment": "XML Schema supports arbitrary precision integers. JSON's number type is limited to the safe integer range (±2^53-1) per IEEE 754. To properly validate arbitrary precision integers, use a JSON Schema evaluator that supports arbitrary precision integer handling",
6+
"examples": [ 0, 1, 42, 1000, 9223372036854775807 ],
147
"x-license": "https://github.com/sourcemeta/std/blob/main/LICENSE",
158
"x-links": [ "https://www.w3.org/TR/xmlschema-2/#nonNegativeInteger" ],
16-
"type": "string",
17-
"pattern": "^(0|[1-9][0-9]*)$"
9+
"type": "integer",
10+
"minimum": 0
1811
}

schemas/w3c/xmlschema/2001/non-positive-integer.json

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,10 @@
22
"$schema": "https://json-schema.org/draft/2020-12/schema",
33
"title": "W3C XML Schema nonPositiveInteger",
44
"description": "Represents integers less than or equal to zero (§3.3.14)",
5-
"$comment": "XML Schema supports arbitrary precision. JSON Schema's integer type is limited to the 64-bit range for safe interoperability per RFC 8259. This schema uses string representation to maintain XML Schema's arbitrary precision semantics",
6-
"examples": [
7-
"0",
8-
"-1",
9-
"-42",
10-
"-1000",
11-
"-9223372036854775808",
12-
"-999999999999999999999999999999"
13-
],
5+
"$comment": "XML Schema supports arbitrary precision integers. JSON's number type is limited to the safe integer range (±2^53-1) per IEEE 754. To properly validate arbitrary precision integers, use a JSON Schema evaluator that supports arbitrary precision integer handling",
6+
"examples": [ 0, -1, -42, -1000, -9223372036854775808 ],
147
"x-license": "https://github.com/sourcemeta/std/blob/main/LICENSE",
158
"x-links": [ "https://www.w3.org/TR/xmlschema-2/#nonPositiveInteger" ],
16-
"type": "string",
17-
"pattern": "^(0|-[1-9][0-9]*)$"
9+
"type": "integer",
10+
"maximum": 0
1811
}

schemas/w3c/xmlschema/2001/positive-integer.json

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,10 @@
22
"$schema": "https://json-schema.org/draft/2020-12/schema",
33
"title": "W3C XML Schema positiveInteger",
44
"description": "Represents strictly positive integers (§3.3.25)",
5-
"$comment": "XML Schema supports arbitrary precision. JSON Schema's integer type is limited to the 64-bit range for safe interoperability per RFC 8259. This schema uses string representation to maintain XML Schema's arbitrary precision semantics",
6-
"examples": [
7-
"1",
8-
"42",
9-
"1000",
10-
"9223372036854775807",
11-
"999999999999999999999999999999"
12-
],
5+
"$comment": "XML Schema supports arbitrary precision integers. JSON's number type is limited to the safe integer range (±2^53-1) per IEEE 754. To properly validate arbitrary precision integers, use a JSON Schema evaluator that supports arbitrary precision integer handling",
6+
"examples": [ 1, 42, 1000, 9223372036854775807 ],
137
"x-license": "https://github.com/sourcemeta/std/blob/main/LICENSE",
148
"x-links": [ "https://www.w3.org/TR/xmlschema-2/#positiveInteger" ],
15-
"type": "string",
16-
"pattern": "^[1-9][0-9]*$"
9+
"type": "integer",
10+
"minimum": 1
1711
}

schemas/w3c/xmlschema/2001/unsigned-long.json

Lines changed: 4 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -2,74 +2,10 @@
22
"$schema": "https://json-schema.org/draft/2020-12/schema",
33
"title": "W3C XML Schema unsignedLong",
44
"description": "Represents 64-bit unsigned integers (§3.3.21)",
5-
"$comment": "XML Schema unsignedLong supports the 64-bit unsigned range, but JSON Schema's integer type is limited to signed 64-bit integers. This schema uses string representation to maintain full XML Schema conformance",
6-
"examples": [
7-
"0",
8-
"1",
9-
"18446744073709551615",
10-
"9223372036854775808",
11-
"4294967296"
12-
],
5+
"$comment": "XML Schema supports arbitrary precision integers. JSON's number type is limited to the safe integer range (±2^53-1) per IEEE 754. To properly validate arbitrary precision integers, use a JSON Schema evaluator that supports arbitrary precision integer handling",
6+
"examples": [ 0, 1, 9007199254740991, 4294967296 ],
137
"x-license": "https://github.com/sourcemeta/std/blob/main/LICENSE",
148
"x-links": [ "https://www.w3.org/TR/xmlschema-2/#unsignedLong" ],
15-
"type": "string",
16-
"anyOf": [
17-
{
18-
"pattern": "^0$"
19-
},
20-
{
21-
"pattern": "^[1-9][0-9]{0,18}$"
22-
},
23-
{
24-
"pattern": "^1[0-7][0-9]{18}$"
25-
},
26-
{
27-
"pattern": "^18[0-3][0-9]{17}$"
28-
},
29-
{
30-
"pattern": "^184[0-3][0-9]{16}$"
31-
},
32-
{
33-
"pattern": "^1844[0-5][0-9]{15}$"
34-
},
35-
{
36-
"pattern": "^18446[0-6][0-9]{14}$"
37-
},
38-
{
39-
"pattern": "^184467[0-3][0-9]{13}$"
40-
},
41-
{
42-
"pattern": "^1844674[0-3][0-9]{12}$"
43-
},
44-
{
45-
"pattern": "^184467440[0-6][0-9]{10}$"
46-
},
47-
{
48-
"pattern": "^1844674407[0-2][0-9]{9}$"
49-
},
50-
{
51-
"pattern": "^18446744073[0-6][0-9]{8}$"
52-
},
53-
{
54-
"pattern": "^1844674407370[0-8][0-9]{6}$"
55-
},
56-
{
57-
"pattern": "^18446744073709[0-4][0-9]{5}$"
58-
},
59-
{
60-
"pattern": "^184467440737095[0-4][0-9]{4}$"
61-
},
62-
{
63-
"pattern": "^1844674407370955[0][0-9]{3}$"
64-
},
65-
{
66-
"pattern": "^18446744073709551[0-5][0-9]{2}$"
67-
},
68-
{
69-
"pattern": "^184467440737095516[0][0-9]$"
70-
},
71-
{
72-
"pattern": "^1844674407370955161[0-5]$"
73-
}
74-
]
9+
"type": "integer",
10+
"minimum": 0
7511
}

schemas/xbrl/instance/2003/decimal-item-type.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"$schema": "https://json-schema.org/draft/2020-12/schema",
33
"title": "XBRL decimalItemType",
44
"description": "XBRL item type for decimal values. Based on W3C XML Schema decimal",
5-
"examples": [ "123.45", "-67.89", "0.0" ],
5+
"examples": [ 123.45, -67.89, 0.0 ],
66
"x-license": "https://github.com/sourcemeta/std/blob/main/LICENSE",
77
"x-links": [
88
"https://www.xbrl.org/Specification/XBRL-2.1/REC-2003-12-31/XBRL-2.1-REC-2003-12-31+corrected-errata-2013-02-20.html#_5.1.1.3",

schemas/xbrl/instance/2003/fraction-item-type.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
"title": "XBRL fractionItemType",
44
"description": "XBRL item type for fractional values with explicit numerator and denominator. Represented as a two-element array of W3C XML Schema decimal values",
55
"examples": [
6-
[ "1.5", "2" ],
7-
[ "-100", "3.5" ],
8-
[ "5", "-2.5" ],
9-
[ "0", "1" ]
6+
[ 1.5, 2 ],
7+
[ -100, 3.5 ],
8+
[ 5, -2.5 ],
9+
[ 0, 1 ]
1010
],
1111
"x-license": "https://github.com/sourcemeta/std/blob/main/LICENSE",
1212
"x-links": [
@@ -23,7 +23,7 @@
2323
{
2424
"$ref": "../../../w3c/xmlschema/2001/decimal.json",
2525
"not": {
26-
"pattern": "^-?0+(\\.0+)?$"
26+
"const": 0
2727
}
2828
}
2929
]

schemas/xbrl/instance/2003/integer-item-type.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"$schema": "https://json-schema.org/draft/2020-12/schema",
33
"title": "XBRL integerItemType",
44
"description": "XBRL item type for arbitrary-precision signed integers. Based on W3C XML Schema integer",
5-
"examples": [ "42", "-100", "0" ],
5+
"examples": [ 42, -100, 0 ],
66
"x-license": "https://github.com/sourcemeta/std/blob/main/LICENSE",
77
"x-links": [
88
"https://www.xbrl.org/Specification/XBRL-2.1/REC-2003-12-31/XBRL-2.1-REC-2003-12-31+corrected-errata-2013-02-20.html#_5.1.1.3",

0 commit comments

Comments
 (0)