From 17a4af70bdd41f2528e9d5234383d1d133fb22fa Mon Sep 17 00:00:00 2001 From: Lev Bishop Date: Thu, 7 Sep 2017 10:36:17 -0400 Subject: [PATCH 1/3] Update hyper-schema.json Fix recursion to include `contains` (specifically mentioned in section 3.1 of the hyper-schema spec), and `propertyNames` (probably irrelevant, since none of the hyper-schema fields would apply) Much more concise definition of recursion. Probably *too* concise. --- hyper-schema.json | 55 ++++++----------------------------------------- 1 file changed, 7 insertions(+), 48 deletions(-) diff --git a/hyper-schema.json b/hyper-schema.json index deab4992..ed6252fb 100644 --- a/hyper-schema.json +++ b/hyper-schema.json @@ -3,14 +3,6 @@ "$id": "http://json-schema.org/draft-06/hyper-schema#", "title": "JSON Hyper-Schema", "definitions": { - "schemaArray": { - "allOf": [ - { "$ref": "http://json-schema.org/draft-06/schema#/definitions/schemaArray" }, - { - "items": { "$ref": "#" } - } - ] - }, "linkDescription": { "title": "Link Description Object", "type": "object", @@ -66,47 +58,14 @@ } }, "allOf": [ { "$ref": "http://json-schema.org/draft-06/schema#" } ], + "patternProperties": { + "^(additional(Propertie|Item)s|propertyNames|not|contains)$": { "$ref": "#" }, + "^(any|all|one)Of$": { "items": { "$ref": "#" } }, + "^(p(atternP)?ropertie|definition)s$": { "additionalProperties": { "$ref": "#" } }, + "^items$": { "oneOf": [ { "$ref": "#" }, { "type": "array", "items": { "$ref": "#" } } ] }, + "^dependencies$": { "additionalProperties": { "oneOf": [ { "type": "array" }, { "$ref": "#" } ] } } + }, "properties": { - "additionalItems": { - "anyOf": [ - { "type": "boolean" }, - { "$ref": "#" } - ] - }, - "additionalProperties": { - "anyOf": [ - { "type": "boolean" }, - { "$ref": "#" } - ] - }, - "dependencies": { - "additionalProperties": { - "anyOf": [ - { "$ref": "#" }, - { "type": "array" } - ] - } - }, - "items": { - "anyOf": [ - { "$ref": "#" }, - { "$ref": "#/definitions/schemaArray" } - ] - }, - "definitions": { - "additionalProperties": { "$ref": "#" } - }, - "patternProperties": { - "additionalProperties": { "$ref": "#" } - }, - "properties": { - "additionalProperties": { "$ref": "#" } - }, - "allOf": { "$ref": "#/definitions/schemaArray" }, - "anyOf": { "$ref": "#/definitions/schemaArray" }, - "oneOf": { "$ref": "#/definitions/schemaArray" }, - "not": { "$ref": "#" }, - "base": { "description": "URI Template resolved as for the 'href' keyword in the Link Description Object. The resulting URI Reference is resolved against the current URI base and sets the new URI base for URI references within the instance.", "type": "string" From fcfb74f96f7858f3dff0b2540ce054127ddf7332 Mon Sep 17 00:00:00 2001 From: Lev Bishop Date: Fri, 8 Sep 2017 09:29:34 -0400 Subject: [PATCH 2/3] Update hyper-schema.json Go back to the much less concise, but more readable, specification of the recursion. --- hyper-schema.json | 43 ++++++++++++++++++++++++++++++++++++------- 1 file changed, 36 insertions(+), 7 deletions(-) diff --git a/hyper-schema.json b/hyper-schema.json index ed6252fb..7c712757 100644 --- a/hyper-schema.json +++ b/hyper-schema.json @@ -3,6 +3,10 @@ "$id": "http://json-schema.org/draft-06/hyper-schema#", "title": "JSON Hyper-Schema", "definitions": { + "schemaArray": { + "type": "array", + "items": { "$ref": "#" } + }, "linkDescription": { "title": "Link Description Object", "type": "object", @@ -58,14 +62,39 @@ } }, "allOf": [ { "$ref": "http://json-schema.org/draft-06/schema#" } ], - "patternProperties": { - "^(additional(Propertie|Item)s|propertyNames|not|contains)$": { "$ref": "#" }, - "^(any|all|one)Of$": { "items": { "$ref": "#" } }, - "^(p(atternP)?ropertie|definition)s$": { "additionalProperties": { "$ref": "#" } }, - "^items$": { "oneOf": [ { "$ref": "#" }, { "type": "array", "items": { "$ref": "#" } } ] }, - "^dependencies$": { "additionalProperties": { "oneOf": [ { "type": "array" }, { "$ref": "#" } ] } } - }, "properties": { + "additionalItems": { "$ref": "#" }, + "additionalProperties": { "$ref": "#" }, + "dependencies": { + "additionalProperties": { + "anyOf": [ + { "$ref": "#" }, + { "type": "array" } + ] + } + }, + "items": { + "anyOf": [ + { "$ref": "#" }, + { "$ref": "#/definitions/schemaArray" } + ] + }, + "definitions": { + "additionalProperties": { "$ref": "#" } + }, + "patternProperties": { + "additionalProperties": { "$ref": "#" } + }, + "properties": { + "additionalProperties": { "$ref": "#" } + }, + "allOf": { "$ref": "#/definitions/schemaArray" }, + "anyOf": { "$ref": "#/definitions/schemaArray" }, + "oneOf": { "$ref": "#/definitions/schemaArray" }, + "not": { "$ref": "#" }, + "propertyNames": { "$ref": "#" }, + "contains": { "$ref": "#" }, + "base": { "description": "URI Template resolved as for the 'href' keyword in the Link Description Object. The resulting URI Reference is resolved against the current URI base and sets the new URI base for URI references within the instance.", "type": "string" From 7a284696dd4831859f946e137a71b891b904ee63 Mon Sep 17 00:00:00 2001 From: Lev Bishop Date: Fri, 8 Sep 2017 09:35:28 -0400 Subject: [PATCH 3/3] Update hyper-schema.json fix whitespace issues --- hyper-schema.json | 60 +++++++++++++++++++++++++---------------------- 1 file changed, 32 insertions(+), 28 deletions(-) diff --git a/hyper-schema.json b/hyper-schema.json index 7c712757..df7ef2e2 100644 --- a/hyper-schema.json +++ b/hyper-schema.json @@ -4,8 +4,12 @@ "title": "JSON Hyper-Schema", "definitions": { "schemaArray": { - "type": "array", - "items": { "$ref": "#" } + "allOf": [ + { "$ref": "http://json-schema.org/draft-06/schema#/definitions/schemaArray" }, + { + "items": { "$ref": "#" } + } + ] }, "linkDescription": { "title": "Link Description Object", @@ -64,37 +68,37 @@ "allOf": [ { "$ref": "http://json-schema.org/draft-06/schema#" } ], "properties": { "additionalItems": { "$ref": "#" }, - "additionalProperties": { "$ref": "#" }, - "dependencies": { - "additionalProperties": { - "anyOf": [ - { "$ref": "#" }, - { "type": "array" } - ] - } + "additionalProperties": { "$ref": "#"}, + "dependencies": { + "additionalProperties": { + "anyOf": [ + { "$ref": "#" }, + { "type": "array" } + ] + } }, - "items": { - "anyOf": [ - { "$ref": "#" }, + "items": { + "anyOf": [ + { "$ref": "#" }, { "$ref": "#/definitions/schemaArray" } - ] - }, - "definitions": { - "additionalProperties": { "$ref": "#" } - }, - "patternProperties": { - "additionalProperties": { "$ref": "#" } - }, - "properties": { - "additionalProperties": { "$ref": "#" } - }, - "allOf": { "$ref": "#/definitions/schemaArray" }, - "anyOf": { "$ref": "#/definitions/schemaArray" }, + ] + }, + "definitions": { + "additionalProperties": { "$ref": "#" } + }, + "patternProperties": { + "additionalProperties": { "$ref": "#" } + }, + "properties": { + "additionalProperties": { "$ref": "#" } + }, + "allOf": { "$ref": "#/definitions/schemaArray" }, + "anyOf": { "$ref": "#/definitions/schemaArray" }, "oneOf": { "$ref": "#/definitions/schemaArray" }, "not": { "$ref": "#" }, - "propertyNames": { "$ref": "#" }, "contains": { "$ref": "#" }, - + "propertyNames": { "$ref": "#" }, + "base": { "description": "URI Template resolved as for the 'href' keyword in the Link Description Object. The resulting URI Reference is resolved against the current URI base and sets the new URI base for URI references within the instance.", "type": "string"