From 41382b0012f35dd37018a2257b0ab6fba369afaa Mon Sep 17 00:00:00 2001 From: Martin Bonnin Date: Wed, 2 Apr 2025 22:36:53 +0200 Subject: [PATCH] Exclude custom scalar literals from validation --- spec/Section 5 -- Validation.md | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/spec/Section 5 -- Validation.md b/spec/Section 5 -- Validation.md index 50b826c6e..5fc8add2f 100644 --- a/spec/Section 5 -- Validation.md +++ b/spec/Section 5 -- Validation.md @@ -1306,9 +1306,10 @@ 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 valid - for usage in its position). + - If {type} is not a custom scalar type: + - {value} must be coercible to {type} (with the assumption that any + {variableUsage} nested within {value} will represent a runtime value valid + for usage in its position). **Explanatory Text** @@ -1324,6 +1325,11 @@ algorithm ensures runtime values for variables coerce correctly. Therefore, for the purposes of the "coercible" assertion in this validation rule, we can assume the runtime value of each {variableUsage} is valid for usage in its position. +Note: Custom scalar coercion rules are not always available when validating a +document and custom scalar literal values are excluded from this validation. If +a custom scalar literal value cannot be coerced, it will raise an execution +error. + 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 provided for, and the type of a variable definition a default value is provided