如何获取有效的CloudFlare API V4 GraphQl Schmea?
我的目标是使用 Cloudflare Graphql API,使用 GraphQl 代码生成器。
然而,当我尝试使用这样的架构时:
./src/queries-cloudflare/generated.ts:
schema:
- 'https://api.cloudflare.com/client/v4/graphql':
headers:
Authorization: Bearer <token>
documents: ./src/queries-cloudflare/queries/**/*.graphql
plugins:
- typescript
- typescript-operations
- typescript-document-nodes
我只是收到一条错误消息,指出出现问题类型突变必须定义一个或多个字段。
。
这是怎么回事 - 为什么我不能使用模式来生成代码?
My objective is to consume the Cloudflare Graphql API, using GraphQl Code Generator.
However when I try to use the schema like this:
./src/queries-cloudflare/generated.ts:
schema:
- 'https://api.cloudflare.com/client/v4/graphql':
headers:
Authorization: Bearer <token>
documents: ./src/queries-cloudflare/queries/**/*.graphql
plugins:
- typescript
- typescript-operations
- typescript-document-nodes
I simply get an error saying Something went wrong Type mutation must define one or more fields.
.
What's going on here - why can't I use the schema for code generation?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
原因是 Cloudflare GraphQL API 目前不支持突变。
但我们计划在不久的将来添加它。目前,您仍然可以探索模式并手动编写查询:
https://developers.cloudflare.com/analytics /graphql-api/getting-started/explore-graphql-schema/
The reason is that Cloudflare GraphQL API does not support mutations at the moment.
But we have plans to add it in the near future. As for now, you still can explore schema and write queries manually:
https://developers.cloudflare.com/analytics/graphql-api/getting-started/explore-graphql-schema/