Skip to content

Commit 2647927

Browse files
committed
Address review from @vergenzt
1 parent 711ad04 commit 2647927

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,
@@ -1001,7 +1005,7 @@ In this example, a directive is added to a `NamedEntity` type without
10011005
adding fields:
10021006

10031007
```graphql example
1004-
extend type NamedEntity @addedDirective
1008+
extend interface NamedEntity @addedDirective
10051009
```
10061010

10071011
**Type Validation**
@@ -1188,7 +1192,7 @@ input value with the same name.
11881192

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

1191-
1. A Enum type must define one or more unique enum values.
1195+
1. An Enum type must define one or more unique enum values.
11921196

11931197

11941198
### Enum Extensions
@@ -1206,11 +1210,11 @@ extension of another GraphQL service.
12061210

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

1209-
1. The named type must already be defined and must be a Enum type.
1210-
3. All values of a Enum type extension must be unique.
1211-
4. All values of a Enum type extension must not already be a value of
1213+
1. The named type must already be defined and must be an Enum type.
1214+
2. All values of an Enum type extension must be unique.
1215+
3. All values of an Enum type extension must not already be a value of
12121216
the original Enum.
1213-
5. Any directives provided must not already apply to the original Enum type.
1217+
4. Any directives provided must not already apply to the original Enum type.
12141218

12151219

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

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

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

14001408
If the value provided to the Non-Null type is provided with a literal value
1401-
other than {null}, or a Non-Null variable value, it is coerced using the input coercion for the wrapped type.
1409+
other than {null}, or a Non-Null variable value, it is coerced using the input
1410+
coercion for the wrapped type.
14021411

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

@@ -1440,14 +1449,31 @@ DirectiveLocations :
14401449
- `|`? DirectiveLocation
14411450
- DirectiveLocations | DirectiveLocation
14421451

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

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

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

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

0 commit comments

Comments
 (0)