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

It is impossible to clear the relations by sending PATCH request to relationship link. #41

Closed
gast opened this issue Dec 24, 2017 · 2 comments
Assignees
Labels
Milestone

Comments

@gast
Copy link

gast commented Dec 24, 2017

Hi!

If I send a null or an empty array as a data member like:

PATCH /articles/1/relationships/author HTTP/1.1
Content-Type: application/vnd.api+json
Accept: application/vnd.api+json

{
	"data": null // or []
}
  1. JsonParser::parseRelationships() will not process an empty relationship data.
  2. Action::linkRelations(), for obvious reasons, will not clear the relationship.

Is this normal behavior? Because in the JSON API specification I read that:

The PATCH request MUST include a top-level member named data containing one of:

  • a resource identifier object corresponding to the new related resource.
  • null, to remove the relationship.

....

For all request types, the body MUST contain a data member whose value is an empty array or an array of resource identifier objects.

....

jsonapi.org

Thanks for this extension!

@tuyakhov
Copy link
Owner

tuyakhov commented Jan 2, 2018

Hi @gast!
Thank you for reporting this. It seems like a bug to me. I will investigate further and provide a solution soon.

@tuyakhov tuyakhov self-assigned this Jan 2, 2018
@tuyakhov tuyakhov added the bug label Jan 2, 2018
@tuyakhov tuyakhov added this to the v0.1.5 milestone Jan 2, 2018
@tuyakhov
Copy link
Owner

Resolved in #43

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants