kamilkisiela / graphql-config

One configuration for all your GraphQL tools (supported by most tools, editors & IDEs)
https://the-guild.dev/graphql/config
MIT License
1.17k stars 94 forks source link

Question: how to deal with Gatsby's "arbitrary fieldName" #499

Closed romainbessugesmeusy closed 4 years ago

romainbessugesmeusy commented 4 years ago

Wit Gatsby GraphQL source plugin, we are asked to define a root level "fieldName" that surrounds the actual query. Using IntelliJ graphQL plugin, which relies on graphql-config, there's no autocompletion because it doesn't receive the arbitrary fieldName from the endpoint. Do you have any clue ?

Capture d’écran 2020-04-07 à 16 18 59

The Gatsby-Source-GraphQL config

    {
      resolve: 'gatsby-source-graphql',
      options: {
        // Arbitrary name for the remote schema Query type
        typeName: 'apiMG',
        // Field under which the remote schema will be accessible. You'll use this in your Gatsby query
        fieldName: 'apiMG',
        // Url to query from
        url: `${process.env.GATSBY_API_URL + process.env.GATSBY_API_KEY}`,
        refetchInterval: 60,
      },
    },

The .graphqlconfig file

{
  "name": "Pimcore",
  "schemaPath": "./pimcore.graphql",
  "extensions": {
    "endpoints": {
      "Remote Pimcore Endpoint": {
        "url": "URL",
        "headers": {
          "user-agent": "JS GraphQL"
        },
        "introspect": true
      }
    }
  }
}
kamilkisiela commented 4 years ago

@romainbessugesmeusy IntelliJ GraphQL Plugin doesn't use JavaScript implementation of graphql-config, they only share json / yaml syntax. You should submit an issue in plugin's repository.