Download Gitlab’s graphql schema

Download Gitlab’s graphql schema


2

I’m trying to get hold of gitlab_schema.graphql, i.e. the schema for Gitlab’s graphql API. Can’t find it anywhere, does anyone have any pointers?

5 Answers
5


2

I found the schema is an artifact in the Gitlab CI pipe (graphql-schema-dump job), for example here: https://gitlab.com/gitlab-org/gitlab/-/jobs/1602029144.

Not perfect, but works.


1

You can use apollo CLI for this: apollo client:download-schema --endpoint=https://gitlab.yourcompany.com/api/graphql schema.graphql or just omit filename and it will download to JSON


0

It doesn’t look like GitLab shares the schema directly, just this Reference Documentation generated from the schema, and the GraphiQL Explorer / IDE (more info about GraphiQL Explorer here).

2

  • Yeah, which is really weird.. was hoping to use a rust lib (crates.io/crates/graphql_client) to avoid manually hacking the queries, but maybe I'll end up doing just that.

    – Fredrik Jansson

    Sep 16, 2021 at 19:25

  • Agreed. I didn't find any issues about it when searching, but they're pretty good about responding there if you want to open one.

    – Adam Marshall

    Sep 16, 2021 at 19:27


0

Here’s alternative, if you are working with Rust lang. For Rust developers, you need to install the crate named graphql_client_cli via cargo. Example: cargo install graphql_client_cli.

Next, you can run the graphql client you just downloaded, to get the schema (either in JSON or GraphQL format). Example: graphql-client --authorization 'Bearer <bearer token>' https://<your gitlab url site>/api/graphql.

See the GraphQL Client CLI for more options.


0

I found a direct download here



Leave a Reply

Your email address will not be published. Required fields are marked *