@@ -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,23 @@ 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_,
231
+ - the schema does not have a description, and
232
+ - the schema uses the {"PROPAGATE" } _default error behavior_ .
222
233
223
234
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_.
235
+ language, a schema definition should be omitted if all of the above conditions
236
+ hold; otherwise the schema definition's root operation type definitions should
237
+ be omitted if each _root operation type_ uses its respective _default root type
238
+ name_ and no other type uses any _default root type name_.
227
239
228
240
This example describes a valid complete GraphQL schema, despite not explicitly
229
241
including a {`schema`} definition . The {"Query" } type is presumed to be the
@@ -259,6 +271,27 @@ type Mutation {
259
271
}
260
272
```
261
273
274
+ <!-- https ://github .com /prettier /prettier /issues /17286 -->
275
+ <!-- prettier -ignore -->
276
+ This example describes a valid GraphQL schema with a description, _default
277
+ error behavior_ of {"NO\_PROPAGATE" }, and both a {`query `} and {`mutation `}
278
+ operation type :
279
+
280
+ ```graphql example
281
+ """
282
+ Example schema
283
+ """
284
+ schema @behavior (onError : NO_PROPAGATE )
285
+
286
+ type Query {
287
+ someField : String
288
+ }
289
+
290
+ type Mutation {
291
+ someMutation : String
292
+ }
293
+ ```
294
+
262
295
### Schema Extension
263
296
264
297
SchemaExtension :
@@ -2187,7 +2220,5 @@ In this example, the schema indicates it is using the {"NO\_PROPAGATE"} _default
2187
2220
error behavior_ :
2188
2221
2189
2222
```graphql example
2190
- schema @behavior (onError : NO_PROPAGATE ) {
2191
- query : Query
2192
- }
2223
+ schema @behavior (onError : NO_PROPAGATE )
2193
2224
```
0 commit comments