Skip to content

Commit 1ff04ce

Browse files
committed
Support URI input with "hrefSchema"
In Draft 05, "method" simply controlled whether link input was placed in the URI (for a value of "get") or in the request body (for a value of "post"). While correlating with HTML, this was both confusing due to "get" and "post" not necessarily indicating the HTTP methods of the same name, and limiting in that users/clients could not submit data through both the URI and the request body at the same time. This introduces "hrefSchema" which provides a schema for user input matching the "href" URI Template variables. Since "schema" is now only used in the cases where "method" was set to "post" in Draft 05, there is no longer a need for "method". A link with a "schema" is equivalent to a Draft 05 "post" link. A link without a "schema" is equivalent to a Draft 05 "get" link. As in Draft 05, a "get" link simply indicates the presence of a related resource, and does not mean that HTTP GET is the only method that can be used with the resource. Additionally, the complex and apparently rarely if ever used "href" preprocessing rules have been removed, and both the resulting and pre-existing limitations have been documented. They will be the subject of work for future drafts. The meta-schemas have been updated accordingly.
1 parent a43ed2c commit 1ff04ce

File tree

3 files changed

+201
-175
lines changed

3 files changed

+201
-175
lines changed

hyper-schema.json

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,12 @@
1818
"properties": {
1919
"href": {
2020
"description": "a URI template, as defined by RFC 6570, with the addition of the $, ( and ) characters for pre-processing",
21-
"type": "string"
21+
"type": "string",
22+
"format": "uritemplate"
23+
},
24+
"hrefSchema": {
25+
"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\"",
26+
"allOf": [ {"$ref": "#"} ]
2227
},
2328
"rel": {
2429
"description": "relation to the target resource of the link",
@@ -36,10 +41,6 @@
3641
"description": "media type (as defined by RFC 2046) describing the link target",
3742
"type": "string"
3843
},
39-
"method": {
40-
"description": "specifies that the client can construct a templated query (\"get\") or non-idempotent request (\"post\") to a resource.",
41-
"type": "string"
42-
},
4344
"encType": {
4445
"description": "The media type in which to submit data along with the request",
4546
"type": "string",
@@ -96,7 +97,8 @@
9697

9798
"base": {
9899
"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.",
99-
"type": "string"
100+
"type": "string",
101+
"format": "uritemplate"
100102
},
101103
"links": {
102104
"type": "array",

0 commit comments

Comments
 (0)