-
Notifications
You must be signed in to change notification settings - Fork 110
Description
Hi DGS team 👋
We’re currently using DGS Codegen to generate Java client code from a GraphQL schema that is generated by Hasura.
Hasura generates a valid GraphQL schema with custom root type names, such as query_root, mutation_root, and subscription_root, instead of the usual Query, Mutation, and Subscription.
Example schema:
schema {
query: query_root
mutation: mutation_root
subscription: subscription_root
}
type query_root {
# some fields here
}
type mutation_root {
# some fields here
}
type subscription_root {
# some fields here
}While this is perfectly valid according to the GraphQL spec (see GraphQL spec 3.2), it seems that DGS Codegen relies on the root types being named Query, Mutation, and Subscription, and does not generate code for these custom root types.
Our current workaround
As a workaround, we manually rewrite the schema before passing it to DGS Codegen:
schema {
query: Query
mutation: Mutation
subscription: Subscription
}
# then copy contents from query_root to Query, etc.
This allows client code generation to work properly, but it’s a manual.
Feature request
Would it be possible for DGS Codegen to allow users to configure the names of the root types (query, mutation, subscription) via codegen config ?
Motivation
This would improve compatibility with Hasura and any other GraphQL server that uses valid non-standard root type names, without requiring manual schema rewriting.