Skip to content

Commit

Permalink
pse/fixed empty object type (#58)
Browse files Browse the repository at this point in the history
  • Loading branch information
PascalSenn authored Nov 7, 2024
1 parent eb1433c commit 8dd5fbe
Showing 1 changed file with 21 additions and 3 deletions.
24 changes: 21 additions & 3 deletions spec/Section 4 -- Composition.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ run in sequence to produce the composite execution schema.

**Error Code**

`Empty_Merged_Object_Type`
`EMPTY_MERGED_OBJECT_TYPE`

**Severity** ERROR

**Formal Specification**

Expand All @@ -32,8 +34,9 @@ run in sequence to produce the composite execution schema.

IsObjectTypeEmpty(type):

- Let {fields} be a set of all fields of all types with coordinate and kind
{type} across all source schemas
- If {type} has `@inaccessible` directive
- return false
- Let {fields} be a set of all fields in {type}
- For each {field} in {fields}:
- If {IsExposed(field)} is true
- return false
Expand Down Expand Up @@ -63,6 +66,21 @@ type ObjectType1 {
}
```

If the `@inaccessible` directive is applied to an object type itself, the entire
merged object type is excluded from the composite execution schema, and it is
not required to contain any fields.

```graphql
type ObjectType1 @inaccessible {
field1: String
field2: Int
}

type ObjectType1 {
field3: Boolean
}
```

This counter-example demonstrates an invalid merged object type. In this case,
`ObjectType1` is defined in two source schemas, but all fields are marked as
`@inaccessible` in at least one of the source schemas, resulting in an empty
Expand Down

0 comments on commit 8dd5fbe

Please sign in to comment.