On this page

Schema AST

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

Version
6.1.0
Weekly downloads
6.2M
License
MIT
Updated
Jul 6, 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”

commentDescriptions

type: boolean

Set to true in order to print description as comments (using # instead of """) 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