On this page

Schema AST

Generate an AST representation of your GraphQL schema. This plugin is used internally by other plugins.

Version
7.0.0
Weekly downloads
12.8M
License
MIT
Updated
Nov 7, 2026

Installation

          npm i -D @graphql-codegen/schema-ast
        

Config API Reference

includeDirectives

type: boolean

Include directives to Schema output. Default value: “false”

includeIntrospectionTypes

type: boolean

Include introspection types to Schema output. Default value: “false”

sort

type: boolean

Set to false to disable sorting Default value: “true”

federation

type: boolean

Examples

codegen.ts
import type { CodegenConfig } from '@graphql-codegen/cli'

const config: CodegenConfig = {
  // ...
  schema: ['http://localhost:3000/graphql', './src/**/*.graphql', 'scalar MyCustomScalar'],
  generates: {
    'path/to/file.graphql': {
      plugins: ['schema-ast']
    }
  }
}
export default config