@@ -115,8 +115,11 @@ enum Language {
115
115
116
116
## Schema
117
117
118
- SchemaDefinition : Description? schema Directives[ Const] ? {
119
- RootOperationTypeDefinition+ }
118
+ SchemaDefinition :
119
+
120
+ - Description? schema Directives[ Const] ? { RootOperationTypeDefinition+ }
121
+ - Description? schema Directives[ Const] [ lookahead != ` { ` ]
122
+ - Description schema [ lookahead != {` { ` , ` @ ` }]
120
123
121
124
RootOperationTypeDefinition : OperationType : NamedType
122
125
@@ -216,14 +219,22 @@ type MyMutationRootType {
216
219
{`subscription `} _root operation type_ are {"Query" }, {"Mutation" }, and
217
220
{"Subscription" } respectively .
218
221
219
- The type system definition language can omit the schema definition when each
220
- _root operation type_ uses its respective _default root type name_ and no other
221
- type uses any _default root type name_.
222
+ The type system definition language can omit the schema definition's root
223
+ operation type definitions when each _root operation type_ uses its respective
224
+ _default root type name_ and no other type uses any _default root type name_.
225
+
226
+ The type system definition language can omit the schema definition entirely when
227
+ all of the following hold:
228
+
229
+ - each _root operation type_ uses its respective _default root type name_,
230
+ - no other type uses any _default root type name_, and
231
+ - the schema does not have a description.
222
232
223
233
Likewise, when representing a GraphQL schema using the type system definition
224
- language, a schema definition should be omitted if each _root operation type_
225
- uses its respective _default root type name_ and no other type uses any _default
226
- root type name_.
234
+ language, a schema definition should be omitted if all of the above conditions
235
+ hold; otherwise the schema definition's root operation type definitions should
236
+ be omitted if each _root operation type_ uses its respective _default root type
237
+ name_ and no other type uses any _default root type name_.
227
238
228
239
This example describes a valid complete GraphQL schema, despite not explicitly
229
240
including a {`schema`} definition . The {"Query" } type is presumed to be the
@@ -259,6 +270,24 @@ type Mutation {
259
270
}
260
271
```
261
272
273
+ This example describes a valid GraphQL schema with a description and both a
274
+ {`query`} and {`mutation `} operation type :
275
+
276
+ ```graphql example
277
+ """
278
+ Example schema
279
+ """
280
+ schema
281
+
282
+ type Query {
283
+ someField : String
284
+ }
285
+
286
+ type Mutation {
287
+ someMutation : String
288
+ }
289
+ ```
290
+
262
291
### Schema Extension
263
292
264
293
SchemaExtension :
0 commit comments