Skip to content

Commit

Permalink
Remove "method", URI input with "hrefVars"
Browse files Browse the repository at this point in the history
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".
  • Loading branch information
handrews committed Nov 23, 2016
1 parent 6b33025 commit f530c1f
Show file tree
Hide file tree
Showing 3 changed files with 258 additions and 175 deletions.
30 changes: 19 additions & 11 deletions hyper-schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"id": "http://json-schema.org/draft/hyper-schema#",
"title": "JSON Hyper-Schema",
"allOf": [
{"$ref": "http://json-schema.org/draft-04/schema#"}
{"$ref": "http://json-schema.org/draft/schema#"}
],
"properties": {
"additionalItems": {
Expand Down Expand Up @@ -48,7 +48,13 @@

"base": {
"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.",
"type": "string"
"type": "string",
"format": "uritemplate"
},
"baseVars": {
"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.",
"type": "object",
"additionalProperties": {"$ref": "#"}
},
"links": {
"type": "array",
Expand Down Expand Up @@ -80,7 +86,13 @@
"properties": {
"href": {
"description": "a URI template, as defined by RFC 6570, with the addition of the $, ( and ) characters for pre-processing",
"type": "string"
"type": "string",
"format": "uritemplate"
},
"hrefVars": {
"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.",
"type": "object",
"additionalProperties": {"$ref": "#"}
},
"rel": {
"description": "relation to the target resource of the link",
Expand All @@ -92,24 +104,20 @@
},
"targetSchema": {
"description": "JSON Schema describing the link target",
"$ref": "#"
"allOf": [{"$ref": "#"}]
},
"mediaType": {
"description": "media type (as defined by RFC 2046) describing the link target",
"type": "string"
},
"method": {
"description": "specifies that the client can construct a templated query (\"get\") or non-idempotent request (\"post\") to a resource.",
"type": "string"
},
"encType": {
"description": "The media type in which to submit data along with the request",
"description": "The media type in which to submit data in the request body",
"type": "string",
"default": "application/json"
},
"schema": {
"description": "Schema describing the data to submit along with the request",
"$ref": "#"
"description": "Schema describing the data to submit in the request body"},
"allOf": [{"$ref": "#"}]
}
}
}
Expand Down
Loading

0 comments on commit f530c1f

Please sign in to comment.