如何获取有效的CloudFlare API V4 GraphQl Schmea?

发布于 2025-01-20 11:48:09 字数 744 浏览 1 评论 0原文

我的目标是使用 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

眼泪也成诗 2025-01-27 11:48:09

原因是 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/

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文