Error `Maximum call stack size exceeded` when schema grows
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 1.5k
- Forks
- 228
- Avg merge
- 1d 14h
- Merged PRs (30d)
- 48
Description
Describe the bug
When the openapi specification grows and has a huge list that we need to distinguish between, I got the error Ajv error: Maximum call stack size exceeded while executing respect.
To Reproduce
- Using provided example run mock server and then run
redocly respect openapi.arazzo.yaml - Receive
Ajv error: Maximum call stack size exceeded
Expected behavior
Respect command executes successfully.
Logs
OpenAPI description
Provided archive.
Redocly version(s)
2.20.2
Node.js version(s)
24
OS, environment
macOs
Additional context
I investigated a little bit and when i comment discriminator: true in Ajv instance inside the file: packages/respect-core/src/modules/flow-runner/schema/schema-checker.ts i didn't receive an error.
One of our customer reported, that the error occurs when the number of enum values exceeds 126.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with packages/respect-core/src/modules/flow-runner/schema/schema-checker.ts and reproduce the failure with the provided call-stack-repro.zip, a mock server, and redocly respect openapi.arazzo.yaml. Compare behavior with discriminator: true enabled and disabled, focusing on specifications with more than 126 enum values. Done means the Respect command executes successfully for the reported large schema.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- api
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100