-
Notifications
You must be signed in to change notification settings - Fork 889
Description
In JSON API, links objects are containers for relationships (on resources) and hyperlinks (at the top level). This idea probably comes from HAL, where relationships are hyperlinks. In JSON API, relationships are expressed in many formats and are clearly a separate concept. There's no similarity whatsoever between the top-level links
member and resource-level links
members.
In addition, the language of the spec strongly implies that linked resources have to do with those in a compound document specifically. (EDIT: For latest example, see PR #396 whose intention makes sense but the wording of which is in direct contradiction with the name and definition of links
.)
So, we're overloading the word "link" with no fewer than three distinct meanings. Ideally, it would refer to one concept only.
Solution 1:
links
at the document level to host document-wide hyperlinksrel
,relations
,related
, ... at the resource level to host relationships- related resources when talking about related resources
- relationship object instead of link object etc.
- included resources when talking about compound documents
Solution 2:
hrefs
at the document level to host document-wide hyperlinksrel
,relations
,related
, ... at the resource level to host relationships- related resources when talking about related resources
- relationship object instead of link object etc.
- linked resources when talking about compound documents
Solution 3:
hrefs
at the document level to host document-wide hyperlinkslinks
at the resource level to host relationships (same as today)- linked resources when talking about related resources
- link object same as today
- included resources when talking about compound documents
If we choose to use the word "link" in the general "relationship" meaning (option 3), then it's possible to relate the terms like this: if relationship refers to an association between types of resources, then a link would be its realization between concrete resources.
posts.comment
= a relationship (a more abstract thing)links.comment
on aposts
resource = a link (pointing to a specific comment resource).
This would agree nicely with the existing term "link object".