Skip to content

Commit d2a2e3f

Browse files
authored
Merge pull request #494 from handrews/overview
Add minimal example to the hyper-schema Overview
2 parents bfc5fda + 0b3ddf6 commit d2a2e3f

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

jsonschema-hyperschema.xml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,36 @@
146146
other link serializations or representation formats at runtime, or pre-emptively
147147
follow links to facilitate server push usage.
148148
</t>
149+
<figure>
150+
<preamble>
151+
Here is an example hyper-schema that adds a single link, with the
152+
IANA-registered link relation type "self", that is built from an instance
153+
with one known object field named "id":
154+
</preamble>
155+
<artwork>
156+
<![CDATA[{
157+
"type": "object",
158+
"properties": {
159+
"id": {
160+
"type": "number",
161+
"readOnly": true
162+
}
163+
},
164+
"links": [
165+
{
166+
"rel": "self",
167+
"href": "thing/{id}"
168+
}
169+
]
170+
}]]>
171+
</artwork>
172+
<postamble>
173+
If the instance is {"id": 1234}, and its base URI according to
174+
<xref target="RFC3986">RFC 3986 section 5.1</xref>, is
175+
"https://api.example.com/", then "https://api.example.com/thing/1234"
176+
is the resulting link's target URI.
177+
</postamble>
178+
</figure>
149179

150180
<section title="Terminology">
151181
<t>

0 commit comments

Comments
 (0)