From 7fe1b5adb845eeb465bf0d5e77cd1a2da94508f0 Mon Sep 17 00:00:00 2001 From: Benjie Gillam Date: Thu, 17 Oct 2024 10:27:02 +0100 Subject: [PATCH 1/5] Clarify 'Values of Correct Type' rule does not apply to variables. --- spec/Section 5 -- Validation.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/spec/Section 5 -- Validation.md b/spec/Section 5 -- Validation.md index 75af96ffd..4f7f93ba7 100644 --- a/spec/Section 5 -- Validation.md +++ b/spec/Section 5 -- Validation.md @@ -1303,14 +1303,16 @@ fragment resourceFragment on Resource { **Formal Specification** -- For each input Value {value} in the document: +- For each literal input Value {value} in the document: - Let {type} be the type expected in the position {value} is found. - {value} must be coercible to {type}. **Explanatory Text** Literal values must be compatible with the type expected in the position they -are found as per the coercion rules defined in the Type System chapter. +are found as per the coercion rules defined in the Type System chapter. Variable +values are handled by the rule +[All Variable Usages Are Allowed](#sec-All-Variable-Usages-Are-Allowed). The type expected in a position includes the type defined by the argument a value is provided for, the type defined by an input object field a value is From 7d8679968a2809843dce3334c52db803a4260d2e Mon Sep 17 00:00:00 2001 From: Benjie Gillam Date: Thu, 17 Oct 2024 11:07:33 +0100 Subject: [PATCH 2/5] Clarify nested variable usages in Values of Correct Type --- spec/Section 5 -- Validation.md | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/spec/Section 5 -- Validation.md b/spec/Section 5 -- Validation.md index 4f7f93ba7..e6f027aab 100644 --- a/spec/Section 5 -- Validation.md +++ b/spec/Section 5 -- Validation.md @@ -1303,9 +1303,11 @@ fragment resourceFragment on Resource { **Formal Specification** -- For each literal input Value {value} in the document: +- For each literal Input Value {value} in the document: - Let {type} be the type expected in the position {value} is found. - - {value} must be coercible to {type}. + - {value} must be coercible to {type} (with the assumption that any + {variableUsage} nested within {value} will represent a runtime value of the + referenced variable's type). **Explanatory Text** @@ -1313,6 +1315,11 @@ Literal values must be compatible with the type expected in the position they are found as per the coercion rules defined in the Type System chapter. Variable values are handled by the rule [All Variable Usages Are Allowed](#sec-All-Variable-Usages-Are-Allowed). +{ListValue} and {ObjectValue} may nest additional Input Values, some of which +may be a {variableUsage}. Each nested {variableUsage} will be coerced during +execution - see [Coercing Variable Values](#sec-Coercing-Variable-Values) - thus +we assume their runtime value will coerce to the type of the referenced +variable. The type expected in a position includes the type defined by the argument a value is provided for, the type defined by an input object field a value is From 560a9cb5f19c841eabf7910c50c62d20dabf5a41 Mon Sep 17 00:00:00 2001 From: Benjie Gillam Date: Thu, 12 Dec 2024 11:54:45 +0000 Subject: [PATCH 3/5] Change from referenced variable's type to suitable usage in its position --- spec/Section 5 -- Validation.md | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/spec/Section 5 -- Validation.md b/spec/Section 5 -- Validation.md index e6f027aab..580f291ce 100644 --- a/spec/Section 5 -- Validation.md +++ b/spec/Section 5 -- Validation.md @@ -1306,20 +1306,22 @@ fragment resourceFragment on Resource { - For each literal Input Value {value} in the document: - Let {type} be the type expected in the position {value} is found. - {value} must be coercible to {type} (with the assumption that any - {variableUsage} nested within {value} will represent a runtime value of the - referenced variable's type). + {variableUsage} nested within {value} will represent a runtime value + suitable for usage in its position). **Explanatory Text** Literal values must be compatible with the type expected in the position they -are found as per the coercion rules defined in the Type System chapter. Variable -values are handled by the rule -[All Variable Usages Are Allowed](#sec-All-Variable-Usages-Are-Allowed). -{ListValue} and {ObjectValue} may nest additional Input Values, some of which -may be a {variableUsage}. Each nested {variableUsage} will be coerced during -execution - see [Coercing Variable Values](#sec-Coercing-Variable-Values) - thus -we assume their runtime value will coerce to the type of the referenced -variable. +are found as per the coercion rules defined in the Type System chapter. + +A {ListValue} or {ObjectValue} may nest additional Input Values, some of which +may be a {variableUsage}. The +[All Variable Usages Are Allowed](#sec-All-Variable-Usages-Are-Allowed) +validation rule asserts that each {variableUsage} is of a type allowed in that +position, and the [Coercing Variable Values](#sec-Coercing-Variable-Values) +algorithm will ensure runtime values of these variables coerce correctly, thus +we can assume the runtime value of each {variableUsage} will be suitable for +usage in its position. The type expected in a position includes the type defined by the argument a value is provided for, the type defined by an input object field a value is From ee80b368d7aeed25f724ee4570a7c6a3611444a2 Mon Sep 17 00:00:00 2001 From: Benjie Gillam Date: Thu, 12 Dec 2024 12:04:09 +0000 Subject: [PATCH 4/5] Further editing --- spec/Section 5 -- Validation.md | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/spec/Section 5 -- Validation.md b/spec/Section 5 -- Validation.md index 580f291ce..6647a3bab 100644 --- a/spec/Section 5 -- Validation.md +++ b/spec/Section 5 -- Validation.md @@ -1306,22 +1306,22 @@ fragment resourceFragment on Resource { - For each literal Input Value {value} in the document: - Let {type} be the type expected in the position {value} is found. - {value} must be coercible to {type} (with the assumption that any - {variableUsage} nested within {value} will represent a runtime value - suitable for usage in its position). + {variableUsage} nested within {value} will represent a runtime value valid + for usage in its position). **Explanatory Text** Literal values must be compatible with the type expected in the position they are found as per the coercion rules defined in the Type System chapter. -A {ListValue} or {ObjectValue} may nest additional Input Values, some of which -may be a {variableUsage}. The +Note: A {ListValue} or {ObjectValue} may contain nested Input Values, some of +which may be a variable usage. The [All Variable Usages Are Allowed](#sec-All-Variable-Usages-Are-Allowed) -validation rule asserts that each {variableUsage} is of a type allowed in that -position, and the [Coercing Variable Values](#sec-Coercing-Variable-Values) -algorithm will ensure runtime values of these variables coerce correctly, thus -we can assume the runtime value of each {variableUsage} will be suitable for -usage in its position. +validation rule ensures that each {variableUsage} is of a type allowed in its +position. The [Coercing Variable Values](#sec-Coercing-Variable-Values) +algorithm ensures runtime values for variables coerce correctly. Therefore we +can assume the runtime value of each {variableUsage} is valid for usage in its +position. The type expected in a position includes the type defined by the argument a value is provided for, the type defined by an input object field a value is From daf28a25984ba1dd43c8f12250b0d8491d55e6ea Mon Sep 17 00:00:00 2001 From: Benjie Gillam Date: Thu, 12 Dec 2024 12:25:03 +0000 Subject: [PATCH 5/5] The assumption is only valid locally. --- spec/Section 5 -- Validation.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/spec/Section 5 -- Validation.md b/spec/Section 5 -- Validation.md index 6647a3bab..33a7d7721 100644 --- a/spec/Section 5 -- Validation.md +++ b/spec/Section 5 -- Validation.md @@ -1319,8 +1319,9 @@ which may be a variable usage. The [All Variable Usages Are Allowed](#sec-All-Variable-Usages-Are-Allowed) validation rule ensures that each {variableUsage} is of a type allowed in its position. The [Coercing Variable Values](#sec-Coercing-Variable-Values) -algorithm ensures runtime values for variables coerce correctly. Therefore we -can assume the runtime value of each {variableUsage} is valid for usage in its +algorithm ensures runtime values for variables coerce correctly. Therefore, for +the purposes of the coercibility assertion in this validation rule, we can +assume the runtime value of each {variableUsage} is valid for usage in its position. The type expected in a position includes the type defined by the argument a