Skip to content

Commit 04d90af

Browse files
authored
Merge pull request #427 from handrews/rewrite
Rewrite the Hyper-Schema spec almost entirely
2 parents 1865631 + 9bfcc50 commit 04d90af

File tree

7 files changed

+1359
-1513
lines changed

7 files changed

+1359
-1513
lines changed

hyper-schema-output.json

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
{
2+
"$id": "http://json-schema.org/draft-7-wip/hyper-schema-output",
3+
"$schema": "http://json-schema.org/draft-07-wip/schema#",
4+
"type": "array",
5+
"items": {
6+
"allOf": [
7+
{"$ref": "http://json-schema.org/draft-07/links#/definitions/noRequiredFields" }
8+
],
9+
"type": "object",
10+
"required": [
11+
"contextUri",
12+
"contextPointer",
13+
"rel",
14+
"attachmentPointer"
15+
],
16+
"if": { "required": [ "hrefSchema" ] },
17+
"then": { "required": [ "hrefInputTemplates", "hrefPrepopulatedInput" ] },
18+
"else": { "required": [ "targetUri" ] },
19+
"properties": {
20+
"contextUri": {
21+
"$comment": "The fully resolved URI of the link context, including a fragment if it is possible to construct one for the given media type and instance",
22+
"type": "string",
23+
"format": "uri"
24+
},
25+
"contextPointer": {
26+
"$comment": "The absolute JSON Pointer to the ___location in the instance that is the context of the link. If the context resource supports JSON Pointer fragments, this will the string form of the identical JSON Pointer",
27+
"type": "string",
28+
"format": "json-pointer"
29+
},
30+
"rel": {
31+
"type": "string"
32+
},
33+
"targetUri": {
34+
"$comment": "The fully resolved target URI",
35+
"type": "string",
36+
"format": "uri"
37+
},
38+
"hrefInputTemplates": {
39+
"$comment": "The list of partially resolved URI Templates, starting with \"href\", followed by applicable \"base\" values from nearest to furthest.",
40+
"type": "array",
41+
"items": {
42+
"type": "string",
43+
"format": "uri-template"
44+
}
45+
},
46+
"hrefPrepopulatedInput": {
47+
"$comment": "The initial data set to be presented with the input form when URI Tempalte input is accepted.",
48+
"type": "object",
49+
"propertyNames": {
50+
"$comment": "These are all URI Template variable names, specifically the 'varname' production from RFC 6570, Section 2.3",
51+
"pattern": "^(?:\\w|(?:%[a-f\\d]{2}))+(?:\\.(?:\\w|(?:%[a-f\\d]{2})))*$"
52+
}
53+
},
54+
"attachmentPointer": {
55+
"$comment": "The absolute JSON Pointer, in string form, of the position to which this resolved link applies",
56+
"type": "string",
57+
"format": "json-pointer"
58+
}
59+
}
60+
}
61+
}

hyper-schema.json

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
{
2-
"$schema": "http://json-schema.org/draft-06/hyper-schema#",
3-
"$id": "http://json-schema.org/draft-06/hyper-schema#",
2+
"$schema": "http://json-schema.org/draft-07-wip/hyper-schema#",
3+
"$id": "http://json-schema.org/draft-07-wip/hyper-schema#",
44
"title": "JSON Hyper-Schema",
55
"definitions": {
66
"schemaArray": {
77
"allOf": [
8-
{ "$ref": "http://json-schema.org/draft-06/schema#/definitions/schemaArray" },
8+
{ "$ref": "http://json-schema.org/draft-07-wip/schema#/definitions/schemaArray" },
99
{
1010
"items": { "$ref": "#" }
1111
}
1212
]
1313
}
1414
},
15-
"allOf": [ { "$ref": "http://json-schema.org/draft-06/schema#" } ],
15+
"allOf": [ { "$ref": "http://json-schema.org/draft-07-wip/schema#" } ],
1616
"properties": {
1717
"additionalItems": { "$ref": "#" },
1818
"additionalProperties": { "$ref": "#"},
@@ -50,12 +50,13 @@
5050
"propertyNames": { "$ref": "#" },
5151

5252
"base": {
53-
"type": "string"
53+
"type": "string",
54+
"format": "uri-template"
5455
},
5556
"links": {
5657
"type": "array",
5758
"items": {
58-
"$ref": "http://json-schema.org/draft-06/links#"
59+
"$ref": "http://json-schema.org/draft-07-wip/links#"
5960
}
6061
}
6162
},

jsonschema-core.xml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
<?rfc rfcedstyle="yes"?>
2020
<?rfc comments="yes"?>
2121
<?rfc inline="yes" ?>
22-
<rfc category="info" docName="draft-wright-json-schema-02" ipr="trust200902">
22+
<rfc category="info" docName="draft-handrews-json-schema-00" ipr="trust200902">
2323
<front>
2424
<title abbrev="JSON Schema">JSON Schema: A Media Type for Describing JSON Documents</title>
2525

@@ -986,11 +986,13 @@ User-Agent: product-name/5.4.1 so-cool-json-schema/1.0.2 curl/7.43.0
986986
</t>
987987
<t>
988988
<list style="hanging">
989-
<t hangText="draft-wright-json-schema-02">
989+
<t hangText="draft-handrews-json-schema-00">
990990
<list style="symbols">
991991
<t>Reserve "$comment" for non-user-visible notes about the schema</t>
992992
<t>Wording improvements around "$id" and fragments</t>
993993
<t>Note the challenges of extending meta-schemas with recursive references</t>
994+
<t>Add "application/schema-instance+json" media type</t>
995+
<t>Recommend a "schema" link relation / parameter instead of "profile"</t>
994996
</list>
995997
</t>
996998
<t hangText="draft-wright-json-schema-01">

0 commit comments

Comments
 (0)