Skip to content

Commit f530c1f

Browse files
committed
Remove "method", URI input with "hrefVars"
In the most recent draft, "method" simply controlled whether link input was placed in the URI (for a value of "get") or in the request body (for a valued 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 "hrefVars" and "baseVars", which provide schemas for user input matching the "href" and "base" URI Template variables, respectively. It removes "method" and makes "schema" and "encType" unambiguously apply to the request body in all cases. Clients should choose when to use the request body submission based on the rules of the protocol given by the URI scheme and the semantics indicated by the link relation. Additionally, the complex and apparently rarely if ever used 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, and the LDO schema has been brought over from the web site repo and updated. Improper use of "$ref" has been fixed with "allOf".
1 parent 6b33025 commit f530c1f

File tree

3 files changed

+258
-175
lines changed

3 files changed

+258
-175
lines changed

hyper-schema.json

+19-11
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"id": "http://json-schema.org/draft/hyper-schema#",
44
"title": "JSON Hyper-Schema",
55
"allOf": [
6-
{"$ref": "http://json-schema.org/draft-04/schema#"}
6+
{"$ref": "http://json-schema.org/draft/schema#"}
77
],
88
"properties": {
99
"additionalItems": {
@@ -48,7 +48,13 @@
4848

4949
"base": {
5050
"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.",
51-
"type": "string"
51+
"type": "string",
52+
"format": "uritemplate"
53+
},
54+
"baseVars": {
55+
"description": "an object where each property is a variable name from \"base\" and the value is a schema describing the data needed to fill in the variable.",
56+
"type": "object",
57+
"additionalProperties": {"$ref": "#"}
5258
},
5359
"links": {
5460
"type": "array",
@@ -80,7 +86,13 @@
8086
"properties": {
8187
"href": {
8288
"description": "a URI template, as defined by RFC 6570, with the addition of the $, ( and ) characters for pre-processing",
83-
"type": "string"
89+
"type": "string",
90+
"format": "uritemplate"
91+
},
92+
"hrefVars": {
93+
"description": "an object where each property is a variable name from \"href\" and the value is a schema describing the data needed to fill in the variable.",
94+
"type": "object",
95+
"additionalProperties": {"$ref": "#"}
8496
},
8597
"rel": {
8698
"description": "relation to the target resource of the link",
@@ -92,24 +104,20 @@
92104
},
93105
"targetSchema": {
94106
"description": "JSON Schema describing the link target",
95-
"$ref": "#"
107+
"allOf": [{"$ref": "#"}]
96108
},
97109
"mediaType": {
98110
"description": "media type (as defined by RFC 2046) describing the link target",
99111
"type": "string"
100112
},
101-
"method": {
102-
"description": "specifies that the client can construct a templated query (\"get\") or non-idempotent request (\"post\") to a resource.",
103-
"type": "string"
104-
},
105113
"encType": {
106-
"description": "The media type in which to submit data along with the request",
114+
"description": "The media type in which to submit data in the request body",
107115
"type": "string",
108116
"default": "application/json"
109117
},
110118
"schema": {
111-
"description": "Schema describing the data to submit along with the request",
112-
"$ref": "#"
119+
"description": "Schema describing the data to submit in the request body"},
120+
"allOf": [{"$ref": "#"}]
113121
}
114122
}
115123
}

0 commit comments

Comments
 (0)