-
Notifications
You must be signed in to change notification settings - Fork 337
Description
Describe the bug
Issue Title
Internal compiler error: RangeError: Maximum call stack size exceeded on large cyclic relationships (58+ models)
Issue Description
Describe the bug I encountered an internal compiler error (RangeError: Maximum call stack size exceeded) when compiling TypeSpec models generated from a Prisma schema. The error occurs when a central model (e.g., tb_user,tb_center) has circular relationships with a large number of other models (over 58 relations).
To Reproduce
Create a TypeSpec file where one model has circular references to 58+ other models.
Run the TypeSpec compiler.
The compiler fails with a stack overflow error.
Current Workaround: To bypass this error, I implemented a threshold in my generation script: if a model exceeds 30 relationships, I automatically replace the specific model references with Record[] and use the @doc decorator to manually document the intended relation.
Reproduction
Playground Error: URI too long
My Typespec Code
https://anotepad.com/note/read/bq9bbwef
Checklist
- Follow our Code of Conduct
- Check that there isn't already an issue that request the same bug to avoid creating a duplicate.
- Check that this is a concrete bug. For Q&A open a GitHub Discussion.
- The provided reproduction is a minimal reproducible example of the bug.