@@ -746,38 +746,19 @@ of this member **MUST** be an object (a "links object").
746
746
<a href =" #document-links-link " id =" document-links-link " ></a >
747
747
Within this object, a link ** MUST** be represented as either:
748
748
749
- * a URI-reference [[ RFC3986 Section 4.1] ( https://tools.ietf.org/html/rfc3986#section-4.1 )] to the link's target.
750
- * <a id =" document-links-link-object " ></a >an object ("link object") which ** MAY**
751
- contain the following members:
752
- * ` href ` : a URI-reference [[ RFC3986 Section 4.1] ( https://tools.ietf.org/html/rfc3986#section-4.1 )] to the link's target.
753
- * ` rel ` : a [ link relation type] [ link relation type ] defining the semantics of
754
- the link.
755
- * ` anchor ` : a URI-reference [[ RFC3986 Section 4.1] ( https://tools.ietf.org/html/rfc3986#section-4.1 )]
756
- to the link's context. By default, the context of a link is the
757
- [ top-level object] [ top level ] , [ resource object] [ resource objects ] , or
758
- [ relationship object] [ relationships ] in which the link appears.
759
- * ` describedby ` : a [ link] to a description document (e.g. OpenAPI or JSON
760
- Schema) for the link target.
761
- * ` title ` : a string which serves as a label for the destination of a link
762
- such that it can be used as a human-readable identifier (e.g., a menu
763
- entry) in the language indicated by the ` Content-Language ` header field (if
764
- present).
765
- * ` type ` : a string a which serves as a hint indicating the media type of the
766
- target resource.
767
- * ` hreflang ` : a string or an array of strings which serve as a hint
768
- indicating the language of target resource. An array of strings indicates
769
- that multiple languages of the target resource are available. Each string
770
- ** MUST** be a valid language tag
771
- [[ RFC5646] ( https://tools.ietf.org/html/rfc5646 )] .
772
- * ` meta ` : a meta object containing non-standard meta-information about the
773
- link.
749
+ * a string whose value is a URI-reference [[ RFC3986 Section 4.1] ( https://tools.ietf.org/html/rfc3986#section-4.1 )]
750
+ pointing to the link's target.
751
+ * a [ link object]
774
752
775
- > Note: the ` type ` and ` hreflang ` members are only hints; the target resource
776
- > is not guaranteed to be available in the indicated media type or language
777
- > when the link is actually followed.
753
+ A link's relation type ** SHOULD** be inferred from the name of the link unless a
754
+ ` rel ` member is present on the [ link object] .
778
755
779
- In the example below, the ` self ` link is simply a URI string, whereas the
780
- ` related ` link uses the object form to provide meta information about a
756
+ A link's context is the [ top-level object] [ top level ] , [ resource
757
+ object] [ resource objects ] , or [ relationship object] [ relationships ] in which its
758
+ parent links object appears.
759
+
760
+ In the example below, the ` self ` link is a string, whereas the ` related ` link
761
+ is a [ link object] . The link object provides additional information about a
781
762
related resource collection as well as a schema that serves as a description
782
763
document for that collection:
783
764
@@ -786,6 +767,7 @@ document for that collection:
786
767
"self" : " http://example.com/articles/1/relationships/comments" ,
787
768
"related" : {
788
769
"href" : " http://example.com/articles/1/comments" ,
770
+ "title" : " Comments" ,
789
771
"describedby" : " http://example.com/schemas/article-comments" ,
790
772
"meta" : {
791
773
"count" : 10
@@ -794,21 +776,36 @@ document for that collection:
794
776
}
795
777
```
796
778
797
- ##### <a href =" #document-links-link-relation-type " id =" document-links-link-relation-type " class =" headerlink " ></a > Link relation type
779
+ #### <a id =" document-links-link-object " ></a > Link objects
780
+
781
+ A "link object" is an object that represents a [ web link] ( https://tools.ietf.org/html/rfc8288 ) .
798
782
799
- The value of the ` rel ` member ** MUST** be a string that represents a link relation
800
- type. Valid link relation types are defined by
801
- [ RFC8288 Section 2.1] ( https://tools.ietf.org/html/rfc8288#section-2.1 ) .
783
+ A link object ** MUST** contain the following member:
802
784
803
- If a ` rel ` member is not given on a link object, the link's relation type
804
- ** SHOULD ** be inferred from the name of the link object .
785
+ * ` href ` : a string whose value is a URI-reference [[ RFC3986 Section 4.1 ] ( https://tools.ietf.org/html/rfc3986#section-4.1 )]
786
+ pointing to the link's target .
805
787
806
- In order to represent a link with reversed semantics, it is ** RECOMMENDED**
807
- that an alternate link relation type be used or, less preferably, that the
808
- ` anchor ` and ` href ` members be interchanged.
788
+ A link object ** MAY** also contain any of the following members:
809
789
810
- > Note: Historically, a ` rev ` link parameter was used for this purpose but has
811
- > since been deprecated by [ RFC8288 Section 3.3] ( https://tools.ietf.org/html/rfc8288#section-3.3 ) .
790
+ * ` rel ` : a string indicating the link's relation type. The string ** MUST** be a
791
+ [ valid link relation type] ( https://tools.ietf.org/html/rfc8288#section-2.1 ) .
792
+ * ` describedby ` : a [ link] to a description document (e.g. OpenAPI or JSON
793
+ Schema) for the link target.
794
+ * ` title ` : a string which serves as a label for the destination of a link
795
+ such that it can be used as a human-readable identifier (e.g., a menu
796
+ entry) in the language indicated by the ` Content-Language ` header field (if
797
+ present).
798
+ * ` type ` : a string indicating the media type of the link's target.
799
+ * ` hreflang ` : a string or an array of strings indicating the language(s) of the
800
+ link's target. An array of strings indicates that multiple languages of the
801
+ link's target are available. Each string ** MUST** be a valid language tag
802
+ [[ RFC5646] ( https://tools.ietf.org/html/rfc5646 )] .
803
+ * ` meta ` : a meta object containing non-standard meta-information about the
804
+ link.
805
+
806
+ > Note: the ` type ` and ` hreflang ` members are only hints; the target resource
807
+ > is not guaranteed to be available in the indicated media type or language
808
+ > when the link is actually followed.
812
809
813
810
### <a href =" #document-jsonapi-object " id =" document-jsonapi-object " class =" headerlink " ></a > JSON: API Object
814
811
0 commit comments