Magento has numerous schema.graphqls
files spread across its modules. It also has custom directives such as @doc graphics files spread across its modules. It also has custom directives such as
and @doc@resolverand
@resolver`. When I'm using PhpStorm with the JS GraphQL plugin, what is the best way to collect all of the schemas, including the custom directives, and get suggestions and remove the errors?
For example, in the Magento_DirectoryGraphQl/etc/schema.graphqls
file, in the very first custom query: currency:graphics Currencyfile, @resolver(class:in "Magento\\DirectoryGraphQl\\Model\\Resolver\\Currency")the @doc(description:very "Thefirst currencycustom query: returns
currency: Currency @resolver(class: "Magento\DirectoryGraphQl\Model\Resolver\Currency") @doc(description: "The currency query returns information about store currency.") @cache(cacheable: false), informationI'm aboutgetting storeerrors currencyon almost the whole line.") @cache(cacheable:The false)
, I'm getting errors on almost the whole line. The Currency
Currency` type defined just below in the same file is not parsed, none of the custom directives are parsed either.
I have searched online a little and found that we need to have a .graphqlconfig
file for the PhpStorm plugin to pickuppick up and use. But I'm not sure what's the best way to implement it considering Magento's schema stitching priorities are based on the module load order. I've tried creating a config file too in the Magento root, but the plugin doesn't seem to pick it up.
If anyone has configured GraphQL schema intelligence in PhpStorm, I'd like to hear how you have done it. Thank you!