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 empty merged input object type to composition #44

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
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
45 changes: 45 additions & 0 deletions spec/Section 4 -- Composition.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,49 @@ run in sequence to produce the composite execution schema.

### Post Merge Validation

#### Empty Merged Input Object Type

**Error Code**

INPUT_OBJECT_TYPE_EMPTY

**Formal Specification**

- Let {inputs} be the set of all input object in the merged schema
PascalSenn marked this conversation as resolved.
Show resolved Hide resolved
- For each {input} in {inputs}:
- {IsInputObjectTypeEmpty(input)} must be false

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO: Exlude required fields

IsInputObjectTypeEmpty(input):

- Let {fields} be a set of all input fields of {input}
- For each {field} in {fields}:
- If {field} is not flagged as `@inaccessible`:
- return false
- return true

**Explanatory Text**

When an input object type is defined in multiple source schemas, fields flagged as `@inaccessible` are not included in the merged input object type.
If this process results in an input object type with no fields, the input object type is considered empty and invalid.

In the following example, the merged input object type `Input1` is valid.

```graphql
input Input1 {
field1: String @inaccessible
field2: Int
}
```

This counter-example shows an invalid merged input object type.
The `Input1` type is defined in two source schemas, but both `field1` and `field2` are flagged as
`@inaccessible` in at least on of the schemas:
PascalSenn marked this conversation as resolved.
Show resolved Hide resolved

```graphql counter-example
input Input1 {
field1: String @inaccessible
field2: Int @inaccessible
}
```

## Validate Satisfiability