Skip to content

Commit 6a8e7a5

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

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

948948
UnionMembers :
949-
- NamedType
949+
- `|`? NamedType
950950
- UnionMembers | NamedType
951951

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

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

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

12791288
DirectiveLocations :
1280-
- DirectiveLocation
1289+
- `|`? DirectiveLocation
12811290
- DirectiveLocations | DirectiveLocation
12821291

12831292
DirectiveLocation : one of
@@ -1311,6 +1320,16 @@ fragment SomeFragment on SomeType {
13111320
}
13121321
```
13131322

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

0 commit comments

Comments
 (0)