Skip to content

Commit c4e7443

Browse files
committed
Include optional leading bar for unions & directive locations. Merging and closing #323
1 parent 5925ab6 commit c4e7443

File tree

2 files changed

+23
-4
lines changed

2 files changed

+23
-4
lines changed

spec/Appendix B -- Grammar Summary.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ InterfaceTypeDefinition : Description? interface Name Directives[Const]? FieldDe
228228
UnionTypeDefinition : Description? union Name Directives[Const]? = UnionMembers
229229

230230
UnionMembers :
231-
- NamedType
231+
- `|`? NamedType
232232
- UnionMembers | NamedType
233233

234234
EnumTypeDefinition : Description? enum Name Directives[Const]? { EnumValueDefinition+ }
@@ -240,7 +240,7 @@ InputObjectTypeDefinition : Description? input Name Directives[Const]? { InputVa
240240
DirectiveDefinition : Description? directive @ Name ArgumentsDefinition? on DirectiveLocations
241241

242242
DirectiveLocations :
243-
- DirectiveLocation
243+
- `|`? DirectiveLocation
244244
- DirectiveLocations | DirectiveLocation
245245

246246
DirectiveLocation : one of

spec/Section 3 -- Type System.md

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -943,7 +943,7 @@ Interface types have the potential to be invalid if incorrectly defined.
943943
UnionTypeDefinition : Description? union Name Directives[Const]? = UnionMembers
944944

945945
UnionMembers :
946-
- NamedType
946+
- `|`? NamedType
947947
- UnionMembers | NamedType
948948

949949
GraphQL Unions represent an object that could be one of a list of GraphQL
@@ -1007,6 +1007,15 @@ Instead, the query would be:
10071007
}
10081008
```
10091009

1010+
Union members may be defined with an optional leading `|` character to aid
1011+
formatting when representing a longer list of possible types:
1012+
1013+
```graphql example
1014+
union SearchResult =
1015+
| Photo
1016+
| Person
1017+
```
1018+
10101019
**Result Coercion**
10111020

10121021
The union type should have some way of determining which object a given result
@@ -1274,7 +1283,7 @@ a non-null input type as invalid.
12741283
DirectiveDefinition : Description? directive @ Name ArgumentsDefinition? on DirectiveLocations
12751284

12761285
DirectiveLocations :
1277-
- DirectiveLocation
1286+
- `|`? DirectiveLocation
12781287
- DirectiveLocations | DirectiveLocation
12791288

12801289
DirectiveLocation : one of
@@ -1308,6 +1317,16 @@ fragment SomeFragment on SomeType {
13081317
}
13091318
```
13101319

1320+
Directive locations may be defined with an optional leading `|` character to aid
1321+
formatting when representing a longer list of possible locations:
1322+
1323+
```graphql example
1324+
directive @example on
1325+
| FIELD
1326+
| FRAGMENT_SPREAD
1327+
| INLINE_FRAGMENT
1328+
```
1329+
13111330
Directives can also be used to annotate the type system definition language
13121331
as well, which is :
13131332

0 commit comments

Comments
 (0)