-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
json-api conformity #983
Comments
cc @tchak |
@heartsentwined ember-data will at some point support the spec. But the spec for now is not stable. I expect it to change quite a bit for a while. The first step would be probably to implement json-api on the |
I'm also very interested in this topic. My team and I have begun the process of migrating/modernizing a fairly large existing web app to Ember/EmberData, and have found the early JSONAPI spec to be a great starting point and guide for standardizing our growing collection of services. I was pretty surprised to find that EmberData didn't yet support the full JSONAPI spec - particularly because the part of the app that we're building now needs at least read access to the 'links' component..but I'm no stranger to the bleeding edge beast... To bridge the gap, so that we could implement the JSONAPI spec in our services now, and still use the RESTAdaptor, we've implemented a simple custom transform, something like this:
App.Widget = DS.Model.extend({
id: DS.attr('number'),
name: DS.attr('string'),
links: DS.attr('links')
});
App.Adapter.registerTransform('links', {
serialize: function(value) {
return [ value.get('foo'), value.get('bar'), value.get('baz') ];
},
deserialize: function(value) {
return Ember.create({ foo: value['foo'], bar: value['bar'], baz: value['baz'] });
}
});
This lets us spit out JSON from the backend according to the current spec, and access 'links' naturally in our Ember app, and works fine for our current limited needs...but that won't last for long...so any information/inspiration that can get stirred up here would be great. Not sure if I'm ready to bite off building a something usable by the community, but I'd like to participate in any way that I can to help advance the effort. |
I talked to @wycats about this recently and the plan is to fully support the JSONAPI spec. If you want to discuss further, the forums are a good place for this. |
I would like to start a discussion on the level of conformity that we can expect from
ember-data
, to the json-api specs.I was first directed from #962 and #379 to json-api/json-api#18, where @tomdale seems to indicate that
ember
/ember-data
would followjson-api
.The latest revision (rev. 12 at the time of writing) here in BREAKING_CHANGES.MD, however, indicates that
ember-data
had made an effort to standardize its api calls (on singular and pluralid
s), but instead of conforming with thejson-api
-suggested style oflinks
andurl
s, it introduced*_id
and_ids
suffixes for models.ember-data
itself does not have any docs on its expected api, but over at the official ember docs, it was documented as the above-mentioned*_id(s)
-suffix style also. In addition, theGET /resources?ids[]=1&ids[]=2
was also documented; while json-api documents aGET /resources?ids=1,2
request.The entire
links
implementation from json-api was also absent.Finally, from the json-api FAQ, it was also mentioned that
ember
is an exemplar conformer to the specs - while this is not so.So I would like to start a discussion here, in hope of reaching a common agreement of what API spec
ember-data
would adopt, and hopefully explicitly documenting it - unless we decide to fully adopt json-api, that is.The text was updated successfully, but these errors were encountered: