graphql-schema
GitHub’s GraphQL Schema with validation. Automatically updated.
Usage
Validation
const { validate } = require("@octokit/graphql-schema");
const errors = validate(`
{
viewer {
login
}
}
`);
You can also load the current Schema directly as JSON or IDL.
const { schema } = require("@octokit/graphql-schema");
schema.json;
schema.idl;
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