Load schema from file

Author: bafloCreated Jan 5, 2021Updated Nov 8, 2024

This issue pertains to the following package(s):

  • GraphQL Playground - Electron App
  • GraphQL Playground HTML
  • GraphQL Playground
  • GraphQL Playground Express Middleware
  • GraphQL Playground Hapi Middleware
  • GraphQL Playground Koa Middleware
  • GraphQL Playground Lambda Middleware

What OS and OS version are you experiencing the issue(s) on?

Windows 10 20H2

What version of graphql-playground(-electron/-middleware) are you experiencing the issue(s) on?

1.8.10

What is the expected behavior?

Schema should be loaded from file if given by .graphqlconfig

What is the actual behavior?

Schema is not loaded

What steps may we take to reproduce the behavior?

Save this file as .graphqlconfig:

json
{
  "schema": "schema.gql",
  "documents": "apps/backend/src/app/common/**/*.graphql",
  "projects": {
    "app": {
      "schemaPath": "schema.gql",
      "extensions": {
        "endpoints": {
          "default": "http://localhost:4000/graphql"
        }
      }
    }
  }
}

and this as graphql.yml:

graphql
type Query {
  getSetting: Setting!
}

type Setting {
  id: Int!
  highlightColor: String!
  errorColor: String!
  infoColor: String!
  logoUrl: String!
}

Then open the workspace containing the .graphlconfig. It won't load the schema.

Please provide a gif or image of the issue for a quicker response/fix.

Source: graphql/graphql-playground