I am looking for a way to make the developer workflow more efficient while GraphQL.
Currently, using graphql-code-generator to generate types from my GraphQL server on the frontend.
This is great, but this is only generating types. In order to generate methods for mutations, queries and subscriptions, I need to create a GraphQL document for each operation in my frontend project, for example:
file addPost.graphql
mutation addPost {
...
}
...
I find having to create an extra addPost.graphql to generate the method a bit redundant as it is already declared on my GraphQL server.
Is there a plugin/configuration that will generate these methods that I can use in my project without having to manually create the additional GraphQL documents?
Here is my GraphQL generator yml file
# graphql-generator.yml
overwrite: true
schema: https://localhost:8088/query
documents: ./libs/**/*.graphql <----- generating these *.graphql files would be great!
generates:
libs/graphql/src/lib/generated/graphql.ts:
plugins:
- "typescript"
- "typescript-resolvers"
- "typescript-operations"
- "typescript-apollo-angular"
./graphql.schema.json:
plugins:
- "introspection"