Skip to content

Backport 26.1: validate circular default values - #4450

Merged
andimarek merged 2 commits into
26.xfrom
codex/backport-4253-to-26.x
Aug 23, 2026
Merged

Backport 26.1: validate circular default values#4450
andimarek merged 2 commits into
26.xfrom
codex/backport-4253-to-26.x

Conversation

@andimarek

@andimarek andimarek commented Aug 20, 2026

Copy link
Copy Markdown
Member

Backport of #4253 to the 26.x maintenance branch.

Input object fields can define default values in ways that form cycles. For example:

input A { b: B = {} }
input B { a: A = {} }

The defaults form an infinitely expanding value. This PR implements the specification InputObjectDefaultValueHasCycle validation so these schemas are rejected during schema validation instead of overflowing while defaults are coerced.

Implementation notes:

  • Uses one shared traversal for literal and programmatic defaults.
  • Supports the same programmatic list representations as GraphQL Java coercion, including Java arrays.
  • Detects cycles before external argument and field defaults are coerced.
  • Creates fresh validation-rule instances for each schema-validation run.
  • Consolidates the SDL cases into data-driven tests and removes the duplicate integration test class.

This behavior matches the GraphQL specification and graphql-js v17 implementation:

* init

* improve spec alignment

* Avoid unnecessary circular default validation work

---------

Co-authored-by: Andreas Marek <andimarek@fastmail.fm>
@github-actions

github-actions Bot commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

Test Report

Test Results

Java Version Total Passed Failed Errors Skipped
Java 11 - - - - -
Java 17 - - - - -
Java 21 - - - - -
Java 25 - - - - -
jcstress - - - - -

Updated: 2026-08-23 22:52:01 UTC

@andimarek
andimarek merged commit 722262d into 26.x Aug 23, 2026
10 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.

2 participants