-
Notifications
You must be signed in to change notification settings - Fork 351
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
Add links for all available includes to JsonApiSerializer #331
Add links for all available includes to JsonApiSerializer #331
Conversation
👍 I really like this implementation and it makes sense to return the available includes as relationships. This is a breaking change, though. It will need to wait for 1.0. |
Cool, thanks Graham! |
I was about to start working on this but now I can move onto other things. Thanks @yuloh! |
Looking for an update on this PR. IS there a time line for getting this merged in? |
* @param array $resource The resource to add relationship links to | ||
* @param string $relationshipKey The resource key of the relationship | ||
*/ | ||
private function addRelationshipLinks($resource, $relationshipKey) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it make sense to make this method protected? I can see cases where it would be nice to have a custom link structure here.
After some consideration I'm going to go ahead and merge this pre-1.0. It'll be going in to 0.17.0 which should be tagged within the next week. |
src/Serializer/JsonApiSerializer.php
Outdated
|
||
return $resource; | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here is a /**
missing.
Looks like the merge went bad. I will push a fix soon. |
any news on this? |
As far as I can tell, adding the change suggested by @Art4 lets the build tests pass, (tested with the more recent changes on current master pulled in) - is there anything we can do to help update? |
Sorry it took so long everybody. @greydnls this PR should be ready to merge now. |
Any update on this one? |
Is this PR going to be merged? It's been over a year now. :( |
Any updates? |
@yuloh there are cases where we have includes which are not relationships. e.g. this can be appended to the resource attributes by returning a primitive resource from the include method. How about allowing to define Nice job! |
@matt-allan is this still active? |
It’s not really active, I’ve just been waiting for it to be merged. Last I heard it was approved to merge. |
@matt-allan a few things have changed, so we will look to getting this merged. There is a merge conflict that needs to be addressed. |
@matthewtrask I fixed the merge conflicts and updated the tests. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
This PR changes the JsonApiSerializer to always add a 'relationships' key with links. Before the serializer would only add links if the resource was included.
I had to update a lot of tests since the output changes. This is a breaking change since new data is added to the output, but nothing is removed from the output so it shouldn't actually break any clients.
Closes #292 & #242. Supersedes the changes in #272, so that PR should not be merged if this one is.
Here is a link to the relevant part of the JSON:API specification.