Skip to content
This repository was archived by the owner on Nov 2, 2023. It is now read-only.

Commit 8b6c818

Browse files
committed
Update hyper-schema spec
1 parent 5ae117b commit 8b6c818

File tree

1 file changed

+41
-79
lines changed

1 file changed

+41
-79
lines changed

latest/json-schema-hypermedia.html

Lines changed: 41 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -228,37 +228,37 @@ <h3>Table of Contents</h3>
228228
rel<br />
229229
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="#anchor27">5.2.1.</a>&nbsp;
230230
Fragment resolution with &quot;root&quot; links<br />
231-
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="#anchor29">5.2.2.</a>&nbsp;
231+
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="#anchor28">5.2.2.</a>&nbsp;
232232
Security Considerations for &quot;self&quot; links<br />
233-
&nbsp;&nbsp;&nbsp;&nbsp;<a href="#anchor30">5.3.</a>&nbsp;
233+
&nbsp;&nbsp;&nbsp;&nbsp;<a href="#anchor29">5.3.</a>&nbsp;
234234
title<br />
235-
&nbsp;&nbsp;&nbsp;&nbsp;<a href="#anchor31">5.4.</a>&nbsp;
235+
&nbsp;&nbsp;&nbsp;&nbsp;<a href="#anchor30">5.4.</a>&nbsp;
236236
targetSchema<br />
237-
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="#anchor32">5.4.1.</a>&nbsp;
237+
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="#anchor31">5.4.1.</a>&nbsp;
238238
Security Considerations for &quot;targetSchema&quot;<br />
239-
&nbsp;&nbsp;&nbsp;&nbsp;<a href="#anchor33">5.5.</a>&nbsp;
239+
&nbsp;&nbsp;&nbsp;&nbsp;<a href="#anchor32">5.5.</a>&nbsp;
240240
mediaType<br />
241-
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="#anchor34">5.5.1.</a>&nbsp;
241+
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="#anchor33">5.5.1.</a>&nbsp;
242242
Security concerns for &quot;mediaType&quot;<br />
243-
&nbsp;&nbsp;&nbsp;&nbsp;<a href="#anchor35">5.6.</a>&nbsp;
243+
&nbsp;&nbsp;&nbsp;&nbsp;<a href="#anchor34">5.6.</a>&nbsp;
244244
Submission Link Properties<br />
245-
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="#anchor36">5.6.1.</a>&nbsp;
245+
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="#anchor35">5.6.1.</a>&nbsp;
246246
method<br />
247-
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="#anchor37">5.6.2.</a>&nbsp;
247+
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="#anchor36">5.6.2.</a>&nbsp;
248248
encType<br />
249-
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="#anchor38">5.6.3.</a>&nbsp;
249+
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="#anchor37">5.6.3.</a>&nbsp;
250250
schema<br />
251-
<a href="#anchor39">6.</a>&nbsp;
251+
<a href="#anchor38">6.</a>&nbsp;
252252
IANA Considerations<br />
253-
&nbsp;&nbsp;&nbsp;&nbsp;<a href="#anchor40">6.1.</a>&nbsp;
253+
&nbsp;&nbsp;&nbsp;&nbsp;<a href="#anchor39">6.1.</a>&nbsp;
254254
Registry of Link Relations<br />
255255
<a href="#rfc.references1">7.</a>&nbsp;
256256
References<br />
257257
&nbsp;&nbsp;&nbsp;&nbsp;<a href="#rfc.references1">7.1.</a>&nbsp;
258258
Normative References<br />
259259
&nbsp;&nbsp;&nbsp;&nbsp;<a href="#rfc.references2">7.2.</a>&nbsp;
260260
Informative References<br />
261-
<a href="#anchor43">Appendix&nbsp;A.</a>&nbsp;
261+
<a href="#anchor42">Appendix&nbsp;A.</a>&nbsp;
262262
Change Log<br />
263263
</p>
264264
<br clear="all" />
@@ -640,11 +640,11 @@ <h3>Table of Contents</h3>
640640
The base URI to be used for relative URI resolution SHOULD is defined as follows:
641641
</p>
642642
<blockquote class="text">
643-
<p>if the data has a link defined, with a relation of "self", then the "href" value of that link is used
643+
<p>if the data has a link defined, with a relation of "self", then the "href" value of that link is used, unless the relation of the link being resolved is also "self"
644644
</p>
645-
<p>if no such link exists, the URI should be resolved against the link with relation "self" belonging to the closest parent node in the JSON document
645+
<p>otherwise, the URI should be resolved against the link with relation "self" belonging to the closest parent node in the JSON document, if it exists
646646
</p>
647-
<p>if no such links exist (the data and all its parents in the tree do not have a "self" link), the URI used to fetch the document should be used.
647+
<p>otherwise, the URI used to fetch the document should be used.
648648
</p>
649649
</blockquote><p>
650650

