-
Notifications
You must be signed in to change notification settings - Fork 92
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
Proposal for discussion - remove GraphQL CMS endpoints in CMS 6 #1805
Comments
So to be clear - is the idea to deprecate the use of GraphQL for powering the CMS? GraphQL has been in place for 8 years. If it's still causing issues, it seems reasonable to declare the use of GraphQL for driving the CMS a failed experiment, although I note that's a big call. If module maintainers have made use of GraphQL, would the GraphQL endpoints be available in a module? Do we have any sense of how many modules would fall into that category> |
Yes, deprecate the use of GraphQL for powering the CMS in CMS 5 though keep using it, and remove it entirely in CMS 6 where the endpoints are switched over to use regular Silverstripe controllers.
I'm not really sure. If they've defined their own schema entirely independently from admin schema, then, to the best of my knowledge it should work fine, just as a project defining its own frontend schema should still work fine. However if there's any sort of reliance on the PHP code in asset-admin, elemental, cms, or any of the JS code in admin, then it won't work at all. Take what I say with a grain of salt though I'm not an expert on the inner workings of Silvestripes implementation of graphql. No one actively working on the code-base is anymore, that's part of the problem.
I don't have any data on that sorry, and I don't know how I would obtain it. My assumption is that it's very low, though that's just my assumption. In terms of "upgrade pain", I don't think would be that bad. I do think that any CMS modules that are using graphql could be ported over to use regular Silverstripe controllers with admin authentication in a pretty short amount of time. |
There are still people that have the upgrade from 3 to 4 in memory and basically I would like to prevent similar headaches. |
Thanks for the data @emteknetnz. It's possible it might be a non-issue and devs may even welcome the change. It might seem that I'm against progress and moving forward, but it's probably more about just making sure we minimise surprises and communicate such substantial changes earlier and in a better way - and I do appreciate I may not have such better way up my sleeve and I believe the intentions are good. |
@forsdahl any comments from Europe? |
@michalkleiner I can't speak for everyone in Europe, but we at Creamarketing have done a lot of admin customizations over the years, but we have yet to do any custom GraphQL endpoints. All our own admin modules and customizations use normal Silverstripe endpoints. The only thing we have slightly customized regarding GraphQL is some logic in the In fact we have some plans on doing a Sveltekit based headless admin for Silverstripe, and for that project having normal Silverstripe endpoints for everything in admin would be easier than having a mix of JSON endpoints and GraphQL endpoints. |
I admit, I never understood the drive to use GraphQL to power the CMS in the first place. It is a useful tool in some cases... but many cases in the CMS are not that case, as evidenced by the low pickup (although partially probably also due to quite a learning curve). Still, I'm not sure I'd call it a failed experiement. Though neither should that prevent the team from moving on.
Anyone who bought into GraphQL has already been bitten in the GQL major update... ironically also from 3 to 4. If there's anyone left, I don't think they'd much appreciate being 100% disjointed again. Although I guess this would only apply to admin extensions this time.
The canonical source of truth for composer based packages is packagist.com, which names 32 dependencies (including core & supported modules). https://packagist.org/packages/silverstripe/graphql/dependents?order_by=downloads This of course will list neither private modules nor projects. I have no love for GraphQL; while I find the concept easy enough to grasp, I find the Silverstripe implementation of it (particularly since v4) extremely obtuse, overly complex, and 100% obfuscatory. I couldn't even follow the execution path to a very simple ultimately 1 line fix. silverstripe/silverstripe-versioned-admin#255 (comment) At the same time I feel like this is a bit of a step backward. More particularly the all or nothing approach. Rebuilding asset admin feels like a grand expensive effort in more of a witch hunt than a focus on progress. While I feel it fine to revert the CMS to "normal" endpoints (RESTful or whatever), I think the task should be done over time rather than in the short ~half-year until the CMS 6 is due, per the major release schedule expectations. It is possible - as current - to have both "endpoint options" at once.
Other than the obvious "Silverstripe Ltd. has no expertise with GQL anymore" it appears as there's no real driving reason for this change. |
"None of the maintainers have GraphQL expertise" is probably a more useful framing than "Silverstripe Ltd. has no expertise with GQL anymore". |
Any other comments, @silverstripe/core-team? I personally don't think we will get anywhere conclusive here and the work is progressing towards the removal of GraphQL for CMS 6 regardless. Other than the learning of "let's do an RFC before we do the work next time" there's probably not much to talk about. |
No real comments on removing it from the CMS, other than echo-ing the need for an RFC. I appreciate that if there’s no expertise in the open-source team available to work on it then it seems like an open and shut case, and pushback against it would be pretty frustrating, but if we’re trying to foster more community involvement then decisions like this (even if they risk being unpopular) need to be made in the open, and not semi-retrospectively. I’ve not done any CMS customisations I can recall that touch GraphQL, only React. I think to have seen the real benefits of GraphQL in the CMS, we would’ve needed to go all-in with React. That’s never happened, I doubt it ever will at this point. One question I have though: is this a step toward dropping Ltd’s support for the graphql module entirely? Does Ltd use GraphQL in their own builds? I think losing official support would be a pretty big blow to Silverstripe’s offering as a framework, so that’s my main concern off the back of this |
There are no current plans to do that. Though sentiments about the module vary from person to person 😅 |
IMHO anything that makes the CMS easier to maintain right now is a good choice for the longevity of the wider ecosystem. There was ample time for a) the community to pick up the "GraphQL in CMS" use case, and b) step up as maintainers to make a more complex (powerful?) CMS viable. My worry would be that this ends up as a tactical "half measure" that the CMS has been beset by over the years, where there's not enough capacity to follow through on a coherent alternative model in one upgrade cycle (presumably at least including some customizeable RESTful endpoints for frontend-heavy UIs like AssetAdmin or Elemental). The key will be community involvement to get transparency of current customisations (which is where most of the upgrade pain will be). A bit of 20/20 hindsight: The decision for a more frontend-heavy and API powered CMS was made at a time when we had vastly more resources as CMS maintainers, and was meant to be a "two birds with one stone" architecture - since we also needed better first party structured data support outside of the CMS. And I learned the hard way that some features aren't easily portable between languages/runtimes: The canonical GraphQL implementation is in Node because it it's very efficient to load all the data structures into memory on boot across requests. With PHP's "shared nothing" request processing, we needed to ensure this step is fast for each request. Which lead to caching, which lead to complexity... |
Currently, there are two distinct systems for serving JSON in the Silverstripe CMS: the "regular" Silverstripe controller endpoints defined in
private static $url_handlers
and the GraphQL endpoints. Having two different standards creates additional overhead for everyone involved.Current Situation
The Silverstripe CMS uses both regular controller endpoints and GraphQL endpoints. This has leads to unnecessary development complexity and time wasted on higher maintenance efforts than otherwise would be the case if there was better standardisation. For the community, the perception that GraphQL should be used has imposed barrier on community contributions.
Proposal
We propose to entirely remove GraphQL endpoints for Silverstripe CMS 6 and replace their functionality with regular controller endpoints.
This change applies only to CMS endpoints, such as those used by elemental and asset-admin. This does not affect the status of the silverstripe/graphql module as a supported module which some projects use to create public facing JSON APIs.
Rationale
Benefits of Standardising on Regular Silverstripe Controllers:
Why not standardise on GraphQL Instead?
Considerations
Note on prior work done
Some work to remove GraphQL from the CMS has already progressed quite far. Comments where raised on that issue expressing that there should have been a public discussion before embarking on this work. Within the internal product team at Silverstripe there is agreement that we should look to better standardise the API layer in the CMS. However, in retrospect a public discussion should have come first to get feedback from others. Apologies for doing this out of order.
Appendix One: Endpoint counts
A simple script was created to count the number of
$url_handler
endpoints compared to GraphQL queries and mutations across supported modules. The script was run on an install of silverstripe/recipe-kitchen-sink. Note that the cms graphql queries/mutations are used in silverstripe/versioned-admin. The results are as follows:@silverstripe/core-team
The text was updated successfully, but these errors were encountered: