Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clarify 'Values of Correct Type' rule relates to literals #1118

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
15 changes: 12 additions & 3 deletions spec/Section 5 -- Validation.md
Original file line number Diff line number Diff line change
Expand Up @@ -1303,14 +1303,23 @@ 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}.
- {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**

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).
{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
Expand Down
Loading