Skip to content

Commit 15ff80c

Browse files
committed
Restore exclusive* dependencies, update metaschema
This restores dependencies that got dropped somewhere between draft 04 and 05 (not clear where). It adds a reasonable restriction that the boolean vs numeric forms not be mixed for exclusiveMinimum and exclusiveMaximum, and implements the correct meta-scheam for this. Which needs a oneOf to corectly group the dependencies, but no longer needs an extra allOf or anyOf to allow minimum and maximum to change types independently.
1 parent cd171f5 commit 15ff80c

File tree

2 files changed

+31
-14
lines changed

2 files changed

+31
-14
lines changed

jsonschema-validation.xml

+6
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,9 @@
257257
<t>
258258
The value of "exclusiveMaximum" MUST be number, representing an exclusive upper limit for a numeric instance, or a boolean. Schemas SHOULD NOT use the boolean form.
259259
</t>
260+
<t>
261+
If "exclusiveMaximum" is a boolean, then "maximum" MUST be present, and "exclusiveMinimum" (if present) MUST also be a boolean.
262+
</t>
260263
<t>
261264
<cref>The boolean form of "exclusiveMaximum" is expected to be removed in the future.</cref>
262265
</t>
@@ -280,6 +283,9 @@
280283
<t>
281284
The value of "exclusiveMinimum" MUST be number, representing an exclusive upper limit for a numeric instance, or a boolean. Schemas SHOULD NOT use the boolean form.
282285
</t>
286+
<t>
287+
If "exclusiveMinimum" is a boolean, then "minimum" MUST be present, and "exclusiveMaximum" (if present) MUST also be a boolean.
288+
</t>
283289
<t>
284290
<cref>The boolean form of "exclusiveMinimum" is expected to be removed in the future.</cref>
285291
</t>

schema.json

+25-14
Original file line numberDiff line numberDiff line change
@@ -54,23 +54,38 @@
5454
"default": {},
5555
"multipleOf": {
5656
"type": "number",
57-
"minimum": 0,
58-
"exclusiveMinimum": true
57+
"exclusiveMinimum": 0
5958
},
6059
"maximum": {
6160
"type": "number"
6261
},
63-
"exclusiveMaximum": {
64-
"type": "boolean",
65-
"default": false
66-
},
6762
"minimum": {
6863
"type": "number"
6964
},
70-
"exclusiveMinimum": {
71-
"type": "boolean",
72-
"default": false
73-
},
65+
"oneOf": [
66+
{
67+
"exclusiveMaximum": {
68+
"type": "number"
69+
},
70+
"exclusiveMinimum": {
71+
"type": "number"
72+
}
73+
},
74+
{
75+
"exclusiveMaximum": {
76+
"type": "boolean",
77+
"default": false
78+
},
79+
"exclusiveMinimum": {
80+
"type": "boolean",
81+
"default": false
82+
},
83+
"dependencies": {
84+
"exclusiveMaximum": [ "maximum" ],
85+
"exclusiveMinimum": [ "minimum" ]
86+
}
87+
}
88+
],
7489
"maxLength": { "$ref": "#/definitions/positiveInteger" },
7590
"minLength": { "$ref": "#/definitions/positiveIntegerDefault0" },
7691
"pattern": {
@@ -144,9 +159,5 @@
144159
"oneOf": { "$ref": "#/definitions/schemaArray" },
145160
"not": { "$ref": "#" }
146161
},
147-
"dependencies": {
148-
"exclusiveMaximum": [ "maximum" ],
149-
"exclusiveMinimum": [ "minimum" ]
150-
},
151162
"default": {}
152163
}

0 commit comments

Comments
 (0)