Skip to content

Commit e9b2ce8

Browse files
committed
change title to not use GraphQL explicitly. Update to add some examples, will need to make more robust later
1 parent f8b3fbc commit e9b2ce8

2 files changed

Lines changed: 54 additions & 5 deletions

File tree

gaps/GAP-33/DRAFT.md

Lines changed: 50 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# GraphQL Schema Definition Language - Set Extensions
1+
# Set Extensions for Type System Documents
22

33
This document specifics an alternative to the [Type System Document](https://spec.graphql.org/draft/#sec-Type-System) for defining a set-compatible version of the type system of a GraphQL Schema.
44

@@ -345,6 +345,55 @@ TypeSystemDirectiveLocation : one of
345345
346346
SetDirectiveExtension : extend directive @ Name SetArgumentsDefinitionOrExtension? Directives[Const]
347347
348+
# Set Operations
349+
350+
With the provided syntax, we can create set operations
351+
- `union`, or ∪⁠ (also known as **merge** or **set addition**). `union` is associative and commutative, much like addition.
352+
- `intersect`, or ∩.
353+
- `exclude`, or \, or - (also known as **difference** or **set subtraction**). `exclude` is neither associative nor commutative, much like subtraction.
354+
355+
## Union
356+
357+
```graphql
358+
type A implements X {
359+
field(arg: Int): String
360+
}
361+
```
362+
`union`
363+
```graphql
364+
type A @directive {
365+
field(arg: Int!): String!
366+
}
367+
```
368+
will result in:
369+
```
370+
type A implements X @directive {
371+
field(arg: Int!): String
372+
}
373+
```
374+
375+
If a union could not possibly be commutative, i.e. the *order* of set union would affect the result,
376+
then the `union` operation should return a `UnionError`. The type of `A.field` below cannot be determined.
377+
```
378+
type A {
379+
field: Int!
380+
}
381+
```
382+
`union`
383+
```
384+
type A {
385+
field: String!
386+
}
387+
```
388+
389+
390+
## Exclude
391+
392+
## Intersect
393+
394+
`A intersect B = A exclude (A exclude B)`.
395+
396+
`intersect` is defined by the application of `exclude`.
348397
349398
# Appendix: Grammar Summary
350399

gaps/GAP-33/metadata.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
id: 33
2-
title: GraphQL Schema Definition Language - Set Extensions
2+
title: Set Extensions for Type System Documents
33
summary: >
4-
An auxiliary syntax extending the Schema Definition Language syntax,
5-
unlocking set-like operations (union, exclude, intersect) on SDL documents.
4+
An auxiliary syntax extending the Type System Document syntax,
5+
unlocking set-like operations (union, exclude, intersect) on Schema IDL.
66
status: proposal
77
authors:
88
- name: "Matt Mahoney"
99
email: "mahoney.mattj@gmail.com"
1010
githubUsername: "@mjmahone"
11-
sponsor: "@mjmahone"
11+
sponsor: "@magicmark"
1212
discussion: "https://github.com/graphql/gaps/pull/33"

0 commit comments

Comments
 (0)