From 48fd9bfe8c3e482a886d6f134a197fc80f64be64 Mon Sep 17 00:00:00 2001 From: PascalSenn Date: Thu, 7 Nov 2024 13:05:11 +0100 Subject: [PATCH] Upgrade empty object type --- spec/Section 4 -- Composition.md | 32 +++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/spec/Section 4 -- Composition.md b/spec/Section 4 -- Composition.md index f6756b6..6b6232c 100644 --- a/spec/Section 4 -- Composition.md +++ b/spec/Section 4 -- Composition.md @@ -24,8 +24,7 @@ run in sequence to produce the composite execution schema. `EMPTY_MERGED_OBJECT_TYPE` -**Severity** -ERROR +**Severity** ERROR **Formal Specification** @@ -35,9 +34,9 @@ ERROR IsObjectTypeEmpty(type): -_ If {type} has `@inaccessible` directive - - return false -- Let {fields} be a set of all fields in {type} +- 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 @@ -45,12 +44,15 @@ _ If {type} has `@inaccessible` directive **Explanatory Text** -For object types defined across multiple source schemas, the merged object type is the superset of all fields defined in these source schemas. -However, any field marked with `@inaccessible` in any source schema is hidden and not included in the merged object type. -An object type with no fields, after considering `@inaccessible` annotations, is considered empty and invalid. +For object types defined across multiple source schemas, the merged object type +is the superset of all fields defined in these source schemas. However, any +field marked with `@inaccessible` in any source schema is hidden and not +included in the merged object type. An object type with no fields, after +considering `@inaccessible` annotations, is considered empty and invalid. -In the following example, the merged object type `ObjectType1` is valid. -It includes all fields from both source schemas, with `field2` being hidden due to the `@inaccessible` directive in one of the source schemas: +In the following example, the merged object type `ObjectType1` is valid. It +includes all fields from both source schemas, with `field2` being hidden due to +the `@inaccessible` directive in one of the source schemas: ```graphql type ObjectType1 { @@ -64,7 +66,9 @@ 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. +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 { @@ -77,8 +81,10 @@ type ObjectType1 { } ``` -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 merged object type: +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 +merged object type: ```graphql counter-example type ObjectType1 {