Skip to content

Commit f7881f8

Browse files
committed
Allow an empty array for "required".
This addresses the enhancement requested in issue json-schema-org#69.
1 parent df8d370 commit f7881f8

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

jsonschema-validation.xml

+2-3
Original file line numberDiff line numberDiff line change
@@ -397,9 +397,8 @@
397397

398398
<section title="required">
399399
<t>
400-
The value of this keyword MUST be an array. This array MUST have at
401-
least one element. Elements of this array MUST be strings, and MUST be
402-
unique.
400+
The value of this keyword MUST be an array. Elements of this array
401+
MUST be strings, and MUST be unique.
403402
</t>
404403
<t>
405404
An object instance is valid against this keyword if its

schema.json

+4-2
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,10 @@
2121
"stringArray": {
2222
"type": "array",
2323
"items": { "type": "string" },
24-
"minItems": 1,
2524
"uniqueItems": true
25+
},
26+
"nonEmptyStringArray": {
27+
"allOf": [ { "$ref": "#/definitions/stringArray" }, { "minItems": 1 } ]
2628
}
2729
},
2830
"type": "object",
@@ -117,7 +119,7 @@
117119
"additionalProperties": {
118120
"anyOf": [
119121
{ "$ref": "#" },
120-
{ "$ref": "#/definitions/stringArray" }
122+
{ "$ref": "#/definitions/nonEmptyStringArray" }
121123
]
122124
}
123125
},

0 commit comments

Comments
 (0)