Skip to content

Commit 47236bf

Browse files
authored
Merge pull request #320 from alexandrebodin/allow-union-type-begining-pipe
Add support for leading vertical bar in union types
2 parents 1be334e + e7a94e2 commit 47236bf

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

spec/Section 3 -- Type System.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -755,6 +755,28 @@ Union types have the potential to be invalid if incorrectly defined.
755755
Similarly, wrapping types may not be member types of a Union.
756756
2. A Union type must define one or more unique member types.
757757

758+
#### Union type syntax
759+
760+
Union types are defined by delimiting one or more types with a single vertical bar character `|`:
761+
762+
```graphql
763+
union SearchResult = Photo | Person
764+
```
765+
766+
You may also use a leading vertical bar:
767+
768+
```graphql
769+
union SearchResult =
770+
| Photo
771+
| Person
772+
```
773+
774+
Trailing delimiters are not supported:
775+
776+
```!graphql
777+
union SearchResult = Photo | Person |
778+
```
779+
758780
### Enums
759781

760782
GraphQL Enums are a variant on the Scalar type, which represents one of a

0 commit comments

Comments
 (0)