Closed
Bug 1243217
Opened 9 years ago
Closed 8 years ago
Return 409 Conflict when type and id do not match URL in v2 API
Categories
(developer.mozilla.org Graveyard :: BrowserCompat, defect)
Tracking
(Not tracked)
RESOLVED
WONTFIX
People
(Reporter: jwhitlock, Unassigned)
References
Details
(Whiteboard: [specification][type:bug][bc:infra][bc:milestone=spaceship]:)
What did you do?
================
PATCH /browsers/9 with a type or ID mismatch, such as:
{
"data": {
"type": "versions",
"id": "6",
"attributes": {
"name": {
"en": "Internet Explorer, Desktop"
}
}
}
}
What happened?
==============
The name field of browser 9 is updated
What should have happened?
==========================
A 409 Conflict should be returned, with an error like:
{
"errors": [
{
"status": "409",
"detail": "id \"6\" does not match expected id \"9\"",
"source": {
"pointer": "/data/id"
}
}, {
"status": "409",
"detail": "type \"versions\" does not match expected type \"browsers\"",
"source": {
"pointer": "/data/type"
}
}
]
}
Is there anything else we should know?
======================================
The 409 response is mandated by the JSON API v1.0 spec:
http://jsonapi.org/format/1.0/#crud-updating-responses-409
"A server MUST return 409 Conflict when processing a PATCH request in which the resource object's type and id do not match the server's endpoint."
"A server SHOULD include error details and provide enough information to recognize the source of the conflict."
Reporter | ||
Updated•9 years ago
|
Blocks: 996570
Mentor: jwhitlock
Whiteboard: [specification][type:bug] → [specification][type:bug][bc:infra][bc:milestone=spaceship]:
Comment 1•9 years ago
|
||
Commits pushed to master at https://github.com/mdn/browsercompat
https://github.com/mdn/browsercompat/commit/077feb88c12a0081445f6c508ec734018233d5c9
bug 1243217 - Require type member in parser
According to the JSON API v1.0 spec, "The type member is required in
every resource object throughout requests and responses" [1]. This
commit makes it a parse error to omit it. The desired error is a 409
Conflict [2], and the error format is wrong, but those are covered by
other bugs [3][4] and saved for the future.
[1] http://jsonapi.org/format/1.0/#crud
[2] http://jsonapi.org/format/1.0/#crud-creating-responses-409
[3] https://bugzilla.mozilla.org/show_bug.cgi?id=1243217
[4] https://bugzilla.mozilla.org/show_bug.cgi?id=1242649
https://github.com/mdn/browsercompat/commit/cafc92e591624efe55b5302653e7139a662db75b
Merge pull request #93 from mdn/require_type_step_1_1243217
bug 1243217 - Require type member in parser
Reporter | ||
Updated•9 years ago
|
Mentor: jwhitlock
Reporter | ||
Comment 2•8 years ago
|
||
The BrowserCompat project is canceled. See https://github.com/mdn/browsercompat for current effort. Bulk status change includes the random word TEMPOTHRONE.
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → WONTFIX
Updated•5 years ago
|
Product: developer.mozilla.org → developer.mozilla.org Graveyard
You need to log in
before you can comment on or make changes to this bug.
Description
•