-
-
Notifications
You must be signed in to change notification settings - Fork 10.5k
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
API V2 content controller separation #10106
Comments
As model separation is introduced with #10124, there has surfaced a need to separate Would it make sense to divide v2 controllers to a structure similar to the one used in routes |
Yes makes sense to me 👍 |
refs #10124 - Author model returns only users that have published non-page posts - Added a public controller for tags (should be extracted to separate Content API controller #10106) - Made resource configuration dynamic based on current theme engine - This needs a follow-up PR with fixes to the problems described in the PR
refs #10438, refs #10106 * Renamed existing pages ctrl * Splitted posts & pages for Admin API v2 * Added pages JSON input schema for Admin API v2 * Removed single author for Content & Admin API v2 - single author is not documented - single author usage is deprecated in v0.1 - single author usage is removed in API v2 * Splitted posts & postsPublic controller for v2 * Removed requirement to send `status=all` from Admin API v2 * Removed `status` option from pages Content API v2 * Removed `status` options from Users Admin API v2
refs #10438, refs #10106 - see TryGhost/Admin@f8b03f5
State of this issueAPI v2 fully separated the Admin & Content controllers.
The rest of the controllers belong to the Admin API. This was a first good step into the right direction. Further or existing problems
OptionsOption 1We could create See a working prototype on Github. Adavantages:
Challenges:
Option 2Leave as is and improve what we have to get rid of the problems e.g. which controllers the theme helpers can access. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
refs #10124 - Author model returns only users that have published non-page posts - Added a public controller for tags (should be extracted to separate Content API controller TryGhost/Ghost#10106) - Made resource configuration dynamic based on current theme engine - This needs a follow-up PR with fixes to the problems described in the PR
refs #10124 - Author model returns only users that have published non-page posts - Added a public controller for tags (should be extracted to separate Content API controller TryGhost/Ghost#10106) - Made resource configuration dynamic based on current theme engine - This needs a follow-up PR with fixes to the problems described in the PR
I see some good reasons why we should separate the controllers for the content API.
You don't have a limited access if the controllers are generic. For example: the V2 content API allows the theme developer to fetch "authors"
{{#get "authors"}}
. Theget
helper requires the target API version (require(.../api/).v2
), but we require all of the controllers. That means we either need to disallow this behaviour in the helper level, so that you can't do{{#get "users"}}
, which is very hard to maintain or the API returns just a set of controllers you can use for the content API.Admin controllers allow more than content controllers. e.g. the users controller allows to fetch roles & permissions. In v0.1 there was one controller who just allowed all the includes (roles, permissions, couting posts) and the model layer had added this condition. to avoid that a public access can fetch roles. This is very hard to maintain and it's IMO not the correct approach. If we would separate the controllers, we could just allow that the content user controller can fetch
count.posts
, nothing more.We always need to take care that we do a correct differentiation between content and admin access e.g. in serializers.
Imagine you want to develop both API's separately. You can't. Because they both use the same controller base.
I can imagine if we separate both, we can optimise the API frame step by step to avoid having too many duplicate code.
apiType
and broken error handling #10536 (comment)The text was updated successfully, but these errors were encountered: