-
Notifications
You must be signed in to change notification settings - Fork 81
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
Clearing a resource relationship #223
Comments
Hi @jasminb - appreciate you're likely very busy at the moment; I would really appreciate any historical/contextual insight into the above before I begin debugging the code to figure out a path forward for us. Many thanks for your efforts on this library - it's very valuable. Ben |
Hello @bensullivan, internally same logic that is used to parse primary data is used to parse relationship data and thats why the same rules apply. This should be something that can be fixed/made configurable. Edit: Please disregard this comment, I did not read your question properly. |
Just tested parsing following payload (on both {
"data": {
"type": "engineer",
"id": "id",
"relationships": {
"field": {
"data": null
},
"city": {
"data": null
}
}
}
}
And it correctly produces the desired type with its id set and other values set to |
Hi
We have a requirement to be able to clear (make null) an existing relationship on a resource. As far as I'm aware the JSON:API spec supports this (where prior to this example PATCH request, the
author
relationship was"data": { "type": "people", "id": "1" }
):When I come to deserialise a request like this I am getting a
InvalidJsonApiResourceException: Resource must contain at least one of 'data', 'error' or 'meta' nodes.
Assuming my interpretation of the JSON:API spec for this scenario isn't wrong, is there a way to clear resource relationships with jsonapi-converter?
Thanks for your help!
Ben
The text was updated successfully, but these errors were encountered: