Skip to content

fix nullable nested list variable coercion#439

Merged
StevenACoffman merged 1 commit into
vektah:masterfrom
jbellenger:codex/fix-null-nested-list-coercion
Jun 19, 2026
Merged

fix nullable nested list variable coercion#439
StevenACoffman merged 1 commit into
vektah:masterfrom
jbellenger:codex/fix-null-nested-list-coercion

Conversation

@jbellenger

@jbellenger jbellenger commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

Hello again! I'm the maintainer of graphql-conformance, which verifies spec conformance across the GraphQL ecosystem.

I noticed that gqlgen had a test failure that appears to originate in gqlparser.

The issue is that gqlparser does not handle valid null values when coercing nested lists.

For example, given this valid value for a type like [[InputType!]]:

[
  [{ "name": "foo" }],
  null
]

The second element is a nullable inner list. gqlparser currently unwraps that null into an invalid reflect.Value, then panics when it tries to inspect the value's type:

reflect: call of reflect.Value.Type on zero Value

This PR fixes this by checking whether a reflected value represents null before trying to coerce it as a list or inspect its type. If the GraphQL type is nullable, the value is accepted; otherwise gqlparser returns the normal cannot be null validation error.

I have:

  • Added tests covering the bug / feature
  • Updated any relevant documentation

@coveralls

Copy link
Copy Markdown

Coverage Status

coverage: 87.341% (-0.03%) from 87.371% — jbellenger:codex/fix-null-nested-list-coercion into vektah:master

@jbellenger jbellenger changed the title Fix nullable nested list variable coercion fix nullable nested list variable coercion Jun 17, 2026
@jbellenger jbellenger marked this pull request as ready for review June 17, 2026 21:49
@StevenACoffman

Copy link
Copy Markdown
Collaborator

Oh! Thank you so much! I can't tell you how much I appreciate you circling back here and not only reporting issues, not only fixing issues, but ADDING TESTS to prevent regressions.

I would give you a hug, but my arms are not long enough to reach from Ann Arbor, MI to Oakland, CA.

@StevenACoffman StevenACoffman merged commit e3a8d38 into vektah:master Jun 19, 2026
6 checks passed
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.

3 participants