apollographql / apollographql/apollo-tooling
Can use @cacheControl directive with codegen
- Dominant language
- TypeScript
- Stars
- 3k
- Forks
- 460
- PR merge metrics
- No merged PRs in 30d
Description
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.
Contributor guide
Research direction
Reproduce the failure with the shown `apollo client:codegen` command, using the merged schema and a query containing `@cacheControl`. Trace schema loading and directive validation for the `--target flow` path; done means codegen accepts the directive and generates the requested Flow types without the unknown-directive error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- graphql, typescript
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100