From 5a614b28b48137d7e330f3d8e15fa51f43a371a5 Mon Sep 17 00:00:00 2001 From: Henry Andrews Date: Fri, 28 Oct 2016 10:47:09 -0700 Subject: [PATCH] Add the "contains" keyword for array instances. This addresses the enhancement requested in issues #32 and #63. Only the single-schema form from #63 is added here as the multi-schema form did not gather significant support in the absence of a clear use case. --- jsonschema-validation.xml | 11 +++++++++++ schema.json | 1 + 2 files changed, 12 insertions(+) diff --git a/jsonschema-validation.xml b/jsonschema-validation.xml index 2633bf21..2260fb5a 100644 --- a/jsonschema-validation.xml +++ b/jsonschema-validation.xml @@ -367,6 +367,17 @@ +
+ + The value of this keyword MUST be an object. This object MUST be + a valid JSON Schema. + + + An array instance is valid against "contains" if at least one of + its elements is valid against the given schema. + +
+
The value of this keyword MUST be an integer. This integer MUST be diff --git a/schema.json b/schema.json index 8ebd9a95..61e716c7 100644 --- a/schema.json +++ b/schema.json @@ -87,6 +87,7 @@ "type": "boolean", "default": false }, + "contains": { "$ref": "#" }, "maxProperties": { "$ref": "#/definitions/positiveInteger" }, "minProperties": { "$ref": "#/definitions/positiveIntegerDefault0" }, "required": { "$ref": "#/definitions/stringArray" },