8000 fix: related relationship responses top level links `self` link should be the relations `related` link by haddowg · Pull Request #17 · laravel-json-api/core · GitHub
[go: up one dir, main page]

Skip to content

fix: related relationship responses top level links self link should be the relations related link #17

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

Conversation

haddowg
Copy link
Contributor
@haddowg haddowg commented May 29, 2024

The spec states top level links objects may contain a self link as the link that generated the current response document.

Currently relationship related endpoints will return a self link that points to the relationship endpoint.

This PR corrects this so that the self link is replaced with the value of the related link and the redundant related link removed on related responses.

This is the cleanest way I could see to implement it but happy to rework it if needed.

@lindyhopchris lindyhopchris self-assigned this May 30, 2024
@lindyhopchris lindyhopchris self-requested a review June 26, 2024 18:50
@lindyhopchris lindyhopchris merged commit 9ac2839 into laravel-json-api:develop Jun 26, 2024
@lindyhopchris
Copy link
Contributor

Thanks for this, the PR helped. I did make some minor changes to ensure that any custom set links are merged after we've done the flipping of related to self.

If you're interested, the changes I made are in ad1d591

@haddowg
Copy link
Contributor Author
haddowg commented Jun 26, 2024

Thanks for this, the PR helped. I did make some minor changes to ensure that any custom set links are merged after we've done the flipping of related to self.

If you're interested, the changes I made are in ad1d591

Makes sense to me, glad it helped.

@haddowg haddowg deleted the fix/related-response-links branch June 26, 2024 19:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants
0