feature(backend-gitlab): add GraphQL support
Is your feature request related to a problem? Please describe.
Related to https://github.com/netlify/netlify-cms/issues/5920.
Using the GitLab REST API can lead to performance issues and hitting rate limits. Switching to GraphQL could help (we'll need to verify this).
Describe the solution you'd like
Similar to the GitHub backend, having use_graphql: true support for the GitLab backend
Describe alternatives you've considered Keeping things as they are
Additional context https://docs.gitlab.com/ee/api/graphql/
@erezrokah I want to work on this issue. Please assign :)
Thanks @imskr, my suggestion is to start from the method in this comment https://github.com/netlify/netlify-cms/issues/5920#issuecomment-988896160
Thanks @erezrokah so i have to create a new file GraphQLAPI.ts for this and add support for function https://github.com/netlify/netlify-cms/issues/5920#issuecomment-988896160 right?
Hi @imskr, I would even say start with the function in the comment and edit the current file, to see if it works first. Once we can see the performance improvement we can think about separating the REST/GraphQL logic.
Okay so I have to change https://github.com/netlify/netlify-cms/blob/0053ebbb46f189469c86518eb458daa34a8fec4d/packages/netlify-cms-backend-gitlab/src/implementation.ts#L199 to make use of entriesByFiles https://github.com/netlify/netlify-cms/blob/0053ebbb46f189469c86518eb458daa34a8fec4d/packages/netlify-cms-backend-gitlab/src/implementation.ts#L219 instead of allEntriesByFolder right? @erezrokah
@erezrokah can you give me a pointer on starting this?
Hi @imskr, sorry for the delay to respond. I've started looking into this myself (digging into the GraphQL API) to get some clarity on what needs to be done.
I can update here once I make some progress.
No worries @erezrokah let me know once you have something :)
Hello 👋 Posted and update in https://github.com/netlify/netlify-cms/issues/5920#issuecomment-996941185
Great @erezrokah I just checked it. I was looking for some good first issue if you can point me out that would be great 🙂 and also I can help on this on too though I'm new to the repo.
Hi @imskr, I think https://github.com/netlify/netlify-cms/issues/6061 could be a good first issue that's entry level (this issue is more intermediate). I added a comment on that issue to get people started
I checked the current state because this issue still describes the original GraphQL rollout. #6059 shipped use_graphql: true in [email protected], and current main still uses it for folder collection listing plus batched blob and commit reads. Other GitLab backend operations remain on REST.
That appears to cover the performance case from #5920, but not a broader goal of moving the entire backend to GraphQL. Would you prefer to close this as delivered and track concrete missing operations separately, or re-scope this issue with the remaining operations? I can inventory the REST paths if that would help.
@JackSpiece, this issue has a long (irrelevant?) history, so I'm closing it. It would be great if you opened a new one with the list of api paths that need to be ported to GraphQL.
@martinjagodic I opened #7975 with the remaining REST endpoints and their callers. Paginated collection browsing still uses REST even with use_graphql: true, so I suggested starting there, then handling the editorial workflow separately. The inventory links to the source commit I checked.