From 8f39fa91693f328b7f1dd58ee4c6680339532d6d Mon Sep 17 00:00:00 2001 From: Henry Andrews Date: Mon, 28 Nov 2016 15:10:18 -0800 Subject: [PATCH 1/6] Add unchanged Draft 04 meta-schemas as Draft 05. To make the changes easier to track in the version control history, these are the unmodified Draft 04 meta-schemas. --- draft-05/hyper-schema | 158 ++++++++++++++++++++++++++++++++++++++++++ draft-05/links | 42 +++++++++++ draft-05/schema | 150 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 350 insertions(+) create mode 100644 draft-05/hyper-schema create mode 100644 draft-05/links create mode 100644 draft-05/schema diff --git a/draft-05/hyper-schema b/draft-05/hyper-schema new file mode 100644 index 00000000..c2cb9d1e --- /dev/null +++ b/draft-05/hyper-schema @@ -0,0 +1,158 @@ +{ + "$schema": "http://json-schema.org/draft-04/hyper-schema#", + "id": "http://json-schema.org/draft-04/hyper-schema#", + "title": "JSON Hyper-Schema", + "allOf": [ + { + "$ref": "http://json-schema.org/draft-04/schema#" + } + ], + "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": "#" + }, + + "links": { + "type": "array", + "items": { + "$ref": "#/definitions/linkDescription" + } + }, + "fragmentResolution": { + "type": "string" + }, + "media": { + "type": "object", + "properties": { + "type": { + "description": "A media type, as described in RFC 2046", + "type": "string" + }, + "binaryEncoding": { + "description": "A content encoding scheme, as described in RFC 2045", + "type": "string" + } + } + }, + "pathStart": { + "description": "Instances' URIs must start with this value for this schema to apply to them", + "type": "string", + "format": "uri" + } + }, + "definitions": { + "schemaArray": { + "type": "array", + "items": { + "$ref": "#" + } + }, + "linkDescription": { + "title": "Link Description Object", + "type": "object", + "required": [ "href", "rel" ], + "properties": { + "href": { + "description": "a URI template, as defined by RFC 6570, with the addition of the $, ( and ) characters for pre-processing", + "type": "string" + }, + "rel": { + "description": "relation to the target resource of the link", + "type": "string" + }, + "title": { + "description": "a title for the link", + "type": "string" + }, + "targetSchema": { + "description": "JSON Schema describing the link target", + "$ref": "#" + }, + "mediaType": { + "description": "media type (as defined by RFC 2046) describing the link target", + "type": "string" + }, + "method": { + "description": "method for requesting the target of the link (e.g. for HTTP this might be \"GET\" or \"DELETE\")", + "type": "string" + }, + "encType": { + "description": "The media type in which to submit data along with the request", + "type": "string", + "default": "application/json" + }, + "schema": { + "description": "Schema describing the data to submit along with the request", + "$ref": "#" + } + } + } + } +} + diff --git a/draft-05/links b/draft-05/links new file mode 100644 index 00000000..da815919 --- /dev/null +++ b/draft-05/links @@ -0,0 +1,42 @@ +{ + "$schema": "http://json-schema.org/draft-04/hyper-schema#", + "id": "http://json-schema.org/draft-04/links#", + "title": "Link Description Object", + "type": "object", + "required": [ "href", "rel" ], + "properties": { + "href": { + "description": "a URI template, as defined by RFC 6570, with the addition of the $, ( and ) characters for pre-processing", + "type": "string" + }, + "rel": { + "description": "relation to the target resource of the link", + "type": "string" + }, + "title": { + "description": "a title for the link", + "type": "string" + }, + "targetSchema": { + "description": "JSON Schema describing the link target", + "$ref": "hyper-schema#" + }, + "mediaType": { + "description": "media type (as defined by RFC 2046) describing the link target", + "type": "string" + }, + "method": { + "description": "method for requesting the target of the link (e.g. for HTTP this might be \"GET\" or \"DELETE\")", + "type": "string" + }, + "encType": { + "description": "The media type in which to submit data along with the request", + "type": "string", + "default": "application/json" + }, + "schema": { + "description": "Schema describing the data to submit along with the request", + "$ref": "hyper-schema#" + } + } +} diff --git a/draft-05/schema b/draft-05/schema new file mode 100644 index 00000000..85eb502a --- /dev/null +++ b/draft-05/schema @@ -0,0 +1,150 @@ +{ + "id": "http://json-schema.org/draft-04/schema#", + "$schema": "http://json-schema.org/draft-04/schema#", + "description": "Core schema meta-schema", + "definitions": { + "schemaArray": { + "type": "array", + "minItems": 1, + "items": { "$ref": "#" } + }, + "positiveInteger": { + "type": "integer", + "minimum": 0 + }, + "positiveIntegerDefault0": { + "allOf": [ { "$ref": "#/definitions/positiveInteger" }, { "default": 0 } ] + }, + "simpleTypes": { + "enum": [ "array", "boolean", "integer", "null", "number", "object", "string" ] + }, + "stringArray": { + "type": "array", + "items": { "type": "string" }, + "minItems": 1, + "uniqueItems": true + } + }, + "type": "object", + "properties": { + "id": { + "type": "string", + "format": "uri" + }, + "$schema": { + "type": "string", + "format": "uri" + }, + "title": { + "type": "string" + }, + "description": { + "type": "string" + }, + "default": {}, + "multipleOf": { + "type": "number", + "minimum": 0, + "exclusiveMinimum": true + }, + "maximum": { + "type": "number" + }, + "exclusiveMaximum": { + "type": "boolean", + "default": false + }, + "minimum": { + "type": "number" + }, + "exclusiveMinimum": { + "type": "boolean", + "default": false + }, + "maxLength": { "$ref": "#/definitions/positiveInteger" }, + "minLength": { "$ref": "#/definitions/positiveIntegerDefault0" }, + "pattern": { + "type": "string", + "format": "regex" + }, + "additionalItems": { + "anyOf": [ + { "type": "boolean" }, + { "$ref": "#" } + ], + "default": {} + }, + "items": { + "anyOf": [ + { "$ref": "#" }, + { "$ref": "#/definitions/schemaArray" } + ], + "default": {} + }, + "maxItems": { "$ref": "#/definitions/positiveInteger" }, + "minItems": { "$ref": "#/definitions/positiveIntegerDefault0" }, + "uniqueItems": { + "type": "boolean", + "default": false + }, + "maxProperties": { "$ref": "#/definitions/positiveInteger" }, + "minProperties": { "$ref": "#/definitions/positiveIntegerDefault0" }, + "required": { "$ref": "#/definitions/stringArray" }, + "additionalProperties": { + "anyOf": [ + { "type": "boolean" }, + { "$ref": "#" } + ], + "default": {} + }, + "definitions": { + "type": "object", + "additionalProperties": { "$ref": "#" }, + "default": {} + }, + "properties": { + "type": "object", + "additionalProperties": { "$ref": "#" }, + "default": {} + }, + "patternProperties": { + "type": "object", + "additionalProperties": { "$ref": "#" }, + "default": {} + }, + "dependencies": { + "type": "object", + "additionalProperties": { + "anyOf": [ + { "$ref": "#" }, + { "$ref": "#/definitions/stringArray" } + ] + } + }, + "enum": { + "type": "array", + "minItems": 1, + "uniqueItems": true + }, + "type": { + "anyOf": [ + { "$ref": "#/definitions/simpleTypes" }, + { + "type": "array", + "items": { "$ref": "#/definitions/simpleTypes" }, + "minItems": 1, + "uniqueItems": true + } + ] + }, + "allOf": { "$ref": "#/definitions/schemaArray" }, + "anyOf": { "$ref": "#/definitions/schemaArray" }, + "oneOf": { "$ref": "#/definitions/schemaArray" }, + "not": { "$ref": "#" } + }, + "dependencies": { + "exclusiveMaximum": [ "maximum" ], + "exclusiveMinimum": [ "minimum" ] + }, + "default": {} +} From 0013e48ae6c97a36042bda4ca274a8e222ec0bd7 Mon Sep 17 00:00:00 2001 From: Henry Andrews Date: Thu, 1 Dec 2016 15:07:11 -0800 Subject: [PATCH 2/6] Standardize meta-schema formatting. * Make the spacing / line use the same * Put $schema before the id * Use title for the short description of the whole meta-schema * Use "allOf" to combine "$ref" with "description" * Restore missing "format" and "readOnly" from Draft 04 This makes the meta-schemas correct for Draft 04 and consistently formatted (with the exception of placement of "definitions" which will be done separtely to keep the diffs clear). No Draft 05 changes have been applied at this point. --- draft-05/hyper-schema | 83 +++++++++++++------------------------------ draft-05/links | 4 +-- draft-05/schema | 20 ++++++++--- 3 files changed, 43 insertions(+), 64 deletions(-) diff --git a/draft-05/hyper-schema b/draft-05/hyper-schema index c2cb9d1e..a6df0e85 100644 --- a/draft-05/hyper-schema +++ b/draft-05/hyper-schema @@ -2,87 +2,51 @@ "$schema": "http://json-schema.org/draft-04/hyper-schema#", "id": "http://json-schema.org/draft-04/hyper-schema#", "title": "JSON Hyper-Schema", - "allOf": [ - { - "$ref": "http://json-schema.org/draft-04/schema#" - } - ], + "allOf": [ { "$ref": "http://json-schema.org/draft-04/schema#" } ], "properties": { "additionalItems": { "anyOf": [ - { - "type": "boolean" - }, - { - "$ref": "#" - } + { "type": "boolean" }, + { "$ref": "#" } ] }, "additionalProperties": { "anyOf": [ - { - "type": "boolean" - }, - { - "$ref": "#" - } + { "type": "boolean" }, + { "$ref": "#" } ] }, "dependencies": { "additionalProperties": { "anyOf": [ - { - "$ref": "#" - }, - { - "type": "array" - } + { "$ref": "#" }, + { "type": "array" } ] } }, "items": { "anyOf": [ - { - "$ref": "#" - }, - { - "$ref": "#/definitions/schemaArray" - } + { "$ref": "#" }, + { "$ref": "#/definitions/schemaArray" } ] }, "definitions": { - "additionalProperties": { - "$ref": "#" - } + "additionalProperties": { "$ref": "#" } }, "patternProperties": { - "additionalProperties": { - "$ref": "#" - } + "additionalProperties": { "$ref": "#" } }, "properties": { - "additionalProperties": { - "$ref": "#" - } - }, - "allOf": { - "$ref": "#/definitions/schemaArray" - }, - "anyOf": { - "$ref": "#/definitions/schemaArray" - }, - "oneOf": { - "$ref": "#/definitions/schemaArray" - }, - "not": { - "$ref": "#" + "additionalProperties": { "$ref": "#" } }, + "allOf": { "$ref": "#/definitions/schemaArray" }, + "anyOf": { "$ref": "#/definitions/schemaArray" }, + "oneOf": { "$ref": "#/definitions/schemaArray" }, + "not": { "$ref": "#" }, "links": { "type": "array", - "items": { - "$ref": "#/definitions/linkDescription" - } + "items": { "$ref": "#/definitions/linkDescription" } }, "fragmentResolution": { "type": "string" @@ -104,14 +68,17 @@ "description": "Instances' URIs must start with this value for this schema to apply to them", "type": "string", "format": "uri" + }, + "readOnly": { + "description": "If true, indicates that the value of this property is controlled by the server.", + "type": "boolean", + "default": "false" } }, "definitions": { "schemaArray": { "type": "array", - "items": { - "$ref": "#" - } + "items": { "$ref": "#" } }, "linkDescription": { "title": "Link Description Object", @@ -132,7 +99,7 @@ }, "targetSchema": { "description": "JSON Schema describing the link target", - "$ref": "#" + "allOf": [ { "$ref": "#" } ] }, "mediaType": { "description": "media type (as defined by RFC 2046) describing the link target", @@ -149,7 +116,7 @@ }, "schema": { "description": "Schema describing the data to submit along with the request", - "$ref": "#" + "allOf": [ { "$ref": "#" } ] } } } diff --git a/draft-05/links b/draft-05/links index da815919..f0f70b49 100644 --- a/draft-05/links +++ b/draft-05/links @@ -19,7 +19,7 @@ }, "targetSchema": { "description": "JSON Schema describing the link target", - "$ref": "hyper-schema#" + "allOf": [ { "$ref": "hyper-schema#" } ] }, "mediaType": { "description": "media type (as defined by RFC 2046) describing the link target", @@ -36,7 +36,7 @@ }, "schema": { "description": "Schema describing the data to submit along with the request", - "$ref": "hyper-schema#" + "allOf": [ { "$ref": "hyper-schema#" } ] } } } diff --git a/draft-05/schema b/draft-05/schema index 85eb502a..65337d4f 100644 --- a/draft-05/schema +++ b/draft-05/schema @@ -1,7 +1,7 @@ { - "id": "http://json-schema.org/draft-04/schema#", "$schema": "http://json-schema.org/draft-04/schema#", - "description": "Core schema meta-schema", + "id": "http://json-schema.org/draft-04/schema#", + "title": "Core schema meta-schema", "definitions": { "schemaArray": { "type": "array", @@ -13,10 +13,21 @@ "minimum": 0 }, "positiveIntegerDefault0": { - "allOf": [ { "$ref": "#/definitions/positiveInteger" }, { "default": 0 } ] + "allOf": [ + { "$ref": "#/definitions/positiveInteger" }, + { "default": 0 } + ] }, "simpleTypes": { - "enum": [ "array", "boolean", "integer", "null", "number", "object", "string" ] + "enum": [ + "array", + "boolean", + "integer", + "null", + "number", + "object", + "string" + ] }, "stringArray": { "type": "array", @@ -137,6 +148,7 @@ } ] }, + "format": { "type": "string" }, "allOf": { "$ref": "#/definitions/schemaArray" }, "anyOf": { "$ref": "#/definitions/schemaArray" }, "oneOf": { "$ref": "#/definitions/schemaArray" }, From 6aac00643381ad5ebbb8110e1a1c97c27e6e09d6 Mon Sep 17 00:00:00 2001 From: Henry Andrews Date: Thu, 1 Dec 2016 15:12:13 -0800 Subject: [PATCH 3/6] Move "definitions" to the top. This makes the placement of "definitions" consistent across the meta-schemas. --- draft-05/hyper-schema | 92 +++++++++++++++++++++---------------------- 1 file changed, 46 insertions(+), 46 deletions(-) diff --git a/draft-05/hyper-schema b/draft-05/hyper-schema index a6df0e85..dfd47342 100644 --- a/draft-05/hyper-schema +++ b/draft-05/hyper-schema @@ -2,6 +2,52 @@ "$schema": "http://json-schema.org/draft-04/hyper-schema#", "id": "http://json-schema.org/draft-04/hyper-schema#", "title": "JSON Hyper-Schema", + "definitions": { + "schemaArray": { + "type": "array", + "items": { "$ref": "#" } + }, + "linkDescription": { + "title": "Link Description Object", + "type": "object", + "required": [ "href", "rel" ], + "properties": { + "href": { + "description": "a URI template, as defined by RFC 6570, with the addition of the $, ( and ) characters for pre-processing", + "type": "string" + }, + "rel": { + "description": "relation to the target resource of the link", + "type": "string" + }, + "title": { + "description": "a title for the link", + "type": "string" + }, + "targetSchema": { + "description": "JSON Schema describing the link target", + "allOf": [ { "$ref": "#" } ] + }, + "mediaType": { + "description": "media type (as defined by RFC 2046) describing the link target", + "type": "string" + }, + "method": { + "description": "method for requesting the target of the link (e.g. for HTTP this might be \"GET\" or \"DELETE\")", + "type": "string" + }, + "encType": { + "description": "The media type in which to submit data along with the request", + "type": "string", + "default": "application/json" + }, + "schema": { + "description": "Schema describing the data to submit along with the request", + "allOf": [ { "$ref": "#" } ] + } + } + } + }, "allOf": [ { "$ref": "http://json-schema.org/draft-04/schema#" } ], "properties": { "additionalItems": { @@ -74,52 +120,6 @@ "type": "boolean", "default": "false" } - }, - "definitions": { - "schemaArray": { - "type": "array", - "items": { "$ref": "#" } - }, - "linkDescription": { - "title": "Link Description Object", - "type": "object", - "required": [ "href", "rel" ], - "properties": { - "href": { - "description": "a URI template, as defined by RFC 6570, with the addition of the $, ( and ) characters for pre-processing", - "type": "string" - }, - "rel": { - "description": "relation to the target resource of the link", - "type": "string" - }, - "title": { - "description": "a title for the link", - "type": "string" - }, - "targetSchema": { - "description": "JSON Schema describing the link target", - "allOf": [ { "$ref": "#" } ] - }, - "mediaType": { - "description": "media type (as defined by RFC 2046) describing the link target", - "type": "string" - }, - "method": { - "description": "method for requesting the target of the link (e.g. for HTTP this might be \"GET\" or \"DELETE\")", - "type": "string" - }, - "encType": { - "description": "The media type in which to submit data along with the request", - "type": "string", - "default": "application/json" - }, - "schema": { - "description": "Schema describing the data to submit along with the request", - "allOf": [ { "$ref": "#" } ] - } - } - } } } From 53725033952150e7952714ef926b3586472946fe Mon Sep 17 00:00:00 2001 From: Henry Andrews Date: Thu, 1 Dec 2016 21:45:12 -0800 Subject: [PATCH 4/6] Draft 05 changes, except for "$ref". This uses "uriref" where appropriate and makes the various change to hyper-schema and links required by the changes to the hyper-schema spec. --- draft-05/hyper-schema | 22 +++++++++------------- draft-05/links | 8 ++++---- draft-05/schema | 6 +++--- 3 files changed, 16 insertions(+), 20 deletions(-) diff --git a/draft-05/hyper-schema b/draft-05/hyper-schema index dfd47342..81595f68 100644 --- a/draft-05/hyper-schema +++ b/draft-05/hyper-schema @@ -1,6 +1,6 @@ { - "$schema": "http://json-schema.org/draft-04/hyper-schema#", - "id": "http://json-schema.org/draft-04/hyper-schema#", + "$schema": "http://json-schema.org/draft-05/hyper-schema#", + "id": "http://json-schema.org/draft-05/hyper-schema#", "title": "JSON Hyper-Schema", "definitions": { "schemaArray": { @@ -10,7 +10,7 @@ "linkDescription": { "title": "Link Description Object", "type": "object", - "required": [ "href", "rel" ], + "required": [ "href" ], "properties": { "href": { "description": "a URI template, as defined by RFC 6570, with the addition of the $, ( and ) characters for pre-processing", @@ -33,7 +33,7 @@ "type": "string" }, "method": { - "description": "method for requesting the target of the link (e.g. for HTTP this might be \"GET\" or \"DELETE\")", + "description": "specifies that the client can construct a templated query (\"get\") or non-idempotent request (\"post\") to a resource.", "type": "string" }, "encType": { @@ -48,7 +48,7 @@ } } }, - "allOf": [ { "$ref": "http://json-schema.org/draft-04/schema#" } ], + "allOf": [ { "$ref": "http://json-schema.org/draft-05/schema#" } ], "properties": { "additionalItems": { "anyOf": [ @@ -90,13 +90,14 @@ "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" + }, "links": { "type": "array", "items": { "$ref": "#/definitions/linkDescription" } }, - "fragmentResolution": { - "type": "string" - }, "media": { "type": "object", "properties": { @@ -110,11 +111,6 @@ } } }, - "pathStart": { - "description": "Instances' URIs must start with this value for this schema to apply to them", - "type": "string", - "format": "uri" - }, "readOnly": { "description": "If true, indicates that the value of this property is controlled by the server.", "type": "boolean", diff --git a/draft-05/links b/draft-05/links index f0f70b49..4eafa9d4 100644 --- a/draft-05/links +++ b/draft-05/links @@ -1,9 +1,9 @@ { - "$schema": "http://json-schema.org/draft-04/hyper-schema#", - "id": "http://json-schema.org/draft-04/links#", + "$schema": "http://json-schema.org/draft-05/hyper-schema#", + "id": "http://json-schema.org/draft-05/links#", "title": "Link Description Object", "type": "object", - "required": [ "href", "rel" ], + "required": [ "href" ], "properties": { "href": { "description": "a URI template, as defined by RFC 6570, with the addition of the $, ( and ) characters for pre-processing", @@ -26,7 +26,7 @@ "type": "string" }, "method": { - "description": "method for requesting the target of the link (e.g. for HTTP this might be \"GET\" or \"DELETE\")", + "description": "specifies that the client can construct a templated query (\"get\") or non-idempotent request (\"post\") to a resource.", "type": "string" }, "encType": { diff --git a/draft-05/schema b/draft-05/schema index 65337d4f..0d88d858 100644 --- a/draft-05/schema +++ b/draft-05/schema @@ -1,6 +1,6 @@ { - "$schema": "http://json-schema.org/draft-04/schema#", - "id": "http://json-schema.org/draft-04/schema#", + "$schema": "http://json-schema.org/draft-05/schema#", + "id": "http://json-schema.org/draft-05/schema#", "title": "Core schema meta-schema", "definitions": { "schemaArray": { @@ -40,7 +40,7 @@ "properties": { "id": { "type": "string", - "format": "uri" + "format": "uriref" }, "$schema": { "type": "string", From df2c717e846c2bb99428a7e398d6d2810813905f Mon Sep 17 00:00:00 2001 From: Henry Andrews Date: Thu, 1 Dec 2016 21:58:21 -0800 Subject: [PATCH 5/6] Add "$ref" for subschemas to meta-schemas. This ensures that subschemas are either "normal" JSON Schema objects according to the declared vocabulary, or references. The separate definitions of jsonReference and notJsonReference ensure that objects with a "$ref" property that is not a URI reference fail validation. If we just negated the jsonReference defintion, then {"$ref": 4} would validate as a non-reference schema which is incorrect. --- draft-05/hyper-schema | 34 ++++++++++++++++++++++----------- draft-05/schema | 44 ++++++++++++++++++++++++++++++++++--------- 2 files changed, 58 insertions(+), 20 deletions(-) diff --git a/draft-05/hyper-schema b/draft-05/hyper-schema index 81595f68..d8e81f5a 100644 --- a/draft-05/hyper-schema +++ b/draft-05/hyper-schema @@ -5,7 +5,7 @@ "definitions": { "schemaArray": { "type": "array", - "items": { "$ref": "#" } + "items": { "$ref": "#/definitions/subSchema" } }, "linkDescription": { "title": "Link Description Object", @@ -26,7 +26,7 @@ }, "targetSchema": { "description": "JSON Schema describing the link target", - "allOf": [ { "$ref": "#" } ] + "allOf": [ { "$ref": "#/definitions/subSchema" } ] }, "mediaType": { "description": "media type (as defined by RFC 2046) describing the link target", @@ -43,52 +43,64 @@ }, "schema": { "description": "Schema describing the data to submit along with the request", - "allOf": [ { "$ref": "#" } ] + "allOf": [ { "$ref": "#/definitions/subSchema" } ] } } + }, + "subSchema": { + "oneOf": [ + { + "allOf": [ + { "$ref": "#" }, + { "$ref": "http://json-schema.org/draft-05/schema#/definitions/notJsonReference" } + ] + }, + { "$ref": "http://json-schema.org/draft-05/schema#/definitions/notJsonReference#/definitions/jsonReference" } + ] } }, + "allOf": [ { "$ref": "http://json-schema.org/draft-05/schema#" } ], "properties": { "additionalItems": { "anyOf": [ { "type": "boolean" }, - { "$ref": "#" } + { "$ref": "#/definitions/subSchema" } ] }, "additionalProperties": { "anyOf": [ { "type": "boolean" }, - { "$ref": "#" } + { "$ref": "#/definitions/subSchema" } ] }, "dependencies": { "additionalProperties": { "anyOf": [ - { "$ref": "#" }, + { "$ref": "#/definitions/subSchema" }, { "type": "array" } ] } }, "items": { "anyOf": [ - { "$ref": "#" }, + { "$ref": "#/definitions/subSchema" }, { "$ref": "#/definitions/schemaArray" } ] }, "definitions": { - "additionalProperties": { "$ref": "#" } + "additionalProperties": { "$ref": "#/definitions/subSchema" } }, "patternProperties": { - "additionalProperties": { "$ref": "#" } + "additionalProperties": { "$ref": "#/definitions/subSchema" } }, "properties": { - "additionalProperties": { "$ref": "#" } + "additionalProperties": { "$ref": "#/definitions/subSchema" } }, "allOf": { "$ref": "#/definitions/schemaArray" }, "anyOf": { "$ref": "#/definitions/schemaArray" }, "oneOf": { "$ref": "#/definitions/schemaArray" }, - "not": { "$ref": "#" }, + "not": { "$ref": "#/definitions/subSchema" }, "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.", diff --git a/draft-05/schema b/draft-05/schema index 0d88d858..4d3c075d 100644 --- a/draft-05/schema +++ b/draft-05/schema @@ -3,10 +3,25 @@ "id": "http://json-schema.org/draft-05/schema#", "title": "Core schema meta-schema", "definitions": { + "jsonReferece": { + "type": "object", + "properties": { + "$ref": { + "type": "string", + "format": "uriref" + } + }, + "required": [ "$ref" ] + }, + "notJsonReference": { + "not": { + "required": [ "$ref" ] + } + }, "schemaArray": { "type": "array", "minItems": 1, - "items": { "$ref": "#" } + "items": { "$ref": "#/definitions/subSchema" } }, "positiveInteger": { "type": "integer", @@ -34,6 +49,17 @@ "items": { "type": "string" }, "minItems": 1, "uniqueItems": true + }, + "subSchema": { + "oneOf": [ + { + "allOf": [ + { "$ref": "#" }, + { "$ref": "#/definitions/notJsonReference" } + ] + }, + { "$ref": "#/definitions/jsonReference" } + ] } }, "type": "object", @@ -81,13 +107,13 @@ "additionalItems": { "anyOf": [ { "type": "boolean" }, - { "$ref": "#" } + { "$ref": "#/definitions/subSchema" } ], "default": {} }, "items": { "anyOf": [ - { "$ref": "#" }, + { "$ref": "#/definitions/subSchema" }, { "$ref": "#/definitions/schemaArray" } ], "default": {} @@ -104,30 +130,30 @@ "additionalProperties": { "anyOf": [ { "type": "boolean" }, - { "$ref": "#" } + { "$ref": "#/definitions/subSchema" } ], "default": {} }, "definitions": { "type": "object", - "additionalProperties": { "$ref": "#" }, + "additionalProperties": { "$ref": "#/definitions/subSchema" }, "default": {} }, "properties": { "type": "object", - "additionalProperties": { "$ref": "#" }, + "additionalProperties": { "$ref": "#/definitions/subSchema" }, "default": {} }, "patternProperties": { "type": "object", - "additionalProperties": { "$ref": "#" }, + "additionalProperties": { "$ref": "#/definitions/subSchema" }, "default": {} }, "dependencies": { "type": "object", "additionalProperties": { "anyOf": [ - { "$ref": "#" }, + { "$ref": "#/definitions/subSchema" }, { "$ref": "#/definitions/stringArray" } ] } @@ -152,7 +178,7 @@ "allOf": { "$ref": "#/definitions/schemaArray" }, "anyOf": { "$ref": "#/definitions/schemaArray" }, "oneOf": { "$ref": "#/definitions/schemaArray" }, - "not": { "$ref": "#" } + "not": { "$ref": "#/definitions/subSchema" } }, "dependencies": { "exclusiveMaximum": [ "maximum" ], From f53cd70d16cb377f297c5c2bf5a7c2aed9049867 Mon Sep 17 00:00:00 2001 From: handrews Date: Sat, 3 Dec 2016 14:54:16 -0800 Subject: [PATCH 6/6] Backport "self" link from recent changes. The hyper-schema on master in json-schema-spec includes "self" and "full" links. This backports the "self" link, but not the "full" link as Draft 05 removed that proposed link relation from the draft. "full" will be removed separately from json-schema-spec master. --- draft-05/hyper-schema | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/draft-05/hyper-schema b/draft-05/hyper-schema index d8e81f5a..f779bfe9 100644 --- a/draft-05/hyper-schema +++ b/draft-05/hyper-schema @@ -128,6 +128,11 @@ "type": "boolean", "default": "false" } - } + }, + "links": [ + { + "rel": "self", + "href": "{+id}" + } + ] } -