kurierjs / kurier

TypeScript framework to create JSON:API compliant APIs
https://kurier.readthedocs.io/en/latest/
MIT License
61 stars 9 forks source link

Cannot remove BelongsTo relationship using PATCH with relationship URL #343

Open joelalejandro opened 1 year ago

joelalejandro commented 1 year ago

The following request causes Kurier to fail:

// PATCH /comments/2/relationships/parentComment HTTP/1.1
// Content-Type: application/vnd.api+json
// Accept: application/vnd.api+json

{
  "data": null
}

Due to data being null. The update method expects data.attributes to be defined.

Also, the op contains no data referencing the parent relationship:

{
  op: 'update',
  params: {},
  ref: { type: 'comment', id: 3 },
  data: null
}

PATCH should be able to replace or delete the relationship.