Add a GraphQL schema for your Gatsby project in Webstorm (JetBrains IDE)
February 16, 2020 • #GatsbyJS, #ProductivityThe 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 viainterface '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!
- Install the
graphql-cli
using npm or yarn:npm install -g graphql-cli
oryarn global add graphql-cli
graphql init
to create your.graphqlconfig
filegraphql 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!