feat(validation): Add circular type dependency check #640
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.js
to detect cycles within thediagram.types
graph.circular_type_dependency
inen.js
.Validation/Testing:
Created two custom types,
type_A
andtype_B
.type_A
has a field referencingTYPE_B
.type_B
has 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."
