eslint-plugin-graphql icon indicating copy to clipboard operation
eslint-plugin-graphql copied to clipboard

Get schema from url

Open AdrienLemaire opened this issue 5 years ago • 1 comments
trafficstars

This is a follow-up on #4, although I'd also be pleased if #257 gets implemented.

I'm using an augmented schema, which can be found via a url.

I thought eslint-plugin-graphql supported graphql-config, and following their doc, I tried

# .graphqlrc
schema: 'http://localhost:4001/graphql'

I now understand that eslint-plugin-graphql only supports a .graphqlconfig file containing a schemaPath key, which is rather limiting.

Is it correct that we cannot currently use an url endpoint, and must keep updated a downloaded json file?

AdrienLemaire avatar May 27 '20 06:05 AdrienLemaire

I'm currently using an updates version of graphql v15 and graphql-cli v4 which indeed has me running into the same issue, I'm running an introspection query to fetch the schema with the following config as per the graphql config docs:

schema: ${API_ENDPOINT:https://cms.digitalnatives.nl/graphql}
documents: 'graphql/**/*.graphql'
extensions:
  codegen:
    generates:
      ./schema.json:
        plugins:
          - introspection

Using with this plugin leads to the following error:

Error: Error while loading rule 'graphql/template-strings': Loader Url has no sync mode.

It would be great if the eslint plugin would support these extended/changed schema options.

FreekVR avatar Sep 28 '20 14:09 FreekVR