10.198.0 • Published 1 year ago

github-graphql-schema v10.198.0

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

github-graphql-schema

GitHub’s GraphQL Schema with validation. Automatically updated.

Test

⚠️ This is a fork of octokit/graphql-schema with automatic update enabled and fixes integrated. Compare the fork with the origin to browse the differences.

Usage

Validation

const { validate } = require("github-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.

const { schema } = require("github-graphql-schema");
schema.json; // JSON version
schema.idl; // IDL version

Schema as Types

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

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

CLI

This package comes with a CLI that can be used to generate types based on GitHub's GraphQL schema.

Generate types for your operations (queries, mutations, subscriptions)

# don't forget the quotes when using a glob
github-graphql-schema operations -i './src/**/*.ts'

Local setup

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

Update schema files (GITHUB_TOKEN requires no scope)

GITHUB_TOKEN=... npm run update

See also

LICENSE

MIT

10.198.0

1 year ago

10.193.0

2 years ago

10.194.0

2 years ago

10.190.0

2 years ago

10.195.0

2 years ago

10.191.0

2 years ago

10.196.0

2 years ago

10.192.0

2 years ago

10.197.0

2 years ago

10.186.0

2 years ago

10.170.0

2 years ago

10.182.0

2 years ago

10.175.0

2 years ago

10.179.0

2 years ago

10.187.0

2 years ago

10.171.0

2 years ago

10.183.0

2 years ago

10.176.0

2 years ago

10.188.0

2 years ago

10.184.0

2 years ago

10.172.0

2 years ago

10.173.0

2 years ago

10.180.0

2 years ago

10.177.0

2 years ago

10.189.0

2 years ago

10.185.0

2 years ago

10.174.0

2 years ago

10.181.0

2 years ago

10.178.0

2 years ago

10.163.0

2 years ago

10.167.0

2 years ago

10.164.0

2 years ago

10.168.0

2 years ago

10.160.0

2 years ago

10.165.0

2 years ago

10.169.0

2 years ago

10.161.0

2 years ago

10.158.0

2 years ago

10.162.0

2 years ago

10.166.0

2 years ago

10.159.0

2 years ago

10.140.0

2 years ago

10.142.0

2 years ago

10.144.0

2 years ago

10.146.0

2 years ago

10.148.0

2 years ago

10.129.0

2 years ago

10.152.0

2 years ago

10.154.0

2 years ago

10.131.0

2 years ago

10.156.0

2 years ago

10.133.0

2 years ago

10.135.0

2 years ago

10.137.0

2 years ago

10.139.0

2 years ago

10.150.0

2 years ago

10.141.0

2 years ago

10.143.0

2 years ago

10.145.0

2 years ago

10.147.0

2 years ago

10.149.0

2 years ago

10.130.0

2 years ago

10.151.0

2 years ago

10.132.0

2 years ago

10.153.0

2 years ago

10.155.0

2 years ago

10.134.0

2 years ago

10.157.0

2 years ago

10.136.0

2 years ago

10.138.0

2 years ago

10.121.0

2 years ago

10.125.0

2 years ago

10.123.0

2 years ago

10.127.0

2 years ago

10.114.0

2 years ago

10.112.0

2 years ago

10.118.0

2 years ago

10.116.0

2 years ago

10.120.0

2 years ago

10.124.0

2 years ago

10.122.0

2 years ago

10.128.0

2 years ago

10.126.0

2 years ago

10.113.0

2 years ago

10.111.0

2 years ago

10.117.0

2 years ago

10.115.0

2 years ago

10.119.0

2 years ago

10.107.0

2 years ago

10.109.0

2 years ago

10.108.0

2 years ago

10.110.0

2 years ago

10.106.0

2 years ago

10.105.0

2 years ago

10.104.0

2 years ago

10.103.0

2 years ago

10.102.0

2 years ago

10.101.0

2 years ago

10.100.0

2 years ago

10.99.0

2 years ago

10.98.0

2 years ago

10.97.0

2 years ago

10.96.0

2 years ago

10.95.0

2 years ago

10.94.0

2 years ago

10.93.0

2 years ago

10.92.0

2 years ago

10.91.0

2 years ago

10.90.0

2 years ago

10.89.0

2 years ago

10.88.0

2 years ago

10.87.0

2 years ago

10.86.0

2 years ago

10.85.0

2 years ago

10.84.0

2 years ago

10.83.0

2 years ago

10.82.0

2 years ago

10.81.0

2 years ago

10.80.0

2 years ago

10.79.0

2 years ago

10.78.0

2 years ago

10.77.0

2 years ago

10.76.1

2 years ago

10.76.0

2 years ago

10.75.0

2 years ago

10.74.0

2 years ago

10.73.1

2 years ago