Registry / devops / github-schema

github-schema

JSON →
library1.28.0jsnpmunverified

A TypeScript package that provides the complete GitHub GraphQL schema as a single, self-contained module. Version 1.28.0 ships the latest schema as of release, with automatic updates triggered by schema changes on GitHub's API. Differentiates from alternatives like @octokit/graphql-schema by being zero-dependency, fully typed, and focused solely on schema definitions without client logic. Ideal for code generation, IDE autocomplete, and type-safe GraphQL queries. Released on npm with a cadence tied to GitHub GraphQL schema updates.

npm install github-schema
INSTALL
IMPORT
SIG · GITHUB-SCHEMA
G
github-schema
devopsjavascriptv1.28.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

schema
import { schema } from 'github-schema'
const schema = require('github-schema')
Package is ESM-only; no CommonJS support.
Schema
import type { Schema } from 'github-schema'
import { Schema } from 'github-schema'
Schema is a TypeScript type, not a runtime value. Use 'import type' for type-only imports.
allSchemas
import { allSchemas } from 'github-schema/schemas'
import { allSchemas } from 'github-schema'
allSchemas is available from a subpath export; not part of the main module.

Import the GitHub GraphQL schema and use it with graphql utilities to inspect types.

import { schema } from 'github-schema'; import { printSchema } from 'graphql'; // schema is a GraphQLSchema object console.log(printSchema(schema)); // Example: query type fields const queryFields = schema.getQueryType()?.getFields(); if (queryFields) { Object.keys(queryFields).forEach(field => console.log(field)); }
Debug
Known issues
breakingVersion 1.0.0 dropped CommonJS support; require() will fail.
fix
Use ESM imports (import { schema } from 'github-schema') and ensure Node.js >=20.
affects: >=1.0.0
gotchaSchema is regenerated only on package release; may lag behind live GitHub schema.
fix
Check release date and compare with GitHub changelog if you need the latest schema.
affects: >=0.0.0
gotchaSubpath exports (e.g., 'github-schema/schemas') require modern Node.js module resolution; may not work with older bundlers.
fix
Use a bundler that supports package.json exports field, like webpack 5 or esbuild.
affects: >=0.0.0
deprecatedThe 'github-schema/schemas' export path is deprecated; use 'github-schema/schema' instead.
fix
import { schema } from 'github-schema' (main export already includes the latest schema).
affects: >=1.20.0
Errors
Common errors & fixes
ERR_PACKAGE_PATH_NOT_EXPORTED: Package subpath './schemas' is not defined by "exports"
Importing from 'github-schema/schemas' which may have been removed or renamed.
fix
Use 'github-schema' main export or check documentation for correct subpath.
SyntaxError: Cannot use import statement outside a module
Using ESM import in a CommonJS context (e.g., Node.js without "type": "module").
fix
Add "type": "module" to package.json or use .mjs extension.
TypeError: schema.getQueryType is not a function
schema is not a GraphQLSchema object but a plain object (wrong import).
fix
Ensure you are importing the default export: import { schema } from 'github-schema'.
Upgrade
Version history
1.28.0latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
2 hits · last 30 days
node
2
Resources
github-schema — npm install github-schema · libregistry