ajv-validator / ajv-validator/ajv-cli

error: Maximum call stack size exceeded with schemas having ~510 properties or more

Open
#134 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
316
Forks
77
PR merge metrics
No merged PRs in 30d

Description

I recently discovered that bigger generated schemas can easily produce a a `error: Maximum call stack size exceeded`, even when the checks are quite simple.
```
ajv -- validate --strict=false --errors=json -s f/ansible-playbook.json -d /Users/ssbarnea/c/a/schemas/examples/playbooks/run.yml
schema f/ansible-playbook.json is invalid
error: Maximum call stack size exceeded
```

Based on my initial tests 500 properties worked but 1000 generated this error, which is a very low number. My expectation that that I will likely need 10k in the end. I tested with 510 and job only one schema failing instead of both, with 550 both failed. Clearly the moment it starts to fail is just after 500.

I am not sure what is confusing the loader because in the end the entries are very simple.

Here is one file that has ~1000 entries https://sbarnea.com/ss/ansible-playbook.json and is only ~100kb, just removing some of the properties will make it pass.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.