I have a client-side schema in src/schema.graphql
and some queries in src/graphql/queries.ts
.
Currently, all my queries include @rest directive from apollo-link-rest and I am trying to generate Typescript types for them using apollo client:codegen
with the following command:
apollo client:codegen ./src/__generated__/types.ts --outputFlat --includes=./src/**/queries.ts --addTypename --localSchemaFile=./src/schema.graphql --target=typescript
This always results in
.../src/graphql/queries.ts: Unknown directive "rest".
ToolError: Validation of GraphQL query document failed
I don't understand what I am doing wrong. According to the docs here Apollo should support @client
and @rest
client-side directives out of the box.
Has anyone successfully generated types for queries with @rest
or @client
directives?