@@ -880,8 +880,7 @@ <h3>Table of Contents</h3>
880880
<dd>
881881
This relation indicates that the target of the link SHOULD be treated as the root or the body of the representation for the purposes of user agent interaction or fragment resolution.
882882
All other properties of the instance objects can be regarded as meta-data descriptions for the data.
883-
The URI of this link MUST be a fragment, specifying a location within the instance.
884-
If it is not, this link should be ignored.
883+
The URI of this link MUST refer to a location within the instance document, otherwise the link MUST be ignored.
885884

886885
</dd>
887886
</dl></blockquote><p>
@@ -951,6 +950,12 @@ <h3>Table of Contents</h3>
951950

952951
<p>
953952
The presence of a link with relation "root" alters what the root of the document is considered to be.
953+
For fragment resolution methods (such as JSON Pointer fragments) that navigate through the document, the target of the "root" link should be the starting point for such methods.
954+
955+
</p>
956+
<p>
957+
The only exception is "root" links themselves.
958+
When calculating the target of links with relation "root", existing "root" links MUST NOT be taken into consideration.
954959

955960
</p>
956961
<p>
@@ -997,55 +1002,6 @@ <h3>Table of Contents</h3>
9971002
</p>
9981003
<a name="anchor28"></a><br /><hr />
9991004
<table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc">&nbsp;TOC&nbsp;</a></td></tr></table>
1000-
<a name="rfc.section.5.2.1.1"></a><h3>5.2.1.1.&nbsp;
1001-
Preventing the URI resolution paradox</h3>
1002-
1003-
<p>
1004-
Because of the "root" link type's effect on URL resolution, it possible to create apparent paradoxes in URI resolution. For example, consider this response from a server:
1005-
</p>
1006-
<div style='display: table; width: 0; margin-left: 3em; margin-right: auto'><pre>
1007-
1008-
Content-Type: application/json; profile=#/schema
1009-
1010-
{
1011-
"myRootData": {
1012-
"title": "Document title"
1013-
},
1014-
"schema": {
1015-
"type": "object",
1016-
"properties": {
1017-
"root": {
1018-
"title": "Document",
1019-
"type": "object",
1020-
"properties": {
1021-
"title": {"type": "string"}
1022-
}
1023-
}
1024-
},
1025-
"links": [
1026-
{
1027-
"rel": "root",
1028-
"href": "#/myRootData"
1029-
}
1030-
]
1031-
}
1032-
}
1033-
1034-
</pre></div><p>
1035-
1036-
<p>
1037-
The "profile" parameter in the "Content-Type" HTTP header defines the schema to be inside the data itself.
1038-
But the schema defines a "root" link, which changes the document root, which seems like it should change the target of "#/schema".
1039-
1040-
</p>
1041-
1042-
1043-
<p>
1044-
To avoid this scenario, the following behaviour is defined: when resolving URIs for schemas, that schema MUST NOT be taken into account when calculating the document root.
1045-
1046-
</p>
1047-
<a name="anchor29"></a><br /><hr />
1048-
<table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc">&nbsp;TOC&nbsp;</a></td></tr></table>
10491005
<a name="rfc.section.5.2.2"></a><h3>5.2.2.&nbsp;
10501006
Security Considerations for &quot;self&quot; links</h3>
10511007

@@ -1095,7 +1051,7 @@ <h3>Table of Contents</h3>
10951051
</pre></div>
10961052

10971053

1098-
<a name="anchor30"></a><br /><hr />
1054+
<a name="anchor29"></a><br /><hr />
10991055
<table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc">&nbsp;TOC&nbsp;</a></td></tr></table>
11001056
<a name="rfc.section.5.3"></a><h3>5.3.&nbsp;
11011057
title</h3>
@@ -1109,7 +1065,7 @@ <h3>Table of Contents</h3>
11091065
User agents MAY use this title when presenting the link to the user.
11101066

11111067
</p>
1112-
<a name="anchor31"></a><br /><hr />
1068+
<a name="anchor30"></a><br /><hr />
11131069
<table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc">&nbsp;TOC&nbsp;</a></td></tr></table>
11141070
<a name="rfc.section.5.4"></a><h3>5.4.&nbsp;
11151071
targetSchema</h3>
@@ -1118,7 +1074,7 @@ <h3>Table of Contents</h3>
11181074
This property value is advisory only, and is a schema that defines the expected structure of the JSON representation of the target of the link, if the target of the link is returned using JSON representation.
11191075

11201076
</p>
1121-
<a name="anchor32"></a><br /><hr />
1077+
<a name="anchor31"></a><br /><hr />
11221078
<table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc">&nbsp;TOC&nbsp;</a></td></tr></table>
11231079
<a name="rfc.section.5.4.1"></a><h3>5.4.1.&nbsp;
11241080
Security Considerations for &quot;targetSchema&quot;</h3>
@@ -1178,7 +1134,7 @@ <h3>Table of Contents</h3>
11781134
</p>
11791135

11801136

1181-
<a name="anchor33"></a><br /><hr />
1137+
<a name="anchor32"></a><br /><hr />
11821138
<table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc">&nbsp;TOC&nbsp;</a></td></tr></table>
11831139
<a name="rfc.section.5.5"></a><h3>5.5.&nbsp;
11841140
mediaType</h3>
@@ -1241,7 +1197,7 @@ <h3>Table of Contents</h3>
12411197
The interpretation of the data itself is performed by the news feed aggregator, which SHOULD reject any data that would not have also been interpreted as a news feed, had it been displayed in the main view.
12421198

