Skip to content

Commit 5b80db6

Browse files
committed
Since base is a template, it needs baseVars
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.
1 parent 08c4929 commit 5b80db6

File tree

2 files changed

+35
-1
lines changed

2 files changed

+35
-1
lines changed

hyper-schema.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,15 @@
4646
"oneOf": {"$ref": "#/definitions/schemaArray"},
4747
"not": { "$ref": "#" },
4848

49+
"base": {
50+
"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"
52+
},
53+
"baseVars": {
54+
"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",
55+
"type": "object",
56+
"additionalProperties": {"type": "string"}
57+
},
4958
"links": {
5059
"type": "array",
5160
"items": {"$ref": "#/definitions/linkDescription"}

jsonschema-hyperschema.xml

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,11 @@
187187
It is therefore the first URI Reference resolved, regardless of which order it was found in.
188188
</t>
189189
<t>
190-
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.
190+
The URI is computed from the provided URI template, along with
191+
<xref target="base-vars">"baseVars"</xref>, using the same
192+
process described for the <xref target="href">"href"</xref>
193+
and <xref target="href-vars">"hrefVars"</xref> properties of
194+
a Link Description Object.
191195
</t>
192196
<figure>
193197
<preamble>An example of a JSON schema using "base":</preamble>
@@ -232,6 +236,27 @@
232236
</t>
233237
</section>
234238

239+
<section title="baseVars" anchor="base-vars">
240+
<t>
241+
The value of this keyword MUST be an object.
242+
The property names in the object SHOULD each be identical to
243+
a template variable from the "base" value in this schema.
244+
The value of each property MUST be a
245+
<xref target="relative-json-pointer">Relative JSON Pointer</xref>.
246+
</t>
247+
<t>
248+
The "baseVars" object is used to resolve "base" template
249+
variable names that do not meet the restrictions of the
250+
<xref target="RFC6570">URI Template specification</xref>,
251+
or that need to resolve to values other than immediate
252+
properties of the instance.
253+
</t>
254+
<t>
255+
See the <xref target="href-vars">"hrefVars"</xref> link
256+
description keyword for the rules for using the mappings.
257+
</t>
258+
</section>
259+
235260
<section title="links">
236261
<t>
237262
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.

0 commit comments

Comments
 (0)