Skip to content

Commit e4c7f53

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 e784d5d commit e4c7f53

File tree

2 files changed

+31
-14
lines changed

2 files changed

+31
-14
lines changed

jsonschema-validation.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,9 @@
246246
<t>
247247
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.
248248
</t>
249+
<t>
250+
If "exclusiveMaximum" is a boolean, then "maximum" MUST be present, and "exclusiveMinimum" (if present) MUST also be a boolean.
251+
</t>
249252
<t>
250253
<cref>The boolean form of "exclusiveMaximum" is expected to be removed in the future.</cref>
251254
</t>
@@ -269,6 +272,9 @@
269272
<t>
270273
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.
271274
</t>
275+
<t>
276+
If "exclusiveMinimum" is a boolean, then "minimum" MUST be present, and "exclusiveMaximum" (if present) MUST also be a boolean.
277+
</t>
272278
<t>
273279
<cref>The boolean form of "exclusiveMinimum" is expected to be removed in the future.</cref>
274280
</t>

schema.json

Lines changed: 25 additions & 14 deletions
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+
"exclusiveMinimum": {
68+
"type": "number"
69+
},
70+
"exclusiveMaximum": {
71+
"type": "maximum"
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": {
@@ -155,9 +170,5 @@
155170
"oneOf": { "$ref": "#/definitions/schemaArray" },
156171
"not": { "$ref": "#" }
157172
},
158-
"dependencies": {
159-
"exclusiveMaximum": [ "maximum" ],
160-
"exclusiveMinimum": [ "minimum" ]
161-
},
162173
"default": {}
163174
}

0 commit comments

Comments
 (0)