Tool to collect data about the processing of GraphQL queries on the GitHub API

Usage no npm install needed!

<script type="module">
  import githubGraphqlDataCollection from '';


GitHub GraphQL Query Generator

Generates random GraphQL queries for the GitHub GraphQL API.


Clone the example library.

Install the dependencies.

npm ci

The query generator dynamically creates providers by querying the GitHub API for data. In order to do so, you must provide your GitHub credentials.

Create a file named .env with your GitHub personal access token.

GITHUB_ACCESS_TOKEN={your access token}

Use the getGitHubQueryGenerator() factory method to create a GitHubQueryGenerator object, which can be used to generate queries.


const { getGitHubQueryGenerator } = require("./lib/index")
const { print } = require("graphql")

  (queryGenerator) => {
    const query = queryGenerator.generateRandomGitHubQuery()
    const { queryDocument, variableValues } = query

    console.log(JSON.stringify(variableValues, null, 2))

Generating a query corpus

We provided a script that can generate a corpus of 5,000 randomly generated GitHub queries and responses.

To create the corpus, please provide your GitHub access token in a .env file, as described in the previous section.

Then, run:

npm run generate-corpus

The corpus will be saved into the query-corpus/ folder.


Queries are associated with a particular version of a GraphQL schema. The generated GitHub queries are associated with this version of the GitHub schema.

Due to the natural evolution of the GitHub API, the generated queries may not work with the current version of the API. The generated queries may contain deprecated fields and the new API may require new arguments for certain fields. However, the generated queries are valid and would have worked with the version of the API at the time.