Skip to content

Commit aeada74

Browse files
committed
Address review from @vergenzt
1 parent e607dcc commit aeada74

File tree

2 files changed

+79
-32
lines changed

2 files changed

+79
-32
lines changed

spec/Appendix B -- Grammar Summary.md

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -276,11 +276,28 @@ DirectiveLocations :
276276
- `|`? DirectiveLocation
277277
- DirectiveLocations | DirectiveLocation
278278

279-
DirectiveLocation : one of
280-
`QUERY` `SCHEMA` `ENUM`
281-
`MUTATION` `SCALAR` `ENUM_VALUE`
282-
`SUBSCRIPTION` `OBJECT` `INPUT_OBJECT`
283-
`FIELD` `FIELD_DEFINITION` `INPUT_FIELD_DEFINITION`
284-
`FRAGMENT_DEFINITION` `ARGUMENT_DEFINITION`
285-
`FRAGMENT_SPREAD` `INTERFACE`
286-
`INLINE_FRAGMENT` `UNION`
279+
DirectiveLocation :
280+
- ExecutableDirectiveLocation
281+
- TypeSystemDirectiveLocation
282+
283+
ExecutableDirectiveLocation : one of
284+
`QUERY`
285+
`MUTATION`
286+
`SUBSCRIPTION`
287+
`FIELD`
288+
`FRAGMENT_DEFINITION`
289+
`FRAGMENT_SPREAD`
290+
`INLINE_FRAGMENT`
291+
292+
TypeSystemDirectiveLocation : one of
293+
`SCHEMA`
294+
`SCALAR`
295+
`OBJECT`
296+
`FIELD_DEFINITION`
297+
`ARGUMENT_DEFINITION`
298+
`INTERFACE`
299+
`UNION`
300+
`ENUM`
301+
`ENUM_VALUE`
302+
`INPUT_OBJECT`
303+
`INPUT_FIELD_DEFINITION`

spec/Section 3 -- Type System.md

Lines changed: 54 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -73,21 +73,21 @@ at the top level of a GraphQL query. For example, a basic GraphQL query like:
7373

7474
```graphql example
7575
query {
76-
me
76+
myName
7777
}
7878
```
7979

80-
Is valid when the `query` root operation type has a field named "me".
80+
Is valid when the `query` root operation type has a field named "myName".
8181

8282
```graphql example
8383
type Query {
84-
me: User
84+
myName: String
8585
}
8686
```
8787

8888
Similarly, the following mutation is valid if a `mutation` root operation type
8989
has a field named "setName". Note that the `query` and `mutation` root types
90-
should be different types.
90+
must be different types.
9191

9292
```graphql example
9393
mutation {
@@ -97,7 +97,8 @@ mutation {
9797
}
9898
```
9999

100-
When using the type system definition language, a document must include at most one `schema` definition.
100+
When using the type system definition language, a document must include at most
101+
one `schema` definition.
101102

