Skip to content

Better multiple related resources request example #1227

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

Merged
merged 2 commits into from
Jun 10, 2022
Merged

Conversation

bf4
Copy link
Contributor

@bf4 bf4 commented Oct 14, 2017

GET /articles/1?include=author,comments.author

is confusing since author and comments.author both reference the author resource',
but with different meaning.

It looks a lot like how

GET /users/1?include=articles,articles.comments

is identical to

GET /users/1?include=articles.comments

since full linkage requires intermediate resources to be returned

So, I've changed the the related resources to be more obviously different

> GET /articles/1?include=author,comments.author

is confusing since `author` and `comments.author` both reference the `author` resource', 
but with different meaning.

It looks a lot like

GET /users/1?include=articles,articles.comments

which is identical to

GET /users/1?include=articles.comments

since full linkage requires intermediate resources to be returned

So, I've changed the the related resources to be more obviously different
Copy link
Contributor

@jelhan jelhan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot for this proposal. I agree that having author twice could be confusing. Additionally I would switch the order. Than it would directly add to the examples given before. In order they would be the following:

GET /articles/1?include=comments HTTP/1.1
GET /articles/1?include=comments.author HTTP/1.1
GET /articles/1?include=comments.author,ratings HTTP/1.1

Co-authored-by: Jeldrik Hanschke <jelhan@users.noreply.github.com>
Copy link
Member

@dgeb dgeb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @bf4 and @jelhan. I can see how this is subtly more clear.

@dgeb dgeb merged commit adc530b into json-api:gh-pages Jun 10, 2022
@dgeb
Copy link
Member

dgeb commented Jun 10, 2022

@bf4 / @jelhan would either of you be up for applying this same change to the 1.1 spec in another PR?

@jelhan
Copy link
Contributor

jelhan commented Jun 13, 2022

@bf4 / @jelhan would either of you be up for applying this same change to the 1.1 spec in another PR?

Done in #1629.

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 this pull request may close these issues.

3 participants
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