Skip to content

Commit

Permalink
Since base is a template, it needs baseVars
Browse files Browse the repository at this point in the history
Not sure why this escaped me before.  The addition of "base" in the
meta-schema is copied from a separate pull request in order for this
series of changes to make sense on its own.
  • Loading branch information
handrews committed Nov 16, 2016
1 parent 08c4929 commit 5b80db6
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 1 deletion.
9 changes: 9 additions & 0 deletions hyper-schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,15 @@
"oneOf": {"$ref": "#/definitions/schemaArray"},
"not": { "$ref": "#" },

"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"
},
"baseVars": {
"description": "a mapping from URI template names in \"base\" to relative JSON pointers to be applied to the instance to find the template variable's value",
"type": "object",
"additionalProperties": {"type": "string"}
},
"links": {
"type": "array",
"items": {"$ref": "#/definitions/linkDescription"}
Expand Down
27 changes: 26 additions & 1 deletion jsonschema-hyperschema.xml
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,11 @@
It is therefore the first URI Reference resolved, regardless of which order it was found in.
</t>
<t>
The URI is computed from the provided URI template using the same process described for the <xref target="href">"href"</xref> and <xref target="href-vars">"hrefVars"</xref> properties of a Link Description Object.
The URI is computed from the provided URI template, along with
<xref target="base-vars">"baseVars"</xref>, using the same
process described for the <xref target="href">"href"</xref>
and <xref target="href-vars">"hrefVars"</xref> properties of
a Link Description Object.
</t>
<figure>
<preamble>An example of a JSON schema using "base":</preamble>
Expand Down Expand Up @@ -232,6 +236,27 @@
</t>
</section>

<section title="baseVars" anchor="base-vars">
<t>
The value of this keyword MUST be an object.
The property names in the object SHOULD each be identical to
a template variable from the "base" value in this schema.
The value of each property MUST be a
<xref target="relative-json-pointer">Relative JSON Pointer</xref>.
</t>
<t>
The "baseVars" object is used to resolve "base" template
variable names that do not meet the restrictions of the
<xref target="RFC6570">URI Template specification</xref>,
or that need to resolve to values other than immediate
properties of the instance.
</t>
<t>
See the <xref target="href-vars">"hrefVars"</xref> link
description keyword for the rules for using the mappings.
</t>
</section>

<section title="links">
<t>
The "links" property of schemas is used to associate Link Description Objects with instances. The value of this property MUST be an array, and the items in the array must be Link Description Objects, as defined below.
Expand Down

0 comments on commit 5b80db6

Please sign in to comment.