Fix type collecting for indirect references by andimarek · Pull Request #4213 · graphql-java/graphql-java · GitHub
Skip to content

Fix type collecting for indirect references #4213

Merged
andimarek merged 1 commit intomasterfrom
type-collecting-indirect-fix
Jan 22, 2026
Merged

Fix type collecting for indirect references #4213
andimarek merged 1 commit intomasterfrom
type-collecting-indirect-fix

Conversation

@andimarek
Copy link
Copy Markdown
Member

Fix GraphQLTypeCollectingVisitor to traverse children of indirect strong references

The fixDanglingReplacedTypes method now recursively traverses types discovered through indirect strong references (types referenced via replaced type references). Previously, when an indirect strong reference was found, it was added to the result but its children were not traversed, causing types referenced by the indirect reference to be missing from the schema.

The fix:

  • For each newly discovered indirect strong reference, start a new traversal
  • Reuse the same visitor instance to ensure duplicate type detection works
  • Clear indirectStrongReferences before each traversal to capture new ones
  • Recursively call fixDanglingReplacedTypes to handle nested indirect references

Added tests:

  • indirect type references should have their children collected
  • nested indirect type references requiring multiple traversals
  • redefined types are caught when introduced during transformation

…ong references

The fixDanglingReplacedTypes method now recursively traverses types discovered
through indirect strong references (types referenced via replaced type references).
Previously, when an indirect strong reference was found, it was added to the result
but its children were not traversed, causing types referenced by the indirect
reference to be missing from the schema.

The fix:
- For each newly discovered indirect strong reference, start a new traversal
- Reuse the same visitor instance to ensure duplicate type detection works
- Clear indirectStrongReferences before each traversal to capture new ones
- Recursively call fixDanglingReplacedTypes to handle nested indirect references

Added tests:
- indirect type references should have their children collected
- nested indirect type references requiring multiple traversals
- redefined types are caught when introduced during transformation
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jan 22, 2026

@andimarek andimarek merged commit 6c2cdb0 into master Jan 22, 2026
7 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.

1 participant