Skip to content

Fix list coercion, variable usage validation and argument defaults - #908

Open
hugo-vrijswijk wants to merge 1 commit into
mainfrom
fix/f8-single-value-list-coercion
Open

Fix list coercion, variable usage validation and argument defaults#908
hugo-vrijswijk wants to merge 1 commit into
mainfrom
fix/f8-single-value-list-coercion

Conversation

@hugo-vrijswijk

Copy link
Copy Markdown
Contributor

A non-list value is a valid input for a list type. Only literal lists were accepted, so arg: [String] rejected "foo" where the specification accepts it as ["foo"]. A single value is now wrapped, recursively for nested lists, and null is left unwrapped. Default values pass through the same coercion, so a supplied value and an equal default no longer produce different results.

A variable with no supplied value must fall back to the default of the location it fills. The default was applied to an absent argument only, not to an absent variable.

A variable was also never compared with the type of the location where it is used. Value coercion rejected some incompatible usages as a side effect, and single value coercion removes that side effect. Rule 5.8.5 is now implemented directly. It covers field arguments, directive arguments, list entries and input object fields, in the operation and in every fragment it can reach. The rule also depends on the default value fix above, so the two cases which allow a nullable variable at a non-null location are now observable end to end.

Five tests in SkipIncludeSuite and six in VariablesSuite declared a nullable variable at a non-null location. Those documents are invalid under rule 5.8.5, so the declarations are now non-null.

A non-list value is a valid input for a list type. Only literal lists were accepted, so `arg: [String]` rejected `"foo"` where the specification accepts it as `["foo"]`. A single value is now wrapped, recursively for nested lists, and `null` is left unwrapped. Default values pass through the same coercion, so a supplied value and an equal default no longer produce different results.

A variable with no supplied value must fall back to the default of the location it fills. The default was applied to an absent argument only, not to an absent variable.

A variable was also never compared with the type of the location where it is used. Value coercion rejected some incompatible usages as a side effect, and single value coercion removes that side effect. [Rule 5.8.5](https://spec.graphql.org/September2025/#sec-All-Variable-Usages-Are-Allowed) is now implemented directly. It covers field arguments, directive arguments, list entries and input object fields, in the operation and in every fragment it can reach. The rule also depends on the default value fix above, so the two cases which allow a nullable variable at a non-null location are now observable end to end.

Five tests in `SkipIncludeSuite` and six in `VariablesSuite` declared a nullable variable at a non-null location. Those documents are invalid under rule 5.8.5, so the declarations are now non-null.
@hugo-vrijswijk
hugo-vrijswijk force-pushed the fix/f8-single-value-list-coercion branch from ee477a3 to 1b17643 Compare August 21, 2026 15:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant