vincentdnl

Add a GraphQL schema for your Gatsby project in Webstorm (JetBrains IDE)

February 16th, 2020

The JS GraphQL plugin for JetBrains IDEs like Webstorm is very helpful when you are writing your GraphQL queries. But I encountered a problem when trying to discover the endpoints, introspecting the plugin itself:

SchemaProblem{errors=[The object type 'MdxBlogPost' [@-1:-1] field
'excerpt' does not have the same number of arguments as specified via
interface 'BlogPost' [@-1:-1]]}

I don't know where the error comes from (I'd say the plugin itself) but here is a workaround to make it work!

  1. Install the graphql-cli using npm or yarn: npm install -g graphql-cli or yarn global add graphql-cli
  2. graphql init to create your .graphqlconfig file
  3. graphql get-schema to discover the schema using the cli tool instead of the plugin one.

Now the plugin should be able to help you write your queries properly. I hope it saves you some time!