Skip to content
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

New toJSON method to return JSON according to the JSONAPI standard #2544

Closed
ErisDS opened this issue Apr 2, 2014 · 1 comment
Closed

New toJSON method to return JSON according to the JSONAPI standard #2544

ErisDS opened this issue Apr 2, 2014 · 1 comment
Assignees
Labels
affects:api Affects the Ghost API

Comments

@ErisDS
Copy link
Member

ErisDS commented Apr 2, 2014

As defined in the following issues, we want to reformat the JSON response from our API to match the standard laid out by JSONAPI (with the exception of keeping objects inline).

The JSON response provided by our API is currently a slightly modified version of the JSON format provided by bookshelf when calling its toJSON method.

Once we have duplicated the old api so that the admin UI remains stable on master (#2543), we can then create a new version of the toJSON method i.e. the toJSONAPIJSON method, that will be used by the new API to provide JSON objects in the JSONAPI format.

This will mean placing relations into link objects instead of inlining them as the existing API does. It will also mean moving additional properties such as pagination data into meta objects.

This issue covers the creation of a new base method for producing JSON from bookshelf objects and the associated unit tests. It doesn't cover ensuring that it gets used in the right places (which would require functional/integration tests). That will be done in other issues (will add links once they are created).

@ErisDS ErisDS added this to the 0.5 milestone Apr 2, 2014
@ErisDS ErisDS added the api label Apr 2, 2014
@ErisDS
Copy link
Member Author

ErisDS commented Apr 8, 2014

When we decide to implement an option which switches the API into linked object / strict JSON API mode, we will need to do this (provide a different version of toJSON).

In the meantime, we need to make much less hardcore changes, and I don't think we need to tweak toJSON anymore. I think we can make much smaller incremental changes to individual bits of the API, as described here: #2346 (comment)

@ErisDS ErisDS closed this as completed Apr 8, 2014
@ErisDS ErisDS modified the milestone: 0.6 Apps Sep 2, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affects:api Affects the Ghost API
Projects
None yet
Development

No branches or pull requests

2 participants