At a glance
- Project
- GraphQL Spec
- Identifier
- #987
- Stage
- RFC 3 / Accepted
- Champion
- @benjie
- Updated
- 2023-07-08
- Latest activity
- Pull request merged on
- Source
- Pull request
Pull request description
@rivantsov Pointed out in #978 that there's some ambiguity around when the schema keyword can be omitted from the SDL. Upon careful reading I've noticed that there is additional ambiguity around this topic.
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.
This seems to imply that all the root types are required in order to omit the schema definition. I've modified the text to indicate that the names only need to match for the root types that are actually present.
Likewise, when representing a GraphQL schema using the type system definition language, a schema definition should be omitted if it only uses the default root operation type names.
Imagine we're doing biological research, tracking mutations in a virus. We might have a schema like:
type Query {
viruses: [Virus!]
}
type Virus {
name: String!
knownMutations: [Mutation!]!
}
type Mutation {
name: String!
geneSequence: String!
}
schema {
query: Query
}
In this case we must not omit the schema definition when representing the schema using the SDL, because doing so would make it seem that the Mutation type was the root type for the mutation operation, when in fact the schema does not support a mutation operation.
I've clarified the wording to deal with this possibility too.
Timeline
February 2023
- Pull request merged on by leebyron
- @leebyron committed "add related definition and specific example" on
- Advanced to RFC 3 on by leebyron
- On the agenda for GraphQL WG
4 listed attendees · 8 agenda items · 2 linked RFCs
- Agree to Membership Agreement, Participation & Contribution Guidelines and Code of Conduct (1m, Lee)
- Introduction of attendees (5m, Lee)
- Determine volunteers for note taking (1m, Lee)
- Review agenda (2m, Lee)
- Review prior primary meeting (5m, Lee)
- Review previous meeting's action items (5m, Lee)
- Fix ambiguity around when schema definition may be omitted (10m, Benjie) #987
- Fragment Arguments (10m, Matt) #1010
- Advanced to RFC 1 on by leebyron
- On the agenda for GraphQL WG
18 listed attendees · 12 agenda items · 3 linked RFCs
- Agree to Membership Agreement, Participation & Contribution Guidelines and Code of Conduct (1m, Lee)
- Introduction of attendees (5m, Lee)
- Determine volunteers for note taking (1m, Lee)
- Review agenda (2m, Lee)
- Review prior secondary meetings (5m, Lee)
- Review previous meeting's action items (5m, Lee)
- TSC: Election Results (5m, TSC)
- TSC: Management of build and publish infrastructure, secrets, etc (20m, Benjie / Rikki)
- Fix ambiguity around when schema definition may be omitted (10m, Benjie) #987
- Advance argument name uniqueness to Stage 3 (10m, Benjie) #891
- @defer: fully deduplicate response (30m, Ivan)
- Default Value Validation Status Check (5m, Yaacov) #793
September 2022
- 2 commits pushed on
- @benjie committed "default root operation type name -> default operation type name"
- @benjie committed "default operation type name -> default root type name"
- Discussed in GraphQL WG
August 2022
- Pull request created on by benjie
- 3 commits pushed on
- @benjie committed "Fix ambiguity when discussing the schema definition"
- @benjie committed "Further clarification"
- @benjie committed "Alternative wording"