Skip to content

Commit 5e643f2

Browse files
committed
Make root query operation type optional
This makes the root query operation type optional like the other types. Schema introspection is unaffected. The `__schema` and `__type` fields were already described as "implicit" and not part of the defined root query operation type. A schema without a root query type therefore only supports these queries. Fixes #490
1 parent b2aca18 commit 5e643f2

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

spec/Section 3 -- Type System.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,11 @@ A schema defines the initial root operation type for each kind of operation it
6969
supports: query, mutation, and subscription; this determines the place in the
7070
type system where those operations begin.
7171

72-
The `query` root operation type must be provided and must be an Object type.
72+
A schema must define at least one root operation type.
73+
74+
The `query` root operation type must be an Object type; if it is not
75+
explicitly provided then a default Query object type only supporting
76+
introspection will be used.
7377

7478
The `mutation` root operation type is optional; if it is not provided, the
7579
service does not support mutations. If it is provided, it must be an

spec/Section 4 -- Introspection.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,8 @@ __type(name: String!): __Type
111111
```
112112

113113
These fields are implicit and do not appear in the fields list in the root type
114-
of the query operation.
114+
of the query operation. They are available even if the schema does not provide
115+
its own root type for the query operation.
115116

116117
The schema of the GraphQL schema introspection system:
117118

0 commit comments

Comments
 (0)