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
Settings API: move to primary document format #2606
Comments
Question from over at #2061
|
Sorry for the confusion here, but I think these questions are very specifically about #2061. This issue should change the format, not what the API does. |
One thing worth noting - I guess if the request is for a type, the type ought to be returned as E.g. Although I want to change the name of aspect...
|
I worked through this yesterday and am just finishing up getting the tests to run now. The admin/settings pages look like they are working and all responses are now in the |
👍 |
Closes TryGhost#2606 - Refactor settings api responses to { settings: [ ] } format - Update all code using api.settings to handle new response format - Update test stubs to return new format - Update client site settings model to parse new format into one object of key/value pairs - Refactor to include all setting values - Remove unused settingsCollection method - Update settingsCache to store all attributes - Update settingsResult to send all attributes - Remove unnecessary when() wraps - Reject if editing a setting that doesn't exist - Reject earlier if setting key is empty - Update tests with new error messages - Use setting.add instead of edit that was incorrectly adding - Update importer to properly import activePlugins and installedPlugins - Update expected setting result fields - Fix a weird situation where hasOwnProperty didn't exist 🤷
refs TryGhost#2606 - Use new API format when updating settings from the client side - Add additional test to test new API format - Adjust functional tests to work with the new format
This issue is a result of the API format discussion in #2362, and is part of a larger project to move our API towards the JSON-API format which is documented in the Epic: #2124. This is one step in the journey towards achieving the Settings JSON object format laid out in #2350.
The equivalent task for Posts (#2580) has been done with the PR #2596, however the task for settings is SIGNIFICANTLY different.
At present, the settings API responses are completely different to all of our other APIs. The response when requesting a single setting looks like:
And when requesting a collection, you get a response like:
The aim of this task is to make these responses consistent with all of our other JSON-API-esque responses. That is, return the full object (with anything sensitive omitted), with a plural-form named key:
In terms of the API itself, this is going to involve ripping out a LOT of code, but the settings API is the most heavily used, and so will require a lot of work updating the various places where it is called.
The settings API is also the only are which has an in-memory cache, which should also be transformed to work with the new format.
The request format should also be changed, meaning the client side models and code for saving settings will need adjusting.
The weird hacks for adding
availableThemes
andavailableApps
can remain for the time being, until the work on the individualApps
andThemes
APIs are completed.Finally, all the tests should be updated, and coverage should be added where it is missing.
It would also be appreciated if you would add docs to this (#2125) as you go. Thanks 👍
The text was updated successfully, but these errors were encountered: