Name top level schema items according to specification
Bryji opened this issue · comments
The GQL spec requires the top level types in the GQL schmea to be Query
, Mutation
, Subscription
:
Default Root Operation Type Names
While any type can be the root operation type for a GraphQL operation, the type system definition language can omit the schema definition when the query, mutation, and subscription root types are named "Query", "Mutation", and "Subscription" respectively.
We followed the examples from Caliban documentation giving a Queries
top level type which then caused issues for some of our clients using tooling to generate schema (sbt plugin graphqlCodegen).
The equivalent schema creation code in Sangria doesn't provide this degree of freedom (forcing you to adhere to standards):
Schema(query = QueryType[F](config), mutation = Some(MutationType[F]))
Suggest to update documentation examples to use Query
vs Queries
etc. (I could PR this if it's agreeable) and maybe in future for the API to be more restrictive and force use of the specification names.
It seems like the problem would be in the introspection since you mentioned that clients trying to use tooling against an API are encountering the issues. The spec says you can use any types (as long as they are different) we just need to include a schema type if we are defining them non-standard
Right, guess I misread it.