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

Commit b499784

Browse files
committed
Add draft-07 hyper-schema release notes
1 parent 8016576 commit b499784

File tree

1 file changed

+110
-0
lines changed

1 file changed

+110
-0
lines changed
Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
---
2+
title: JSON Hyper-Schema Draft-07 Release Notes
3+
layout: page
4+
---
5+
6+
JSON Hyper-Schema [draft-07](json-schema-hypermedia.html) completes the
7+
reworking of Hyper-Schema that was begun in draft-06.
8+
9+
Hyper-Schema is now solely focused on adding hyperlinks to JSON documents,
10+
so keywords used for other purposes (`readOnly` and `media`) have been
11+
[moved to the Validation specification](json-schema-release-notes.html).
12+
13+
The [new draft](json-schema-hypermedia.html) has been completely rewritten
14+
for clarity and accessibility, so it is best to simply approach it as a new
15+
proposal. We hope to add tutorial material at some point, but that is
16+
outside of the scope of release notes.
17+
18+
However, if you wish to migrate from an earlier draft, this page is a guide
19+
to the key _changes_. The additions, which are much more numerous,
20+
should be learned directly from the new specification until we can provide
21+
tutorials.
22+
23+
* TOC
24+
{:toc}
25+
26+
27+
### Migrating from draft-06
28+
29+
No draft-06 features were changed, although two keywords were renamed
30+
for clarity and consistency:
31+
32+
* `mediaType` -> `targetMediaType`
33+
* `submissionEncType` -> `submissionMediaType`
34+
35+
Additionally, `hrefSchema` was somewhat confusing, so a great deal
36+
more effort has gone into explaining how it works, and how it fits
37+
into the overall link resolution process.
38+
39+
### Migrating from draft-05
40+
41+
See the [draft-06 release notes](../draft-06/json-hyper-schema-migration-faq.html)
42+
for information related to draft-05.
43+
44+
### Migrating from draft-04
45+
46+
For an overview of why the way `method` and `targetSchema` were typically used
47+
in draft-04 poses a challenge for migrating to more recent drafts, see
48+
the [draft-06 release notes](../draft-06/json-hyper-schema-migration-faq.html).
49+
Those release notes also explain what happened to the link relations defined
50+
in draft-04 and subsequently removed, and the changes in how the instance
51+
base URI is determined.
52+
53+
Beyond those changes, a minimal migration would be something along the
54+
following lines, although the
55+
[intentional lack of explicit response descriptions](json-schema-hypermedia.html#rfc.appendix.A.2)
56+
(except when the response happens to be a representation of the target resource)
57+
means that some uses of draft-04 do not have direct analogues in draft-07.
58+
Any keyword not mentioned in a list below is unchanged for that link operation.
59+
60+
#### GET
61+
62+
* `"method": "GET"` -> `"targetHints": {"allow": ["GET"]}`
63+
* `mediaType` -> `targetMediaType`
64+
* `schema` -> `hrefSchema` with parameters added to `href`
65+
* `encType` -> drop if `application/x-www-form-urlencoded`, contact the mailing list otherwise
66+
67+
#### PUT
68+
69+
If you have a PUT link where `schema`/`encType` differ from
70+
`targetSchema`/`mediaType`, where `targetSchema`/`mediaType`
71+
describe a non-representation response, then those fields do
72+
not have a direct replacement.
73+
74+
* `"method": "PUT"` -> `"targetHints": {"allow": ["PUT"]}`
75+
* `schema` -> `targetSchema`
76+
* `encType` -> `targetMediaType`
77+
78+
#### DELETE
79+
80+
DELETE does not take a request payload, so `schema` and `encType`
81+
should be unused. If `targetSchema` and `mediaType` were being
82+
used for a response other than the just-deleted resource's representation,
83+
then they do not have a direct replacement.
84+
85+
* `"method": "DELETE"` -> `"targetHints": {"allow": ["DELETE"]}`
86+
* `mediaType` -> `targetMediaType` (if describing the representation)
87+
88+
#### POST
89+
90+
In most cases, the response of a POST is **not** a representation of the
91+
target resource, but rather some sort of result or status of whatever
92+
the POST attempted to do. Therefore `targetSchema` and `mediaType`
93+
should almost certainly be dropped. Other than that:
94+
95+
* `"method": "POST"` -> `"targetHints": {"allow": ["POST"]}`
96+
* `schema` -> `submissionSchema`
97+
* `encType` -> `submissionMediaType`
98+
99+
#### PATCH
100+
101+
It was never entirely clear how to model a propert PATCH (that uses
102+
a patch media type rather than `application/json` in the request) in Hyper-Schema.
103+
One option was to treat it identically to PUT except with the patch media type
104+
in `encType`. Assuming that approach (and the same `taregetSchema`/`mediaType`
105+
caveats as for PUT):
106+
107+
* `"method": "PATCH"` -> `"targetHints": {"allow": ["PATCH"]}`
108+
* `schema` -> `targetSchema`
109+
* `"encType": "..."` -> `"targetHints": {"accept-patch": "..."}`
110+

0 commit comments

Comments
 (0)