Closed Bug 1242649 Opened 8 years ago Closed 7 years ago

Error responses should use "source" attribute, JSON Pointers

Categories

(developer.mozilla.org Graveyard :: BrowserCompat, defect)

All
Other
defect
Not set
minor

Tracking

(Not tracked)

RESOLVED WONTFIX

People

(Reporter: jwhitlock, Unassigned)

References

Details

(Whiteboard: [bc:infra][bc:milestone=scooter])

What did you do?
================
1. POST to create a version with a blank version attribute

What happened?
==============
Got an error message:

{
    "errors": [
        {
            "status": "400",
            "detail": "This field may not be blank.",
            "path": "/data/attributes/version"
        }
    ]
}

What should have happened?
==========================
According to the JSON spec, the error should be more like:

{
    "errors": [
        {
            "status": "400",
            "detail": "This field may not be blank.",
            "source": {
                "pointer": "/data/attributes/version"
            }
        }
    ]
}

Is there anything else we should know?
======================================
Errors can be generated in the parser or the renderer.  The relevant section of the spec is at:

http://jsonapi.org/format/1.0/#error-objects

This format will be important when a front-end tool wants to parse a response and display errors to a user.
Blocks: 996570
Mentor: jwhitlock
Blocks: 1243225
No longer blocks: 996570
Whiteboard: [specification][type:bug] → [bc:infra]
Severity: normal → minor
Depends on: 1240757
Whiteboard: [bc:infra] → [bc:infra][bc:milestone=scooter]
Mentor: jwhitlock
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: 7 years ago
Resolution: --- → WONTFIX
Product: developer.mozilla.org → developer.mozilla.org Graveyard
You need to log in before you can comment on or make changes to this bug.