'How do I fetch a valid cloudflare API v4 Graphql schmea?
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?
Solution 1:[1]
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/
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Victor Perov |