Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No support of @client directive #60

Open
yairopro opened this issue Mar 3, 2022 · 3 comments
Open

No support of @client directive #60

yairopro opened this issue Mar 3, 2022 · 3 comments

Comments

@yairopro
Copy link

yairopro commented Mar 3, 2022

@Fxlr8
Copy link

Fxlr8 commented Apr 7, 2022

There is an easy fix for that:

Create a local graphql schema file if you don't have one and add the following line to the beginning:

clientSchema.graphql

directive @client on FIELD

Then add that client schema to your .graphqlrc.yml like that

schema:
  - https://some-remote-schema.net/api/graphql
  - clientSchema.graphql # <- here
documents: "src/**/*.{graphql,js,ts,jsx,tsx}"

Done

@yairopro
Copy link
Author

yairopro commented Apr 14, 2022

I have no .graphqlrc.yml, I use an apollo.config.js file. Do you know how to configure it in the same way?

@almondheng
Copy link

You can configure it like this.

// apollo.config.js

module.exports = {
  client: {
    includes: [ . . . ]
    service: {
      name: '' // YOUR APP NAME,
      localSchemaFile: './path/to/your/local/clientSchema.gql'
    }
  }
}

However, it wouldn't solve your problem because even though the @client directive can be validated, the field itself is still not recognized due to it not being defined in the schema.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants