Skip to content

Commit a618913

Browse files
committed
Add output format schema, tidy up other schemas
Also improve the wording introducing the output format. Split the "links" fields off from their "required" value, as we may use the format in environments that do not require the same set of fields. For instance, the output format is allowed to omit "href", which is required in an LDO proper. Finally, update the URIs to draft-07-wip which is less confusing than having them say draft-06 (which is blatantly wrong) or draft-07 (which is misleading as it's not yet finalized, much less published).
1 parent d0731df commit a618913

5 files changed

+150
-82
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: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
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": {

jsonschema-hyperschema.xml

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -262,10 +262,14 @@
262262
(draft-07 work-in-progress version).
263263
</t>
264264
<t>
265-
While implementations are free to provide output in any format, the format
266-
used for examples in this document is also used by the conformance test suite,
267-
and is therefore a good default output format. The URI of the JSON Schema
268-
describing that format is
265+
JSON Hyper-Schema implementations are free to provide output in any format.
266+
However, a specific format is defined for use in the conformance test suite,
267+
which is also used to illustrate points in the
268+
<xref target="implementation">"Implementation Requirements"</xref>, and to
269+
show the output generated by <xref target="examples">examples</xref>.
270+
It is RECOMMENDED that implementations be capable of producting output
271+
in this format to faciliated testing. The URI of the JSON Schema
272+
describing the recommended output format is
269273
<eref target="http://json-schema.org/draft-7-wip/hyper-schema-output#">
270274
http://json-schema.org/draft-7-wip/hyper-schema-output#</eref>
271275
(draft-07 work-in-progress version).
@@ -849,7 +853,7 @@
849853
</section>
850854
</section>
851855

852-
<section title="Implementation requirements">
856+
<section title="Implementation requirements" anchor="implementation">
853857
<t>
854858
At a high level, a conforming implementation will meet the following
855859
requirements. Each of these requirements is covered in more detail in the
@@ -1218,6 +1222,10 @@ for varname in templateData:
12181222
</section>
12191223
</section>
12201224

1225+
<section title="Examples" anchor="examples">
1226+
<t><cref>Examples are being added in a subsequent PR.</cref></t>
1227+
</section>
1228+
12211229
<section title="Security Considerations" anchor="security">
12221230
<t><cref>Need to reference the core and validation security considerations.</cref></t>
12231231
<section title='"self" links'>

links.json

Lines changed: 72 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -1,80 +1,79 @@
11
{
2-
"$schema": "http://json-schema.org/draft-06/hyper-schema#",
3-
"$id": "http://json-schema.org/draft-06/links#",
2+
"$schema": "http://json-schema.org/draft-07-wip/hyper-schema#",
3+
"$id": "http://json-schema.org/draft-07-wip/links#",
44
"title": "Link Description Object",
5-
"type": "object",
6-
"required": [ "href" ],
7-
"properties": {
8-
"anchor": {
9-
"type": "string",
10-
"format": "uri-template"
11-
},
12-
"anchorPointer": {
13-
"type": "string",
14-
"anyOf": [
15-
{ "format": "json-pointer" },
16-
{ "pattern": "^[0-9]" }
17-
]
18-
},
19-
"rel": {
20-
"type": "string"
21-
},
22-
"href": {
23-
"type": "string",
24-
"format": "uri-template"
25-
},
26-
"templatePointers": {
5+
"allOf": [
6+
{ "required": [ "rel", "href" ] },
7+
{ "$ref": "#/definitions/noRequiredFields" }
8+
],
9+
"definitions": {
10+
"noRequiredFields": {
2711
"type": "object",
28-
"additionalProperties": {
29-
"type": "string",
30-
"anyOf": [
31-
{ "format": "json-pointer" },
32-
{ "pattern": "^[0-9]" }
33-
]
12+
"properties": {
13+
"anchor": {
14+
"type": "string",
15+
"format": "uri-template"
16+
},
17+
"anchorPointer": {
18+
"type": "string",
19+
"anyOf": [
20+
{ "format": "json-pointer" },
21+
{ "pattern": "^[0-9]" }
22+
]
23+
},
24+
"rel": {
25+
"type": "string"
26+
},
27+
"href": {
28+
"type": "string",
29+
"format": "uri-template"
30+
},
31+
"templatePointers": {
32+
"type": "object",
33+
"additionalProperties": {
34+
"type": "string",
35+
"anyOf": [
36+
{ "format": "json-pointer" },
37+
{ "pattern": "^[0-9]" }
38+
]
39+
}
40+
},
41+
"templateRequired": {
42+
"type": "array",
43+
"items": {
44+
"type": "string"
45+
}
46+
},
47+
"title": {
48+
"type": "string"
49+
},
50+
"description": {
51+
"type": "string"
52+
},
53+
"targetSchema": {
54+
"$ref": "http://json-schema.org/draft-06/hyper-schema#"
55+
},
56+
"targetMediaType": {
57+
"type": "string"
58+
},
59+
"targetHints": { },
60+
"hrefSchema": {
61+
"$ref": "http://json-schema.org/draft-06/hyper-schema#"
62+
},
63+
"headerSchema": {
64+
"$ref": "http://json-schema.org/draft-06/hyper-schema#"
65+
},
66+
"submissionMediaType": {
67+
"type": "string",
68+
"default": "application/json"
69+
},
70+
"submissionSchema": {
71+
"$ref": "http://json-schema.org/draft-06/hyper-schema#"
72+
},
73+
"$comment": {
74+
"type": "string"
75+
}
3476
}
35-
},
36-
"templateRequired": {
37-
"type": "array",
38-
"items": {
39-
"type": "string"
40-
}
41-
},
42-
"title": {
43-
"type": "string"
44-
},
45-
"description": {
46-
"type": "string"
47-
},
48-
"targetSchema": {
49-
"allOf": [
50-
{ "$ref": "http://json-schema.org/draft-06/hyper-schema#" }
51-
]
52-
},
53-
"targetMediaType": {
54-
"type": "string"
55-
},
56-
"targetHints": { },
57-
"hrefSchema": {
58-
"allOf": [
59-
{ "$ref": "http://json-schema.org/draft-06/hyper-schema#" }
60-
]
61-
},
62-
"headerSchema": {
63-
"allOf": [
64-
{ "$ref": "http://json-schema.org/draft-06/hyper-schema#" }
65-
]
66-
},
67-
"submissionMediaType": {
68-
"type": "string",
69-
"default": "application/json"
70-
},
71-
"submissionSchema": {
72-
"allOf": [
73-
{ "$ref": "http://json-schema.org/draft-06/hyper-schema#" }
74-
]
75-
},
76-
"$comment": {
77-
"type": "string"
7877
}
7978
}
8079
}

schema.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
2-
"$schema": "http://json-schema.org/draft-06/schema#",
3-
"$id": "http://json-schema.org/draft-06/schema#",
2+
"$schema": "http://json-schema.org/draft-07-wip/schema#",
3+
"$id": "http://json-schema.org/draft-07-wip/schema#",
44
"title": "Core schema meta-schema",
55
"definitions": {
66
"schemaArray": {

0 commit comments

Comments
 (0)