Skip to content

GitHub’s GraphQL Schema with validation. Automatically updated.

License

Notifications You must be signed in to change notification settings

octokit/graphql-schema

Folders and files

NameName
Last commit message
Last commit date
Apr 23, 2025
Mar 4, 2024
Mar 4, 2024
Mar 4, 2024
Mar 25, 2019
Dec 10, 2020
Feb 25, 2024
Mar 20, 2025
Dec 26, 2024
Jun 25, 2022
Apr 5, 2024
Mar 4, 2024
Apr 23, 2025
Dec 27, 2024
Feb 27, 2025
Feb 27, 2025
Feb 27, 2025

Repository files navigation

graphql-schema

GitHub’s GraphQL Schema with validation. Automatically updated.

Test

Usage

Validation

import { validate } from "@octokit/graphql-schema";
const errors = validate(`
{
  viewer {
    login
  }
}
`);

// errors is array. Contains errors if any

You can also load the current Schema directly as JSON or IDL.

import { schema } from "@octokit/graphql-schema";
schema.json; // JSON version
schema.idl; // IDL version

Schema as Types

import { graphql } from "@octokit/graphql";
import { Repository } from "@octokit/graphql-schema";

const { repository } = await graphql<{ repository: Repository }>(
  `
    {
      repository(owner: "octokit", name: "graphql.js") {
        issues(last: 3) {
          edges {
            node {
              title
            }
          }
        }
      }
    }
  `,
  {
    headers: {
      authorization: `token secret123`,
    },
  },
);

Local setup

git clone https://github.com/octokit/graphql-schema.git
cd graphql-schema
npm install
npm test

Update schema files (GITHUB_TOKEN requires no scope)

GITHUB_TOKEN=... npm run update

See also

LICENSE

MIT