At a glance
- Project
- GraphQL Spec
- Identifier
- #1166
- Stage
- RFC X / Rejected
- Champion
- @benjie
- Updated
- 2025-05-22
- Latest activity
- Pull request closed on
- Source
- Pull request
Pull request description
This PR is motivated by:
- #1163
In the above PR we want to be able to indicate the error propagation behavior of a schema. However, I find it displeasing that to do so we would need to also explicitly detail the operations supported by the schema when they would normally be auto-detected based on their names:
+schema @behavior(onError: NO_PROPAGATE) {
+ query: Query
+ mutation: Mutation
+ subscription: Subscription
+}
+
type Query {
q: Int
}
type Mutation {
m: Int
}
type Subscription {
s: Int
}
This PR makes it so that you can use a schema keyword to add directives and/or description to the schema without needing to also specify the root operation types if they can be inferred by the default naming. The above diff would thus become:
+schema @behavior(onError: NO_PROPAGATE)
+
type Query {
q: Int
}
type Mutation {
m: Int
}
type Subscription {
s: Int
}
Much nicer! :sparkles:
This is also useful without the onError feature, since it allows you to apply a description to a schema without having to detail the operations:
+"""Just an example"""
+schema
+
type Query {
q: Int
}
type Mutation {
m: Int
}
type Subscription {
s: Int
}
PR #1164 applies these changes onto #1163; but this PR is mergeable into the spec as-is.
Timeline
May 2025
- Pull request closed on
- Marked as Rejected on by benjie
- Pull request created on by benjie
- Advanced to RFC 0 on by benjie
- Discussed in GraphQL WG
The GraphQL specification Working group discussed the deprecation of old versions of GraphQL JS, the proposal for defining a GraphQL request's response, and the clarification of the types of GraphQL responses. They also discussed the implementation of one-off features in GraphQL, Java, and GraphQL.js, the prevention of skip and include on route subscription selection sets, and the default value coercion rules. The group also discussed the need for a source of truth for built-in scalars and introspection types, the syntax for defining schemas in GraphQL, and the issue of error propagation in GraphQL.
Zoom summary · GraphQL WG · 2025-05-01Next StepsBenjie to bring back the discussion on enabling a naked version of the schema keyword to a future working group meeting.
Zoom summary · GraphQL WG · 2025-05-01Benjie proposed enabling a naked version of the schema keyword, which would allow for adding a description or directives without defining the operations. This change would be a breaking syntax change, as older versions of GraphQL wouldn't be able to parse it. The main problem this change would solve is allowing for the addition of a default error behavior to an existing schema without having to define the operation types. The team discussed the value of this change, with some members questioning the need for it. Michael suggested that the symmetry with interface and union type definitions was a good reason to make this change.
Zoom summary · GraphQL WG · 2025-05-01The group discusses the syntax for defining schemas in GraphQL, particularly focusing on whether empty curly braces should be allowed and if the 'query' type should be explicitly defined. Benjie proposes a more concise syntax for simple examples, while Lee expresses concern about potential ambiguity. The discussion touches on the placement of directives, whether they should be on the schema or root types. Michael mentions the need for a place to put general settings in schemas. Benjie suggests continuing the discussion in a future working group meeting.
Zoom summary · GraphQL WG · 2025-05-01
April 2025
- @benjie committed "Enable 'schema' keyword to be provided without root operations" on