Skip to content

Rename top-level 'links' & clarify what a link is #380

@bintoro

Description

@bintoro

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 hyperlinks
  • rel, 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 hyperlinks
  • rel, 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 hyperlinks
  • links 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 a posts resource = a link (pointing to a specific comment resource).

This would agree nicely with the existing term "link object".

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy