kurko / ember-json-api

JSON API adapter for Ember Data.
MIT License
254 stars 62 forks source link

Updating to the RC2 standard of JSON API #68

Closed eneuhauser closed 9 years ago

eneuhauser commented 9 years ago

Per issue #67, I'm updating to the RC2 standard of the API. I originally attempted to make it backwards compatible, but the new format was different enough that it made it too difficult. The new format is actually more efficient and there isn't really a use case to support both formats. If someone needs the RC1 format, they can pull down a tag to that version.

Your test cases are awesome and it was a joy to test my changes against them. I only updated the tests to match the new format.

Now that I have updated to RC2, I will begin using this library in my project. If I encounter any issues, I will make new tests and submit another pull request.

gr0uch commented 9 years ago

Wow, thanks for this. Looks like the tests failed on Travis, can you confirm that they pass locally, or make them pass on Travis?

eneuhauser commented 9 years ago

Sorry about that. I only ran the browser tests. @backspace helped identify I was using the wrong version of Ember-Data. Also, I was using function.bind which worked in the browser, but apparently not in Node.

eneuhauser commented 9 years ago

I am currently developing a site that is using the RC2 standard of JSON API. I have added a few new tests based on issues I ran across, but my updates are actually working quite nicely. One lesson learned is to be diligent about returning appropriate links to associations from the server.

I hope you will accept my pull request. Since this appears to be the reference implementation for clients adopting JSON API, I would like to see it keep up with the standard. Also, there are more features that could be included in this library and hope we can work together to implement them. In particular, I think this library may need to extend DS.Store to enable some additional features, particularly around side loading. DS.Store has a findQuery in which you could add 'include' parameters, but this does not work in a situation like post.get('comments') where you would want to sideload the authors (if comment belongsTo an author).

Another thing that needs to be planned out better is differences in links between self and resource. I've put in some cursory work, but this could be better utilized based on the association be requested.

green-arrow commented 9 years ago

:+1: on this

My only suggestion would be to call out the fact that this is RC2 compliant, and to use with an RC1 compliant API you should specify ember-json-api@0.3.0 when installing. Maybe make this a bold note in the README.

fotinakis commented 9 years ago

+1 for this!

eneuhauser commented 9 years ago

Since RC3 has been merged and JSON API 1.0 is now finalized, there is no reason to support RC2. Closing this and focusing on 1.0.