Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds Semantical Equivalence of Types Validation Rule #37

Open
wants to merge 12 commits into
base: main
Choose a base branch
from
1 change: 1 addition & 0 deletions cspell.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,4 @@ words:
ignoreWords:
- Aremergeable
- FXXXX
- TYPE_KIND_NOT_MERGABLE
michaelstaib marked this conversation as resolved.
Show resolved Hide resolved
61 changes: 61 additions & 0 deletions spec/Section 4 -- Composition.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,67 @@ run in sequence to produce the composite execution schema.

### Pre Merge Validation

#### Semantical Equivalence of Types
michaelstaib marked this conversation as resolved.
Show resolved Hide resolved

**Error Code**

`TYPE_KIND_NOT_MERGABLE`
michaelstaib marked this conversation as resolved.
Show resolved Hide resolved

**Formal Specification**

- Let {typesByName} be the set of all types across all source schemas involved in the
schema composition by their given type name.
- Given each pair of types {typeA} and {typeB} in {typesByName}
- {typeA} and {typeB} must have the same kind

**Explanatory Text**

The GraphQL Composite Schemas specification considers types with the same name
across source schemas as semantically equivalent and mergeable. Types that do
not share the same kind are considered non-mergeable.

```graphql example
type User {
id: ID!
name: String!
displayName: String!
birthdate: String!
}

type User {
id: ID!
name: String!
reviews: [Review!]
}
```

```graphql example
scalar DateTime

scalar DateTime
```

```graphql counter-example
type User {
id: ID!
name: String!
displayName: String!
birthdate: String!
}

scalar User
```

```graphql counter-example
enum UserKind {
A
B
C
}

scalar UserKind
```

### Merge

### Post Merge Validation
Expand Down
Loading