Migrate to Netlify Today

Netlify announces the next evolution of Gatsby Cloud. Learn more

ContactSign Up
Community Plugin
View plugin on GitHub


A Gatsby plugin that extracts your graphql schema to a .json file.

You can use this file to check your queries against your schema, by using eslint-plugin-graphql.


Extract schema: npm install --save gatsby-plugin-extract-schema

Use extracted schema: npm install --save-dev eslint babel-eslint eslint-plugin-graphql

How to use

Edit gatsby-config.js

module.exports = {
  plugins: ["gatsby-plugin-extract-schema"]


  resolve: "gatsby-plugin-extract-schema",
    options: {
      dest: `${__dirname}/path/to/schema.json`,

Check queries against schema

Add .eslintrc.js to the project root

const path = require("path");
module.exports = {
  parser: "babel-eslint",
  rules: {
    "graphql/template-strings": [
        env: "relay",
        schemaJsonFilepath: path.resolve(__dirname, "./schema.json"),
        tagName: "graphql"
  plugins: ["graphql"]

Big thanks to Kurtis Kemple for all his help!

© 2023 Gatsby, Inc.