-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Idea for discussion: Introduce @gqlSchema.query
, @gqlSchema.mutation
and @gqlSchema.subscription
#36
Comments
Maybe a tag like |
I think I was imagining something more like: /**
* An amazing schema!
* @gqlSchema
*/
type Schema {
/**
* The query operation
* @gqlOperation */
query: Query,
/** @gqlOperation */
mutation: Mutation
/** @gqlOperation */
subscription: Subscription
} which would emit: """
An amazing schema!
"""
schema {
"""
The query operation
"""
query: Query
mutation: Mutation
subscription: Subscription
} It's a bit more verbose, but I think it has better symmetry with our existing tags and also more closely models the SDL. It gives a place to define a top-level schema description, as well as leaving the door open for directives on each of these positions (schema definition, as well as each operation's definition). |
hmmmm, inspired from your example, mine could also be: /**
* @gqlType
* @gqlOperation query
*/
export class MyOddlyNamedQueryType {
/** @gqlField */
me(): string {
return new 'yo';
}
} Honestly, I like all these options equally 😄 Question: In your example, on the object type tagged |
Re verbosity: IMO that is not a problem in practice, because defining the |
Yeah, I like that a bit better than the version with the dot syntax. However that still doesn't give a clear way to add a description to the schema itself, or a clear way to add descriptions/directives to the operation declaration itself without adding new semantics to how tags work.
Yeah. I think you're right that we could omit the |
True, I forgot about that. This then clearly makes your proposal the way to go! Regarding |
These would tag a single object type as the type used in the corresponding
schema
declaration in the resulting SDL. So, something like this:Would generate:
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'smutation
key would be whatever object type is namedMutation
.The text was updated successfully, but these errors were encountered: