Skip to content

JSON:API add inclusion of resources from path#3288

Merged
alanpoulain merged 2 commits into
api-platform:mainfrom
andreasschacht:include-resources-from-path
Mar 17, 2021
Merged

JSON:API add inclusion of resources from path#3288
alanpoulain merged 2 commits into
api-platform:mainfrom
andreasschacht:include-resources-from-path

Conversation

@andreasschacht

Copy link
Copy Markdown
Contributor
Q A
Bug fix? no
New feature? yes
BC breaks? no
Deprecations? no
Tickets fixes #2365
License MIT
Doc PR

As specified in the JSON:API specs (https://jsonapi.org/format/#fetching-includes): In order to request resources related to other resources, a dot-separated path for each relationship name can be specified

GET /articles/1?include=comments.author HTTP/1.1
Accept: application/vnd.api+json


// do not include primary resources
$context['api_included_resources'] = [
$resourceMetadata->getShortName() => [

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

What about self-referencing relationships?

@andreasschacht andreasschacht Dec 2, 2019

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Sorry, can't follow you. Maybe the comment above is misleading. It's just about primary data is already part of the "regular" answer and it's not necessary to put them into the included part too.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@dunglas Do you want me to do or change anything?

@simonihmig

Copy link
Copy Markdown

Anything blocking this?

@reggermont

Copy link
Copy Markdown

Any news for this one ?

@andreasschacht andreasschacht force-pushed the include-resources-from-path branch from 40f2486 to 98822d6 Compare October 19, 2020 12:38
@andreasschacht

Copy link
Copy Markdown
Contributor Author

@dunglas I rebased to the current master. Please let me know if I can do anything more.

Base automatically changed from master to main January 23, 2021 21:59
@alanpoulain alanpoulain force-pushed the include-resources-from-path branch 2 times, most recently from e445091 to 80918b6 Compare March 17, 2021 15:53
@alanpoulain alanpoulain force-pushed the include-resources-from-path branch from 80918b6 to bb3d613 Compare March 17, 2021 16:00
@alanpoulain

Copy link
Copy Markdown
Member

Nice improvement! I've simplified a little the code 🙂

@alanpoulain alanpoulain merged commit 7ba0628 into api-platform:main Mar 17, 2021
@alanpoulain

Copy link
Copy Markdown
Member

Thank you very much @andreasschacht. Sorry for the time we took to merge your PR.

@rvmourik

Copy link
Copy Markdown

This is a nice improvement! Is it known in which version this will be included?

@alanpoulain

Copy link
Copy Markdown
Member

In version 2.7. We don't have a release date.

@rvmourik

Copy link
Copy Markdown

In version 2.7. We don't have a release date.

thanks for the quick reply

@Giant-Jelly

Copy link
Copy Markdown

image

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.

Support inclusion of resources from a path according to JSON:API spec

7 participants