grats
grats copied to clipboard
Idea for discussion: Introduce `@gqlSchema.query`, `@gqlSchema.mutation` and `@gqlSchema.subscription`
These would tag a single object type as the type used in the corresponding schema
declaration in the resulting SDL. So, something like this:
/**
* @gqlType
* @gqlSchema.query
*/
export class MyOddlyNamedQueryType {
/** @gqlField */
me(): string {
return new 'yo';
}
}
Would generate:
type MyOddlyNamedQueryType {
me: String
}
schema {
query: MyOddlyNamedQueryType
}
Same for @gqlSchema.mutation
and @gqlSchema.subscription
. Obviously, at build/introspection time, a check should run that asserts that each of these @gqlSchema.*
appear only once. Defaults would still be used; so, there is a @gqlSchema.query
on a type, but there's no @gqlSchema.mutation
anywhere, it is assumed that the schema's mutation
key would be whatever object type is named Mutation
.