github-schema
TypeScript icon, indicating that this package has built-in type declarations

1.7.12 • Public • Published

📋 github-schema

npm version npm downloads

GitHub's GraphQL Schema

📦 Installation

npm install github-schema

📚 Usage

import { gql, gqlTyped } from 'github-schema'

// we are also exporting a ton of types from the graphql schema.

const REPOSITORY_QUERY = gql`
  query getRepository($owner: String!, $name: String!) {
    repository(owner: $owner, name: $name) {
      nameWithOwner
      description
      pushedAt
      url
      defaultBranchRef {
        name
      }
      languages(first: 1, orderBy: { field: SIZE, direction: DESC }) {
        nodes {
          name
          color
        }
      }
    }
  }
`

[!NOTE] If you want to use gql with return type of DocumentNode you can do something like this:

import { gqlTyped } from 'github-schema'

Editor Autocompletion

[!TIP] You will need to have GraphQL LSP installed, and have a .graphqlrc.yaml file in your project root. If you also want nice colors, i would recommend GraphQL Syntax Highlighting installed.

# .graphqlrc.yaml
schema: node_modules/github-schema/schema.graphql

📄 License

Published under MIT License.

Package Sidebar

Install

npm i github-schema

Weekly Downloads

24

Version

1.7.12

License

MIT

Unpacked Size

4.01 MB

Total Files

17

Last publish

Collaborators

  • luxass