djv
djv copied to clipboard
Stack overflow error
Test case
var djv = require("djv") var env = djv(); env.addSchema('test', { "$schema": "http://json-schema.org/schema#", "title": "Aspect capturing a complete representation of a distribution according to Project Open Data (data.json).", "type": "object", "allOf": [ { "$ref": "https://project-open-data.cio.gov/v1.1/schema/distribution.json" } ] }) env.validate('test#', { "@type": "dcat:Distribution", "downloadURL": "dataset-url/dataset.csv", "mediaType": "text/csv" });
undefined:23
}, f3 = function f0(data) {
^
RangeError: Maximum call stack size exceeded
at f0 (eval at restore (/djv/lib/utils/template.js:124:15), <anonymous>:23:24)
at f0 (eval at restore (/djv/lib/utils/template.js:124:15), <anonymous>:16:5)
at f0 (eval at restore (/djv/lib/utils/template.js:124:15), <anonymous>:30:9)
at f0 (eval at restore (/djv/lib/utils/template.js:124:15), <anonymous>:16:5)
at f0 (eval at restore (/djv/lib/utils/template.js:124:15), <anonymous>:30:9)
at f0 (eval at restore (/djv/lib/utils/template.js:124:15), <anonymous>:16:5)
at f0 (eval at restore (/djv/lib/utils/template.js:124:15), <anonymous>:30:9)
at f0 (eval at restore (/djv/lib/utils/template.js:124:15), <anonymous>:16:5)
at f0 (eval at restore (/djv/lib/utils/template.js:124:15), <anonymous>:30:9)
at f0 (eval at restore (/djv/lib/utils/template.js:124:15), <anonymous>:16:5)
@nahidakbar I've added 2 tests for the failing case
https://github.com/korzio/djv/blob/issues-71-exceed-maximum-call-stack/test/issues/71.js#L21
-
should throw reference error when schema is not found, should not exceed maximum call stack
Checks if the correct error is thrown when validator cannot find a schema. The validator is not responsive for downloadштп remote schema. User should add schema to the validator's environment himself. The error type is not final, can be changed during development.
-
should resolve local existing reference
Checks if an instance is validated correctly against the existing local schema
Please comment if you have any objections or additional thoughts, thanks!