Skip to content

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

@gast

Description

@gast

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!

Metadata

Metadata

Assignees

Labels

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions