From 3e2e09aa4c50fd1ef7c1c9472a825c3936218891 Mon Sep 17 00:00:00 2001 From: PascalSenn Date: Sun, 4 Aug 2024 17:30:05 +0200 Subject: [PATCH 1/6] Adds Non Null Input fields cannot be inaccessible --- spec/Section 4 -- Composition.md | 71 ++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) diff --git a/spec/Section 4 -- Composition.md b/spec/Section 4 -- Composition.md index 35d3b72..9c71c84 100644 --- a/spec/Section 4 -- Composition.md +++ b/spec/Section 4 -- Composition.md @@ -18,4 +18,75 @@ run in sequence to produce the composite execution schema. ### Post Merge Validation +#### Non-Null Input Fields cannot be Inaccessible + +**Error Code** + +NON_NULL_INPUT_FIELD_IS_INACCESSIBLE + +**Formal Specification** + +- Let {fields} be the set of all fields of the input types +- For each {field} in {fields}: + - If {field} is a non-null input field: + - {field} must not be declared as `@inaccessible` + - Let {namedType} be the named type that {field} references + - {namedType} must not be declared as `@inaccessible` + +**Explanatory Text** + +In a composed schema, a field within a input type must only reference types that are exposed. This requirement guarantees that public types do not reference inaccessible structures which are intended for internal use. + +A valid case where a public input field references another public input type: + +```graphql example +input Input1 { + field1: String! + field2: Input2 +} + +input Input2 { + field3: String +} +``` + +Another valid case is where the field is not exposed in the composed schema: + +```graphql example +input Input1 { + field1: String! + field2: Input2 @inaccessible +} + +input Input2 @inaccessible { + field3: String +} +``` + +An invalid case is when a non-null input field is inaccessible: + +```graphql counter-example +input Input1 { + field1: String! @inaccessible + field2: Input2 +} + +input Input2 { + field3: String +} +``` + +Another invalid case is when a non-null input field references an inaccessible type: + +```graphql counter-example +input Input1 { + field1: String! + field2: Input2! +} + +input Input2 @inaccessible { + field3: String +} +``` + ## Validate Satisfiability From ddd252ab360fd43436512c7ac169f653dd01cb65 Mon Sep 17 00:00:00 2001 From: PascalSenn Date: Sun, 4 Aug 2024 19:46:53 +0200 Subject: [PATCH 2/6] Split rules --- spec/Section 4 -- Composition.md | 54 +++++++++++++++++++++++++++++--- 1 file changed, 49 insertions(+), 5 deletions(-) diff --git a/spec/Section 4 -- Composition.md b/spec/Section 4 -- Composition.md index 9c71c84..2d8ad22 100644 --- a/spec/Section 4 -- Composition.md +++ b/spec/Section 4 -- Composition.md @@ -18,7 +18,7 @@ run in sequence to produce the composite execution schema. ### Post Merge Validation -#### Non-Null Input Fields cannot be Inaccessible +#### Non-Null Input Fields cannot be inaccessible **Error Code** @@ -30,12 +30,11 @@ NON_NULL_INPUT_FIELD_IS_INACCESSIBLE - For each {field} in {fields}: - If {field} is a non-null input field: - {field} must not be declared as `@inaccessible` - - Let {namedType} be the named type that {field} references - - {namedType} must not be declared as `@inaccessible` **Explanatory Text** -In a composed schema, a field within a input type must only reference types that are exposed. This requirement guarantees that public types do not reference inaccessible structures which are intended for internal use. +In a composed schema, a non-null input field must not be inaccessible. +Otherwise, the field would be required to have a value, but the user would not be able to provide one. A valid case where a public input field references another public input type: @@ -76,7 +75,51 @@ input Input2 { } ``` -Another invalid case is when a non-null input field references an inaccessible type: +#### Input Fields cannot reference be inaccessible type + +**Error Code** + +INPUT_FIELD_REFERENCES_INACCESSIBLE_TYPE + +**Formal Specification** + +- Let {fields} be the set of all fields of the input types +- For each {field} in {fields}: + - Let {namedType} be the named type that {field} references + - {namedType} must not be declared as `@inaccessible` + +**Explanatory Text** + +In a composed schema, a field within a input type must only reference types that are exposed. +This requirement guarantees that public types do not reference inaccessible structures which are intended for internal use. + +A valid case where a public input field references another public input type: + +```graphql example +input Input1 { + field1: String! + field2: Input2 +} + +input Input2 { + field3: String +} +``` + +Another valid case is where the field is not exposed in the composed schema: + +```graphql example +input Input1 { + field1: String! + field2: Input2 @inaccessible +} + +input Input2 @inaccessible { + field3: String +} +``` + +An invalid case is when an input field references an inaccessible type: ```graphql counter-example input Input1 { @@ -89,4 +132,5 @@ input Input2 @inaccessible { } ``` + ## Validate Satisfiability From aae8833fd4179a870ce333f31e9a056e2fbba128 Mon Sep 17 00:00:00 2001 From: PascalSenn Date: Sun, 4 Aug 2024 20:30:46 +0200 Subject: [PATCH 3/6] Update spec/Section 4 -- Composition.md Co-authored-by: Glen --- spec/Section 4 -- Composition.md | 1 - 1 file changed, 1 deletion(-) diff --git a/spec/Section 4 -- Composition.md b/spec/Section 4 -- Composition.md index 2d8ad22..a6f8002 100644 --- a/spec/Section 4 -- Composition.md +++ b/spec/Section 4 -- Composition.md @@ -132,5 +132,4 @@ input Input2 @inaccessible { } ``` - ## Validate Satisfiability From c8b00c14d67cdbac96861ff4ed101bd27b702ada Mon Sep 17 00:00:00 2001 From: PascalSenn Date: Sun, 4 Aug 2024 20:30:51 +0200 Subject: [PATCH 4/6] Update spec/Section 4 -- Composition.md Co-authored-by: Glen --- spec/Section 4 -- Composition.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/Section 4 -- Composition.md b/spec/Section 4 -- Composition.md index a6f8002..89b03da 100644 --- a/spec/Section 4 -- Composition.md +++ b/spec/Section 4 -- Composition.md @@ -90,7 +90,7 @@ INPUT_FIELD_REFERENCES_INACCESSIBLE_TYPE **Explanatory Text** -In a composed schema, a field within a input type must only reference types that are exposed. +In a composed schema, a field within an input type must only reference types that are exposed. This requirement guarantees that public types do not reference inaccessible structures which are intended for internal use. A valid case where a public input field references another public input type: From 402ba8cea2fa891c1f4145a9ab67e18fc1d5d78f Mon Sep 17 00:00:00 2001 From: PascalSenn Date: Sun, 4 Aug 2024 20:30:59 +0200 Subject: [PATCH 5/6] Update spec/Section 4 -- Composition.md Co-authored-by: Glen --- spec/Section 4 -- Composition.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/Section 4 -- Composition.md b/spec/Section 4 -- Composition.md index 89b03da..3c9ec78 100644 --- a/spec/Section 4 -- Composition.md +++ b/spec/Section 4 -- Composition.md @@ -75,7 +75,7 @@ input Input2 { } ``` -#### Input Fields cannot reference be inaccessible type +#### Input Fields cannot reference inaccessible type **Error Code** From 2a33cd6acdee903a67c88c7f1939341f8ccf9796 Mon Sep 17 00:00:00 2001 From: PascalSenn Date: Thu, 7 Nov 2024 14:06:21 +0100 Subject: [PATCH 6/6] Cleanup rule --- spec/Section 4 -- Composition.md | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/spec/Section 4 -- Composition.md b/spec/Section 4 -- Composition.md index 3c9ec78..a69725e 100644 --- a/spec/Section 4 -- Composition.md +++ b/spec/Section 4 -- Composition.md @@ -18,7 +18,7 @@ run in sequence to produce the composite execution schema. ### Post Merge Validation -#### Non-Null Input Fields cannot be inaccessible +#### Non-Null Input Fields cannot be inaccessible **Error Code** @@ -33,8 +33,9 @@ NON_NULL_INPUT_FIELD_IS_INACCESSIBLE **Explanatory Text** -In a composed schema, a non-null input field must not be inaccessible. -Otherwise, the field would be required to have a value, but the user would not be able to provide one. +In a composed schema, a non-null input field must always be accessible. If it is +not, the field would require a value, yet the user would be unable to supply +one. A valid case where a public input field references another public input type: @@ -53,7 +54,7 @@ Another valid case is where the field is not exposed in the composed schema: ```graphql example input Input1 { - field1: String! + field1: String! field2: Input2 @inaccessible } @@ -85,13 +86,15 @@ INPUT_FIELD_REFERENCES_INACCESSIBLE_TYPE - Let {fields} be the set of all fields of the input types - For each {field} in {fields}: - - Let {namedType} be the named type that {field} references - - {namedType} must not be declared as `@inaccessible` + - If {field} is not declared as `@inaccessible` + - Let {namedType} be the named type that {field} references + - {namedType} must not be declared as `@inaccessible` **Explanatory Text** -In a composed schema, a field within an input type must only reference types that are exposed. -This requirement guarantees that public types do not reference inaccessible structures which are intended for internal use. +In a composed schema, a field within an input type must only reference types +that are exposed. This requirement guarantees that public types do not reference +inaccessible structures which are intended for internal use. A valid case where a public input field references another public input type: @@ -110,7 +113,7 @@ Another valid case is where the field is not exposed in the composed schema: ```graphql example input Input1 { - field1: String! + field1: String! field2: Input2 @inaccessible }