102103
In this example, a GraphQL schema is defined with both query and mutation
103104
root types:
@@ -120,7 +121,8 @@ type MyMutationRootType {
120121
**Default Root Operation Type Names**
121122

122123
While any type can be the root operation type for a GraphQL operation, the type
123-
system definition language can omit the schema definition when the `query`, `mutation`, and `subscription` root types are named `Query`, `Mutation`, and
124+
system definition language can omit the schema definition when the `query`,
125+
`mutation`, and `subscription` root types are named `Query`, `Mutation`, and
124126
`Subscription` respectively.
125127

126128
Likewise, when representing a GraphQL schema using the type system language, a
@@ -149,7 +151,8 @@ made available via introspection.
149151

150152
To allow GraphQL service designers to easily publish documentation alongside the
151153
capabilities of a GraphQL service, GraphQL descriptions are defined using the
152-
Markdown syntax (as specified by [CommonMark](http://commonmark.org/)). In the type system definition language, these description strings (often {BlockString})
154+
Markdown syntax (as specified by [CommonMark](http://commonmark.org/)). In the
155+
type system definition language, these description strings (often {BlockString})
153156
occur immediately before the definition they describe.
154157

155158
All GraphQL types, fields, arguments and other definitions which can be
@@ -240,7 +243,8 @@ A GraphQL schema may describe that a field represents list of another types;
240243
the `List` type is provided for this reason, and wraps another type.
241244

242245
Similarly, the `Non-Null` type wraps another type, and denotes that the
243-
resulting value will never be null.
246+
resulting value will never be {null} (and that an error cannot result in a
247+
{null} value).
244248

245249
These two types are referred to as "wrapping types"; non-wrapping types are
246250
referred to as "named types". A wrapping type has an underlying named type,
@@ -1002,7 +1006,7 @@ In this example, a directive is added to a `NamedEntity` type without
10021006
adding fields:
10031007

10041008
```graphql example
1005-
extend type NamedEntity @addedDirective
1009+
extend interface NamedEntity @addedDirective
10061010
```
10071011

10081012
**Type Validation**
@@ -1189,7 +1193,7 @@ input value with the same name.
11891193

11901194
Enum types have the potential to be invalid if incorrectly defined.
11911195

1192-
1. A Enum type must define one or more unique enum values.
1196+
1. An Enum type must define one or more unique enum values.
11931197

11941198

11951199
### Enum Extensions
@@ -1207,11 +1211,11 @@ extension of another GraphQL service.
12071211

12081212
Enum type extensions have the potential to be invalid if incorrectly defined.
12091213

1210-
1. The named type must already be defined and must be a Enum type.
1211-
3. All values of a Enum type extension must be unique.
1212-
4. All values of a Enum type extension must not already be a value of
1214+
1. The named type must already be defined and must be an Enum type.
1215+
2. All values of an Enum type extension must be unique.
1216+
3. All values of an Enum type extension must not already be a value of
12131217
the original Enum.
1214-
5. Any directives provided must not already apply to the original Enum type.
1218+
4. Any directives provided must not already apply to the original Enum type.
12151219

12161220

12171221
## Input Objects
@@ -1391,6 +1395,10 @@ should be performed. If that result was not {null}, then the result of coercing
13911395
the Non-Null type is that result. If that result was {null}, then a field error
13921396
must be raised.
13931397

1398+
Note: When a field error is raised on a non-null value, the error propogates to
1399+
the parent field. For more information on this process, see
1400+
"Errors and Non-Nullability" within the Execution section.
1401+
13941402
**Input Coercion**
13951403

13961404
If an argument or input-object field of a Non-Null type is not provided, is
@@ -1399,7 +1407,8 @@ either not provided a value at runtime, or was provided the value {null}, then
13991407
a query error must be raised.
14001408

14011409
If the value provided to the Non-Null type is provided with a literal value
1402-
other than {null}, or a Non-Null variable value, it is coerced using the input coercion for the wrapped type.
1410+
other than {null}, or a Non-Null variable value, it is coerced using the input
1411+
coercion for the wrapped type.
14031412

14041413
Example: A non-null argument cannot be omitted.
14051414

@@ -1441,14 +1450,31 @@ DirectiveLocations :
14411450
- `|`? DirectiveLocation
14421451
- DirectiveLocations | DirectiveLocation
14431452

1444-
DirectiveLocation : one of
1445-
`QUERY` `SCHEMA` `ENUM`
1446-
`MUTATION` `SCALAR` `ENUM_VALUE`
1447-
`SUBSCRIPTION` `OBJECT` `INPUT_OBJECT`
1448-
`FIELD` `FIELD_DEFINITION` `INPUT_FIELD_DEFINITION`
1449-
`FRAGMENT_DEFINITION` `ARGUMENT_DEFINITION`
1450-
`FRAGMENT_SPREAD` `INTERFACE`
1451-
`INLINE_FRAGMENT` `UNION`
1453+
DirectiveLocation :
1454+
- ExecutableDirectiveLocation
1455+
- TypeSystemDirectiveLocation
1456+
1457+
ExecutableDirectiveLocation : one of
1458+
`QUERY`
1459+
`MUTATION`
1460+
`SUBSCRIPTION`
1461+
`FIELD`
1462+
`FRAGMENT_DEFINITION`
1463+
`FRAGMENT_SPREAD`
1464+
`INLINE_FRAGMENT`
1465+
1466+
TypeSystemDirectiveLocation : one of
1467+
`SCHEMA`
1468+
`SCALAR`
1469+
`OBJECT`
1470+
`FIELD_DEFINITION`
1471+
`ARGUMENT_DEFINITION`
1472+
`INTERFACE`
1473+
`UNION`
1474+
`ENUM`
1475+
`ENUM_VALUE`
1476+
`INPUT_OBJECT`
1477+
`INPUT_FIELD_DEFINITION`
14521478

14531479
A GraphQL schema describes directives which are used to annotate various parts
14541480
of a GraphQL document as an indicator that they should be evaluated differently
@@ -1483,7 +1509,11 @@ directive @example on
14831509
```
14841510

14851511
Directives can also be used to annotate the type system definition language
1486-
as well, which is :
1512+
as well, which can be a useful tool for supplying additional metadata in order
1513+
to generate GraphQL execution services, produce client generated runtime code,
1514+
or many other useful extensions of the GraphQL semantics.
1515+
1516+
In this example, the directive `@example` annotates field and argument definitions:
14871517

14881518
```graphql example
14891519
directive @example on FIELD_DEFINITION | ARGUMENT_DEFINITION

0 commit comments

Comments
 (0)