Skip to content

Commit a4c6a93

Browse files
committed
Include optional leading bar for unions & directive locations. Merging and closing #323
1 parent 4d63721 commit a4c6a93

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
@@ -1273,7 +1282,7 @@ a non-null input type as invalid.
12731282
DirectiveDefinition : Description? directive @ Name ArgumentsDefinition? on DirectiveLocations
12741283

12751284
DirectiveLocations :
1276-
- DirectiveLocation
1285+
- `|`? DirectiveLocation
12771286
- DirectiveLocations | DirectiveLocation
12781287

12791288
DirectiveLocation : one of
@@ -1307,6 +1316,16 @@ fragment SomeFragment on SomeType {
13071316
}
13081317
```
13091318

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

0 commit comments

Comments
 (0)