Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clarify intent of links member #1684

Open
jelhan opened this issue Feb 4, 2023 · 1 comment · May be fixed by #1691
Open

Clarify intent of links member #1684

jelhan opened this issue Feb 4, 2023 · 1 comment · May be fixed by #1691

Comments

@jelhan
Copy link
Contributor

jelhan commented Feb 4, 2023

There seems to be confusion about the intent of the links member. Readers of the specification assume that it is meant to hold any links. Even many some implementations have followed that misunderstanding. See #1019 and #1656 as examples. Allowing implementation-specific members in the links objects has been requested at many places. See #1678 and https://discuss.jsonapi.org/t/links-with-custom-relations/1942, https://discuss.jsonapi.org/t/links-object-clarification-needed/130 and as examples.

The main reason for both the misunderstandings as well as the requests to allow implementation-specific members are based on the assumption that all URLs should go into links member. In my understanding of the spec the links is only for discovering related JSON:API documents. Other URLs should be an attribute of a resource (e.g. for referencing a file attached to a resource), should go into meta or extension-specific members (e.g. for alternative representations of the same resource).

I feel we should communicate that intent more clearly (assuming that my understanding of the specification is correct). Especially the following introduction sentence in Links chapter may be misleading:

Where specified, a links member can be used to represent links.

I feel we should clarify that it is only about representing links to related JSON:API documents. Additionally we may want to give a hint how to handle other URLs / links in a note.

@lode
Copy link
Contributor

lode commented Mar 1, 2023

My preference is to allow non-API links. Placing those links elsewhere looses all the benefits of the specification of a link object's members. And I think the confusion, or the fact that some implementations are doing this 'wrong', is something hard to fight against.

I'm curious, what is the reason to not allow non-API links? What benefits do we gain by doing that?

Semi-related: #1680. We might want to think about that the same time.

@jelhan jelhan linked a pull request Apr 21, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants