Skip to content

fix: accept empty lists for non-null list items#1600

Merged
devsergiy merged 1 commit into
masterfrom
jens/eng-9882-string-cannot-represent-value
Jul 17, 2026
Merged

fix: accept empty lists for non-null list items#1600
devsergiy merged 1 commit into
masterfrom
jens/eng-9882-string-cannot-represent-value

Conversation

@jensneuse

Copy link
Copy Markdown
Member

Summary

  • Accept empty list defaults for GraphQL list types with non-null items in operation-level validation.
  • Preserve validation of invalid non-empty list elements.
  • Add regression coverage for [] defaults and invalid enum-list defaults.

Links

Verification

  • go test ./pkg/astvalidation/reference/testsgo -run "^TestValuesOfCorrectTypeRule$" -count=1
  • go test ./... from v2
  • Cosmo staged regression and race test passed against this fixed local module revision.

@jensneuse
jensneuse requested a review from a team as a code owner July 17, 2026 18:54
@coderabbitai

coderabbitai Bot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 18f4bdd3-2c46-4bc5-92e9-2c08df7341cd

📥 Commits

Reviewing files that changed from the base of the PR and between bbb3db1 and 65cb1cf.

📒 Files selected for processing (2)
  • v2/pkg/astvalidation/operation_rule_values.go
  • v2/pkg/astvalidation/reference/testsgo/ValuesOfCorrectTypeRule_test.go

📝 Walkthrough

Walkthrough

Empty lists with non-null item types are now accepted during operation value validation. Reference tests add valid scalar and empty-list variable defaults, and verify enum errors for invalid list defaults.

Changes

List value validation

Layer / File(s) Summary
Accept empty non-null-item lists
v2/pkg/astvalidation/operation_rule_values.go
valueSatisfiesOperationListType returns true for empty lists when the item type is non-null.
Expand variable default tests
v2/pkg/astvalidation/reference/testsgo/ValuesOfCorrectTypeRule_test.go
Valid defaults include Int! and empty [String!] values; invalid defaults include an unknown DogCommand enum value and its expected validation error.

Estimated code review effort: 2 (Simple) | ~10 minutes

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title concisely matches the main change: accepting empty lists for non-null list items.
Description check ✅ Passed The description matches the code changes and test additions, including empty-list defaults and enum-list validation.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch jens/eng-9882-string-cannot-represent-value

Comment @coderabbitai help to get the list of available commands.

@devsergiy
devsergiy merged commit bd86537 into master Jul 17, 2026
10 checks passed
@devsergiy
devsergiy deleted the jens/eng-9882-string-cannot-represent-value branch July 17, 2026 19:03
devsergiy pushed a commit that referenced this pull request Jul 17, 2026
🤖 I have created a release *beep* *boop*
---


##
[2.13.2](v2.13.1...v2.13.2)
(2026-07-17)


### Bug Fixes

* accept empty lists for non-null list items
([#1600](#1600))
([bd86537](bd86537))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: wundergraph-bot[bot] <285992168+wundergraph-bot[bot]@users.noreply.github.com>
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.

2 participants