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 Output Field Types Mergable to Composition #38

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
101 changes: 101 additions & 0 deletions spec/Section 4 -- Composition.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,107 @@ run in sequence to produce the composite execution schema.

### Pre Merge Validation

#### Output Field Types Mergeable

**Error Code**

OUTPUT_FIELD_TYPES_NOT_MERGEABLE

**Severity**

ERROR

**Formal Specification**

- Let {typeNames} be the set of all output type names from all source schemas.
- For each {typeName} in {typeNames}
- Let {types} be the set of all types with the name {typeName} from all source
schemas.
- Let {fieldNames} be the set of all field names from all {types}.
- For each {fieldName} in {fieldNames}
- Let {fields} be the set of all fields with the name {fieldName} from all
{types}.
- {FieldsAreMergeable(fields)} must be true.

FieldsAreMergeable(fields):

- Given each pair of members {fieldA} and {fieldB} in {fields}:
- Let {typeA} be the type of {fieldA}
- Let {typeB} be the type of {fieldB}
- {SameOutputTypeShape(typeA, typeB)} must be true.

**Explanatory Text**

Fields on objects or interfaces that have the same name are considered
semantically equivalent and mergeable when they have a mergeable field type.

Fields with the same type are mergeable.

```graphql example
type User {
birthdate: String
}

type User {
birthdate: String
}
```

Fields with different nullability are mergeable, resulting in a merged field
with a nullable type.

```graphql example
type User {
birthdate: String!
}

type User {
birthdate: String
}
```

```graphql example
type User {
tags: [String!]
}

type User {
tags: [String]!
}

type User {
tags: [String]
}
```

Fields are not mergeable if the named types are different in kind or name.

```graphql counter-example
type User {
birthdate: String!
}

type User {
birthdate: DateTime!
}
```

```graphql counter-example
type User {
tags: [Tag]
}

type Tag {
value: String
}

type User {
tags: [Tag]
}

scalar Tag
```

### Merge

### Post Merge Validation
Expand Down
Loading