jsonapi: support top-level error documents

Couldn’t find anything in the code that did this, sorry if I’m misreading stuff. I think the specs are describing something like:

{
    errors: [
        ...
    ]
}

??

About this issue

  • Original URL
  • State: open
  • Created 9 years ago
  • Reactions: 2
  • Comments: 32 (13 by maintainers)

Commits related to this issue

Most upvoted comments

Looks like @thedodd is close. See above.

You are correct, @genexp. According to the spec, errors must always be an array of error objects:

A document MUST contain at least one of the following top-level members:

  • data: the document’s “primary data”
  • errors: an array of error objects
  • meta: a meta object that contains non-standard meta-information.

The members data and errors MUST NOT coexist in the same document.

I would say that, at a minimum, we should include the title field in the error, as well as the detail field. The spec describes pretty well what the difference between these two fields should be.

@chr0n1x working on links, meta, and errors atm