【发布时间】:2020-02-07 16:47:57
【问题描述】:
我在src/schema.graphql 中有一个客户端架构,在src/graphql/queries.ts 中有一些查询。
目前,我的所有查询都包括@rest directive from apollo-link-rest,我正在尝试使用apollo client:codegen 使用以下命令为它们生成Typescript 类型:
apollo client:codegen ./src/__generated__/types.ts --outputFlat --includes=./src/**/queries.ts --addTypename --localSchemaFile=./src/schema.graphql --target=typescript
这总是会导致
.../src/graphql/queries.ts: Unknown directive "rest".
ToolError: Validation of GraphQL query document failed
我不明白我做错了什么。根据the docs here Apollo 应该支持@client 和@rest 开箱即用的客户端指令。
有没有人使用@rest 或@client 指令成功生成查询类型?
【问题讨论】:
标签: typescript graphql apollo apollo-client