JetBrains / js-graphql-intellij-plugin

GraphQL language support for WebStorm, IntelliJ IDEA and other IDEs based on the IntelliJ Platform.
https://jimkyndemeyer.github.io/js-graphql-intellij-plugin/
MIT License
879 stars 97 forks source link

Support custom types #473

Closed drortirosh closed 3 years ago

drortirosh commented 3 years ago

Support adding custom global types to the scheme. I'm trying to the plugin with TheGraph scheme,

e.g. https://thegraph.com/docs/define-a-subgraph#from-an-example-subgraph

There are few scalar types (BigInt and Bytes) and directives (@entity, @derivedFrom) that need to be defined globally.

Is it possible to add global types to the configuration file ?

jimkyndemeyer commented 3 years ago

Hi Dror,

For cases like these the recommended approach is to add a .graphql or .graphqls file with the needed custom types in your project. This file is then picked up by the schema discovery that the plugin performs (see docs at https://jimkyndemeyer.github.io/js-graphql-intellij-plugin/docs/developer-guide). Unless you use something like globs to pick up your schema for your GraphQL endpoint service this should have no effect on the runtime behaviour and only assist this plugin.

vepanimas commented 3 years ago

I'll close it for now, this can be solved by creating a separate graphql file with all the necessary type definitions exactly as described by @jimkyndemeyer. Feel free to ask more questions and reopen the issue if you still have some issues with schema configuration.