From 8dd5fbe0124f6c68aaeb40096ae49b1e972a400f Mon Sep 17 00:00:00 2001 From: PascalSenn Date: Thu, 7 Nov 2024 13:06:45 +0100 Subject: [PATCH] pse/fixed empty object type (#58) --- spec/Section 4 -- Composition.md | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/spec/Section 4 -- Composition.md b/spec/Section 4 -- Composition.md index 431d837..6b6232c 100644 --- a/spec/Section 4 -- Composition.md +++ b/spec/Section 4 -- Composition.md @@ -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** @@ -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 @@ -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