Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Shouldn't POST and PUT send a pluralized array with a single member? #1129

Closed
Kerrick opened this Issue Aug 26, 2013 · 6 comments

Comments

Projects
None yet
7 participants
Contributor

Kerrick commented Aug 26, 2013

According to JSONAPI.org, in the Singular Resources section, a singular resource should still be wrapped in an array to simplify processing. The example given in the Creating a Document section:

POST /photos
Content-Type: application/json
Accept: application/json
{
  "photos": [{
    "title": "Ember Hamster",
    "src": "http://example.com/images/productivity.png"
  }]
}

Last I checked, Ember Data sends POST and PUT requests as an object, not an array. Is this an intended deviation from the JSONAPI.org standard, or am I misunderstanding something?

hpathan commented Aug 28, 2013

@Kerrick today i happened to work on bulk commit, and found that Ember Data does wrap data in an array. I am on little old version, but found it on latest version too. What version or commit revision are you on?

hpathan commented Aug 29, 2013

@Kerrick It only happens for bulkCommit. I think, because bulkCommit needs to send one requests wrapping data in an array, singular resource without bulkCommit was sent as an object. I think following JSONAPI contracts make sense.

Member

tchak commented Sep 1, 2013

@Kerrick in it's current version Ember Data do not claim to support jsonapi as far as I know.

Owner

wycats commented Sep 1, 2013

I just created a JSONAPI milestone and tag that we can use to move towards a JSONAPI-compliant adapter that we ship with Ember Data.

Contributor

knownasilya commented Jun 6, 2014

Will the RESTAdapter be going in this direction?

Contributor

kurko commented Oct 15, 2014

I believe this can be closed as it's a complaint about an adapter (which ED doesn't have).

By the way, if you want to use JSONAPI, try https://github.com/kurko/ember-json-api :)

@igorT igorT closed this Nov 12, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment