Skip to content

Commit afb50d6

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

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
@@ -947,7 +947,7 @@ Interface types have the potential to be invalid if incorrectly defined.
947947
UnionTypeDefinition : Description? union Name Directives[Const]? = UnionMembers
948948

949949
UnionMembers :
950-
- NamedType
950+
- `|`? NamedType
951951
- UnionMembers | NamedType
952952

953953
GraphQL Unions represent an object that could be one of a list of GraphQL
@@ -1011,6 +1011,15 @@ Instead, the query would be:
10111011
}
10121012
```
10131013

1014+
Union members may be defined with an optional leading `|` character to aid
1015+
formatting when representing a longer list of possible types:
1016+
1017+
```graphql example
1018+
union SearchResult =
1019+
| Photo
1020+
| Person
1021+
```
1022+
10141023
**Result Coercion**
10151024

10161025
The union type should have some way of determining which object a given result
@@ -1278,7 +1287,7 @@ a non-null input type as invalid.
12781287
DirectiveDefinition : Description? directive @ Name ArgumentsDefinition? on DirectiveLocations
12791288

12801289
DirectiveLocations :
1281-
- DirectiveLocation
1290+
- `|`? DirectiveLocation
12821291
- DirectiveLocations | DirectiveLocation
12831292

12841293
DirectiveLocation : one of
@@ -1312,6 +1321,16 @@ fragment SomeFragment on SomeType {
13121321
}
13131322
```
13141323

1324+
Directive locations may be defined with an optional leading `|` character to aid
1325+
formatting when representing a longer list of possible locations:
1326+
1327+
```graphql example
1328+
directive @example on
1329+
| FIELD
1330+
| FRAGMENT_SPREAD
1331+
| INLINE_FRAGMENT
1332+
```
1333+
13151334
Directives can also be used to annotate the type system definition language
13161335
as well, which is :
13171336

0 commit comments

Comments
 (0)