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

Prevent a resource being included in both the data and included sections #147

Merged
merged 3 commits into from
Apr 24, 2017

Conversation

laurence79
Copy link
Contributor

This addresses a problem I came across when Saule is serialising an array of resources. If any of the resources in the array have relationships with each other, then it will also add the related resources to the included section.

The JSON:API spec asks that resources in compound documents should be unique across the data and included sections. http://jsonapi.org/format/#document-compound-documents

This PR trims resources from the included section where they are present in the data section once resource serialisation is complete.

@joukevandermaas
Copy link
Owner

Awesome, thanks so much for this!

@joukevandermaas joukevandermaas merged commit 02ed12a into joukevandermaas:master Apr 24, 2017
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.

2 participants