From 6d9faba2eb03c7345dac70ebcc22f2dc8b4e4fbd Mon Sep 17 00:00:00 2001 From: Henry Andrews Date: Wed, 13 Sep 2017 20:31:47 +0200 Subject: [PATCH 1/4] Use a $ref to links instead of linkDescription in hyper-schema --- hyper-schema.json | 57 +++-------------------------------------------- 1 file changed, 3 insertions(+), 54 deletions(-) diff --git a/hyper-schema.json b/hyper-schema.json index 9f1a9385..be4ee0d7 100644 --- a/hyper-schema.json +++ b/hyper-schema.json @@ -10,59 +10,6 @@ "items": { "$ref": "#" } } ] - }, - "linkDescription": { - "title": "Link Description Object", - "type": "object", - "required": [ "href" ], - "properties": { - "href": { - "description": "a URI template, as defined by RFC 6570", - "type": "string", - "format": "uri-template" - }, - "hrefSchema": { - "description": "a schema for validating user input to the URI template, where the input is in the form of a JSON object with property names matching variable names in \"href\"", - "allOf": [ {"$ref": "#"} ] - }, - "rel": { - "description": "relation to the target resource of the link", - "type": "string" - }, - "anchor": { - "description": "the URI of the context resource", - "type": "string", - "format": "uri-reference" - }, - "title": { - "description": "a title for the link", - "type": "string" - }, - "description": { - "description": "additional information about the purpose or usage of 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" - }, - "submissionEncType": { - "description": "The media type in which to submit data along with the request", - "type": "string", - "default": "application/json" - }, - "submissionSchema": { - "description": "Schema describing the data to submit along with the request", - "allOf": [ { "$ref": "#" } ] - }, - "$comment": { - "type": "string" - } - } } }, "allOf": [ { "$ref": "http://json-schema.org/draft-06/schema#" } ], @@ -108,7 +55,9 @@ }, "links": { "type": "array", - "items": { "$ref": "#/definitions/linkDescription" } + "items": { + "$ref": "http://json-schema.org/draft-06/links#" + } }, "media": { "type": "object", From 0b0681c1b51b7a80f37b1d22b7d295efc9477d9a Mon Sep 17 00:00:00 2001 From: Henry Andrews Date: Wed, 13 Sep 2017 20:33:46 +0200 Subject: [PATCH 2/4] Remove all descriptions from meta schemas Descriptions are not present in the core/validation schema and have gotten out of sync several times. The descriptions tend to be either trivial or inadequate as the more complex features aren't easily described in a readable amount of JSON text. This addresses #175. --- hyper-schema.json | 3 --- links.json | 8 -------- 2 files changed, 11 deletions(-) diff --git a/hyper-schema.json b/hyper-schema.json index be4ee0d7..e8c30419 100644 --- a/hyper-schema.json +++ b/hyper-schema.json @@ -50,7 +50,6 @@ "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" }, "links": { @@ -63,11 +62,9 @@ "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" } } diff --git a/links.json b/links.json index 7c2292c3..2ffbb756 100644 --- a/links.json +++ b/links.json @@ -6,37 +6,29 @@ "required": [ "href" ], "properties": { "href": { - "description": "a URI template, as defined by RFC 6570", "type": "string", "format": "uri-template" }, "hrefSchema": { - "description": "a schema for validating user input to the URI template, where the input is in the form of a JSON object with property names matching variable names in \"href\"", "allOf": [ {"$ref": "#"} ] }, "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": "hyper-schema#" } ] }, "mediaType": { - "description": "media type (as defined by RFC 2046) describing the link target", "type": "string" }, "submissionEncType": { - "description": "The media type in which to submit data along with the request", "type": "string", "default": "application/json" }, "submissionSchema": { - "description": "Schema describing the data to submit along with the request", "allOf": [ { "$ref": "hyper-schema#" } ] } } From 0f05f32a0124ac3bc154f2bac56c0872ae43d4b3 Mon Sep 17 00:00:00 2001 From: Henry Andrews Date: Wed, 13 Sep 2017 20:38:25 +0200 Subject: [PATCH 3/4] Fix $ref to hyper-schema in links meta-schema --- links.json | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/links.json b/links.json index 2ffbb756..2e4cfe88 100644 --- a/links.json +++ b/links.json @@ -10,7 +10,9 @@ "format": "uri-template" }, "hrefSchema": { - "allOf": [ {"$ref": "#"} ] + "allOf": [ + { "$ref": "http://json-schema.org/draft-06/hyper-schema#" } + ] }, "rel": { "type": "string" @@ -19,7 +21,9 @@ "type": "string" }, "targetSchema": { - "allOf": [ { "$ref": "hyper-schema#" } ] + "allOf": [ + { "$ref": "http://json-schema.org/draft-06/hyper-schema#" } + ] }, "mediaType": { "type": "string" @@ -29,7 +33,9 @@ "default": "application/json" }, "submissionSchema": { - "allOf": [ { "$ref": "hyper-schema#" } ] + "allOf": [ + { "$ref": "http://json-schema.org/draft-06/hyper-schema#" } + ] } } } From 971b9862e259cdeba5c3c76c493c3be8b1908083 Mon Sep 17 00:00:00 2001 From: Henry Andrews Date: Wed, 13 Sep 2017 20:40:48 +0200 Subject: [PATCH 4/4] Add "anchor", "description" and "$comment" to links meta-schema --- links.json | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/links.json b/links.json index 2e4cfe88..b1fc2ed3 100644 --- a/links.json +++ b/links.json @@ -17,9 +17,16 @@ "rel": { "type": "string" }, + "anchor": { + "type": "string", + "format": "uri-reference" + }, "title": { "type": "string" }, + "description": { + "type": "string" + }, "targetSchema": { "allOf": [ { "$ref": "http://json-schema.org/draft-06/hyper-schema#" } @@ -36,6 +43,9 @@ "allOf": [ { "$ref": "http://json-schema.org/draft-06/hyper-schema#" } ] + }, + "$comment": { + "type": "string" } } }