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

Can use @cacheControl directive with codegen #791

Open
saspre opened this issue Dec 3, 2018 · 3 comments
Open

Can use @cacheControl directive with codegen #791

saspre opened this issue Dec 3, 2018 · 3 comments
Labels
🤖 component - codegen related to the codegen core packages

Comments

@saspre
Copy link

saspre commented Dec 3, 2018

When I try and generate flow types for my schema I get an error saying:

Failed to generate types for src/modules/compute/service/ui/__fixtures__/query.graphql
 ›   Error: Error initializing Apollo GraphQL project "Unnamed Project": Error: Error in "Loading schema for Unnamed Project":
 ›   Error: Unknown directive "cacheControl".

My cmd to generate looks like this.

 ./node_modules/.bin/apollo client:codegen ${file}.types.js \
    --localSchemaFile ${PATH_TO_MERGED_SCHEMA}  \
    --target flow \
    --no-addTypename \
    --includes ${file} \
    --outputFlat \
    --useFlowExactObjects \
    --passthroughCustomScalars

It worked fine on version 1.9.2, but breaks on version 2.1.7.

@pjsikora
Copy link

@rasmusprentow has this issue been resolved?
Which Operating System are you using?
We have this issue on Windows. On MacOSX it works fine.

@JakeDawkins JakeDawkins added the 🤖 component - codegen related to the codegen core packages label Jul 9, 2019
@haflinger
Copy link

Same issue here, using this command :
apollo codegen:generate --target flow --useFlowExactObjects

My apollo config :

module.exports = {
  service: {
    localSchemaFile: './src/schema.graphql',
  },
};

I get this error :

  ✔ Loading Apollo Project
  ✖ Generating query files with 'flow' target
    → Unknown directive "cacheControl".
GraphQLSchemaValidationError: Unknown directive "cacheControl".
    at Object.buildSchemaFromSDL (~/dev/project/node_modules/apollo-graphql/lib/schema/buildSchemaFromSDL.js:38:15)
    at FileSchemaProvider.resolveSchema (~/dev/project/node_modules/apollo-language-server/lib/providers/schema/file.js:24:40)
    at GraphQLServiceProject.resolveSchema (~/dev/project/node_modules/apollo-language-server/lib/project/base.js:66:36)
    at Task.task (~/dev/project/node_modules/apollo/lib/commands/client/codegen.js:53:54)
    at Promise.resolve.then.then.skipped (~/dev/project/node_modules/listr/lib/task.js:167:30)```

@raheelkhan
Copy link

Any update on this ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🤖 component - codegen related to the codegen core packages
Projects
None yet
Development

No branches or pull requests

5 participants