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

@andimarek

…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