-
-
Notifications
You must be signed in to change notification settings - Fork 886
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
"Maximum call stack size exceeded" when using compileAsync + circular references in some schemas #801
Comments
@Hirntoasted thank you. |
It does work though if properties that have non-recursive schemas are defined first (see runkit)... Not sure if it helps as a temp workaround in your case, needs to be fixed obviously. |
@Hirntoasted it's fixed in 6.5.1, please test with your real code. |
Works like a charm! Many thanks! |
Thanks. compileAsync should be optimised as all it does, it tries to compile, blows up, checks what missing schema caused it to blow up, loads it and tries again... It definitely can be better than this. |
Hi,
i'm working on a project where we want to validate json data based using various schema files that are interconnected via $refs.
My plan was to use compileAsync on a starting schema and load the referenced schemas by implementing a loadSchema function. However i run into
Maximum call stack size exceeded
errors when i execute the validation function.Below is a (hopefully) minimal example of the schema structure causing the error (see Your code for the full example) .
Some additional notes about this:
validate()
in the code example below) which seems to work, the error occured for me only when using compileAsync (seevalidateAsync()
)foo
andbar
form a circular referenceother
schema needs to be there to cause the error. Therefore i suspect that the circular reference itself is not the root causeother
reference can also be moved to thebar
schema for similar resultWhat version of Ajv are you using? Does the issue happen if you use the latest version?
6.5.0, yes
Ajv options object
JSON Schema
Sample data
Your code
Validation result, data AFTER validation, error messages
What results did you expect?
compile() and compileAsync() should provide the same result - no
call stack exceeded
error should occureAre you going to resolve the issue?
no sure - propably not...
The text was updated successfully, but these errors were encountered: