feat(validation): Add circular type dependency check
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:
-
Implemented Circular Dependency Check: Added a Depth First Search (DFS) algorithm within
getIssues.jsto detect cycles within thediagram.typesgraph. -
Added Translation Key: Included the new translation key
circular_type_dependencyinen.js. - Fixed Casing Discrepancy (Name Normalization): Normalized all custom type names and references to uppercase within the DFS logic. This ensures the lookup works reliably regardless of the casing in the stored data, correctly identifying the circular reference.
Validation/Testing:
Created two custom types, type_A and type_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."
@22Yash is attempting to deploy a commit to the dottle's projects Team on Vercel.
A member of the Team first needs to authorize it.