From ac8e207979b5392692c9c67f3ae7729f1562bba4 Mon Sep 17 00:00:00 2001 From: Henry Andrews Date: Fri, 28 Oct 2016 10:38:28 -0700 Subject: [PATCH] Allow an empty array for "required". This addresses the enhancement requested in issue #69. --- jsonschema-validation.xml | 5 ++--- schema.json | 6 ++++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/jsonschema-validation.xml b/jsonschema-validation.xml index d5724e03..3852d9ed 100644 --- a/jsonschema-validation.xml +++ b/jsonschema-validation.xml @@ -435,9 +435,8 @@
- The value of this keyword MUST be an array. This array MUST have at - least one element. Elements of this array MUST be strings, and MUST be - unique. + The value of this keyword MUST be an array. Elements of this array + MUST be strings, and MUST be unique. An object instance is valid against this keyword if its diff --git a/schema.json b/schema.json index 4e9b565e..93a614fe 100644 --- a/schema.json +++ b/schema.json @@ -21,8 +21,10 @@ "stringArray": { "type": "array", "items": { "type": "string" }, - "minItems": 1, "uniqueItems": true + }, + "nonEmptyStringArray": { + "allOf": [ { "$ref": "#/definitions/stringArray" }, { "minItems": 1 } ] } }, "type": "object", @@ -118,7 +120,7 @@ "additionalProperties": { "anyOf": [ { "$ref": "#" }, - { "$ref": "#/definitions/stringArray" } + { "$ref": "#/definitions/nonEmptyStringArray" } ] } },