12431199
</p>
1244-
<a name="anchor34"></a><br /><hr />
1200+
<a name="anchor33"></a><br /><hr />
12451201
<table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc">&nbsp;TOC&nbsp;</a></td></tr></table>
12461202
<a name="rfc.section.5.5.1"></a><h3>5.5.1.&nbsp;
12471203
Security concerns for &quot;mediaType&quot;</h3>
@@ -1261,7 +1217,7 @@ <h3>Table of Contents</h3>
12611217
This is to guard against re-interpretation of "safe" data, similar to the precautions for "targetSchema".
12621218

12631219
</p>
1264-
<a name="anchor35"></a><br /><hr />
1220+
<a name="anchor34"></a><br /><hr />
12651221
<table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc">&nbsp;TOC&nbsp;</a></td></tr></table>
12661222
<a name="rfc.section.5.6"></a><h3>5.6.&nbsp;
12671223
Submission Link Properties</h3>
@@ -1270,7 +1226,7 @@ <h3>Table of Contents</h3>
12701226
The following properties also apply to link definition objects, and provide functionality analogous to HTML forms, in providing a means for submitting extra (often user supplied) information to send to a server.
12711227

12721228
</p>
1273-
<a name="anchor36"></a><br /><hr />
1229+
<a name="anchor35"></a><br /><hr />
12741230
<table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc">&nbsp;TOC&nbsp;</a></td></tr></table>
12751231
<a name="rfc.section.5.6.1"></a><h3>5.6.1.&nbsp;
12761232
method</h3>
@@ -1281,7 +1237,7 @@ <h3>Table of Contents</h3>
12811237
This defaults to "GET".
12821238

12831239
</p>
1284-
<a name="anchor37"></a><br /><hr />
1240+
<a name="anchor36"></a><br /><hr />
12851241
<table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc">&nbsp;TOC&nbsp;</a></td></tr></table>
12861242
<a name="rfc.section.5.6.2"></a><h3>5.6.2.&nbsp;
12871243
encType</h3>
@@ -1321,7 +1277,7 @@ <h3>Table of Contents</h3>
13211277
If the method is POST, "application/json" is the default media type.
13221278

13231279

1324-
<a name="anchor38"></a><br /><hr />
1280+
<a name="anchor37"></a><br /><hr />
13251281
<table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc">&nbsp;TOC&nbsp;</a></td></tr></table>
13261282
<a name="rfc.section.5.6.3"></a><h3>5.6.3.&nbsp;
13271283
schema</h3>
@@ -1336,12 +1292,12 @@ <h3>Table of Contents</h3>
13361292
It is also separate from the "targetSchema" property, which provides a schema for the data that the client should expect to be returned when they follow the link.
13371293

13381294
</p>
1339-
<a name="anchor39"></a><br /><hr />
1295+
<a name="anchor38"></a><br /><hr />
13401296
<table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc">&nbsp;TOC&nbsp;</a></td></tr></table>
13411297
<a name="rfc.section.6"></a><h3>6.&nbsp;
13421298
IANA Considerations</h3>
13431299

1344-
<a name="anchor40"></a><br /><hr />
1300+
<a name="anchor39"></a><br /><hr />
13451301
<table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc">&nbsp;TOC&nbsp;</a></td></tr></table>
13461302
<a name="rfc.section.6.1"></a><h3>6.1.&nbsp;
13471303
Registry of Link Relations</h3>
@@ -1393,7 +1349,7 @@ <h3>7.2.&nbsp;Informative References</h3>
13931349
<td class="author-text">Hors, A., Raggett, D., and I. Jacobs, &ldquo;<a href="http://www.w3.org/TR/1999/REC-html401-19991224">HTML 4.01 Specification</a>,&rdquo; World Wide Web Consortium Recommendation&nbsp;REC-html401-19991224, December&nbsp;1999 (<a href="http://www.w3.org/TR/1999/REC-html401-19991224">HTML</a>).</td></tr>
13941350
</table>
13951351

1396-
<a name="anchor43"></a><br /><hr />
1352+
<a name="anchor42"></a><br /><hr />
13971353
<table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc">&nbsp;TOC&nbsp;</a></td></tr></table>
13981354
<a name="rfc.section.A"></a><h3>Appendix A.&nbsp;
13991355
Change Log</h3>
@@ -1405,6 +1361,12 @@ <h3>7.2.&nbsp;Informative References</h3>
14051361
<dd>
14061362

14071363
<ul class="text">
1364+
<li>Resolution of link URIs ("href") is now affected by rel="self" links on the instance
1365+
</li>
1366+
<li>Define "title" for LDOs
1367+
</li>
1368+
<li>Use URI Templates for the "href" property
1369+
</li>
14081370
<li>Split hyper-schema definition out from main schema.
14091371
</li>
14101372
<li>Removed "readonly"

0 commit comments

Comments
 (0)