Skip to content

Commit 2fe4e1c

Browse files
committed
As minimal example to the hyper-schema Overview
This should be enough to give a feel for the basics without needing a detailed explanation or taking up too much space during the introductory sections.
1 parent 92fc8cb commit 2fe4e1c

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

jsonschema-hyperschema.xml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,38 @@
147147
other link serializations or representation formats at runtime, or pre-emptively
148148
follow links to facilitate server push usage.
149149
</t>
150+
<figure>
151+
<preamble>
152+
The empty schema is a valid hyper-schema, as all schema keywords are optional,
153+
and simply has no effect. No hyperlinks are applied by default. The following
154+
fairly minimal non-trivial hyper-schema shows a single link, with the
155+
IANA-registered link relation type "self", that is build from the lone object
156+
field in the instance:
157+
</preamble>
158+
<artwork>
159+
<![CDATA[{
160+
"type": "object",
161+
"properties": {
162+
"id": {
163+
"type": "number",
164+
"readOnly": true
165+
}
166+
},
167+
"links": [
168+
{
169+
"rel": "self",
170+
"href": "thing/{id}"
171+
}
172+
]
173+
}]]>
174+
</artwork>
175+
<postamble>
176+
If the instance is {"id": 1234}, and its base URI according to
177+
<xref target="RFC3986">RFC 3986 section 5.1</xref>, is
178+
"https://api.example.com/", then "https://api.example.com/thing/1234"
179+
is the resulting link's target URI.
180+
</postamble>
181+
</figure>
150182

151183
<section title="Terminology">
152184
<t>

0 commit comments

Comments
 (0)