feat(validation): Add circular type dependency check #640
+66
−3
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem:
Users can create a circular dependency between custom types (e.g., Type A references Type B, and Type B references Type A). This structure is invalid and cannot be correctly generated in a schema but was not being flagged as an issue.
Furthermore, an initial attempt to implement this failed due to a case mismatch between how custom type names are defined (
type_a) and how they are referenced by fields (TYPE_A).Solution:
getIssues.jsto detect cycles within thediagram.typesgraph.circular_type_dependencyinen.js.Validation/Testing:
Created two custom types,
type_Aandtype_B.type_Ahas a field referencingTYPE_B.type_Bhas a field referencingTYPE_A.Expected Result (Achieved): The Issues panel now correctly displays "Issues (1)" and the message: "Circular type dependency detected in: type_A."
