-
-
Notifications
You must be signed in to change notification settings - Fork 883
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
default values - RangeError: Maximum call stack size exceeded #802
Comments
note: I see now that |
@fogine ajv indeed doesn't support schemas with recursive data structures - they need to be serialisable (unless you disable it, as you wrote, but they would still be used as keys - so unless you use WeakMap as a cache, nothing will work). I will release json-schema-traverse. |
@epoberezkin
Is it theoretically possible to change that? Пожалуйста? |
Only theoretically, I am afraid... The cost would be prohibitive - it's a major design change. Effectively, what you are asking is to detect cycles and translate them to $refs - this is a more complex operation than avoiding cycles in the first place... It does seem though like some separate library could possibly do ref-ing, in the same way there is a library that does de-ref-ing, which means it doesn't need to be done as part of Ajv - it can be defined and solved as a relatively isolated CS problem on the level of tech interview questions... |
What version of Ajv are you using? Does the issue happen if you use the latest version?
6.5.0
Ajv options object
JSON Schema
Your code
Validation result, data AFTER validation, error messages
What results did you expect?
When
useDefaults=false
I'd expect thatajv
is gonna ignoredefault
keyword and not traverse its enumerable properties.Although it should not fail even with
useDefaults=true
when the default value object implementstoJSON
method.Are you going to resolve the issue?
possible bugfix provided here:
epoberezkin/json-schema-traverse#5
In ajv library, used here:
https://github.com/epoberezkin/ajv/blob/master/lib/compile/resolve.js#L239
The text was updated successfully, but these errors were encountered: