captbaritone / captbaritone/grats
Idea for discussion: Introduce `@gqlSchema.query`, `@gqlSchema.mutation` and `@gqlSchema.subscription`
- Dominant language
- JavaScript
- Stars
- 358
- Forks
- 24
- PR merge metrics
- No merged PRs in 30d
Description
These would tag a single object type as the type used in the corresponding `schema` declaration in the resulting SDL. So, something like this:
```ts
/**
* @gqlType
* @gqlSchema.query
*/
export class MyOddlyNamedQueryType {
/** @gqlField */
me(): string {
return new 'yo';
}
}
```
Would generate:
```graphql
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`.
Contributor guide
Research direction
Start by locating the code that builds the resulting SDL and performs build or introspection-time checks, then review how the existing @gqlType and @gqlField annotations are handled. Define how @gqlSchema.query, @gqlSchema.mutation, and @gqlSchema.subscription interact with defaults, and ensure each annotation is accepted at most once.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- graphql, typescript
- Domain
- api, backend-api-design
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100