Skip to content

Commit e088bff

Browse files
authored
Merge pull request #352 from handrews/link-anchor
Add "anchor" LDO keyword.
2 parents a560f8b + ce89e39 commit e088bff

File tree

2 files changed

+33
-5
lines changed

2 files changed

+33
-5
lines changed

hyper-schema.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,11 @@
2929
"description": "relation to the target resource of the link",
3030
"type": "string"
3131
},
32+
"anchor": {
33+
"description": "the URI of the context resource",
34+
"type": "string",
35+
"format": "uri-reference"
36+
},
3237
"title": {
3338
"description": "a title for the link",
3439
"type": "string"

jsonschema-hyperschema.xml

Lines changed: 28 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -761,14 +761,28 @@
761761
</t>
762762

763763
<t>
764-
The relation to the target is interpreted as from the instance that the schema
765-
(or sub-schema) applies to, not any larger document that the instance may have
766-
been found in.
764+
As defined by RFC 5988, a link connects a context resource
765+
to a target resource, where the nature of the connection
766+
is described by the link relation type. The context
767+
resource is the instance to which the schema (or sub-schema)
768+
applies, rather than any larger document in which the
769+
instance may have been found. The context may be changed
770+
with the <xref target="anchor">"anchor"</xref> property.
767771
</t>
768772

769773
<t>
770-
Relationship definitions are not normally media type dependent, and users are
771-
encouraged to utilize existing accepted relation definitions.
774+
Depending on the media type of the instance, it may or may
775+
not be possible to assign a URI to the exact default context
776+
resource. In particular, application/json does not define
777+
URI fragment resolution semantics, so properties or array
778+
elements within a plain JSON document cannot be identified
779+
by a URI.
780+
</t>
781+
782+
<t>
783+
Relationship definitions are not normally media type
784+
dependent, and users are encouraged to utilize existing
785+
accepted relation definitions.
772786
</t>
773787

774788
<figure>
@@ -883,6 +897,15 @@ GET /foo/
883897
</section>
884898
</section>
885899

900+
<section title="anchor" anchor="anchor">
901+
<t>
902+
This property sets the context URI of the link.
903+
The value of the property MUST be resolved as a
904+
<xref target="RFC3986">URI-reference</xref> against
905+
the base URI of the instance.
906+
</t>
907+
</section>
908+
886909
<section title="title">
887910
<t>
888911
This property defines a title for the link.

0 commit comments

Comments
 (0)