z-schema 3.25.0 → 3.25.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/ZSchema-browser.js
CHANGED
|
@@ -7490,10 +7490,14 @@ var JsonValidators = {
|
|
|
7490
7490
|
var formatValidatorFn = FormatValidators[schema.format];
|
|
7491
7491
|
if (typeof formatValidatorFn === "function") {
|
|
7492
7492
|
if (formatValidatorFn.length === 2) {
|
|
7493
|
-
// async
|
|
7493
|
+
// async - need to clone the path here, because it will change by the time async function reports back
|
|
7494
|
+
var pathBeforeAsync = Utils.clone(report.path);
|
|
7494
7495
|
report.addAsyncTask(formatValidatorFn, [json], function (result) {
|
|
7495
7496
|
if (result !== true) {
|
|
7497
|
+
var backup = report.path;
|
|
7498
|
+
report.path = pathBeforeAsync;
|
|
7496
7499
|
report.addError("INVALID_FORMAT", [schema.format, json], null, schema);
|
|
7500
|
+
report.path = backup;
|
|
7497
7501
|
}
|
|
7498
7502
|
});
|
|
7499
7503
|
} else {
|
|
@@ -7603,10 +7607,7 @@ var recurseObject = function (report, schema, json) {
|
|
|
7603
7607
|
while (idx2--) {
|
|
7604
7608
|
report.path.push(m);
|
|
7605
7609
|
exports.validate.call(this, report, s[idx2], propertyValue);
|
|
7606
|
-
|
|
7607
|
-
// commented out to resolve issue #209 - the path gets popped before async tasks complete
|
|
7608
|
-
// all the tests run fine without, there seems to be no reason to have this pop here
|
|
7609
|
-
// report.path.pop();
|
|
7610
|
+
report.path.pop();
|
|
7610
7611
|
}
|
|
7611
7612
|
}
|
|
7612
7613
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "z-schema",
|
|
3
|
-
"version": "3.25.
|
|
3
|
+
"version": "3.25.1",
|
|
4
4
|
"description": "JSON schema validator",
|
|
5
5
|
"homepage": "https://github.com/zaggino/z-schema",
|
|
6
6
|
"authors": [
|
|
@@ -36,6 +36,7 @@
|
|
|
36
36
|
"prepare": "grunt",
|
|
37
37
|
"prepublishOnly": "npm test",
|
|
38
38
|
"test": "jasmine-node test/ && grunt lint",
|
|
39
|
+
"test-z": "jasmine-node test/spec/ZSchemaTestSuiteSpec.js",
|
|
39
40
|
"grunt": "grunt"
|
|
40
41
|
},
|
|
41
42
|
"testling": {
|
package/src/JsonValidation.js
CHANGED
|
@@ -340,10 +340,14 @@ var JsonValidators = {
|
|
|
340
340
|
var formatValidatorFn = FormatValidators[schema.format];
|
|
341
341
|
if (typeof formatValidatorFn === "function") {
|
|
342
342
|
if (formatValidatorFn.length === 2) {
|
|
343
|
-
// async
|
|
343
|
+
// async - need to clone the path here, because it will change by the time async function reports back
|
|
344
|
+
var pathBeforeAsync = Utils.clone(report.path);
|
|
344
345
|
report.addAsyncTask(formatValidatorFn, [json], function (result) {
|
|
345
346
|
if (result !== true) {
|
|
347
|
+
var backup = report.path;
|
|
348
|
+
report.path = pathBeforeAsync;
|
|
346
349
|
report.addError("INVALID_FORMAT", [schema.format, json], null, schema);
|
|
350
|
+
report.path = backup;
|
|
347
351
|
}
|
|
348
352
|
});
|
|
349
353
|
} else {
|
|
@@ -453,10 +457,7 @@ var recurseObject = function (report, schema, json) {
|
|
|
453
457
|
while (idx2--) {
|
|
454
458
|
report.path.push(m);
|
|
455
459
|
exports.validate.call(this, report, s[idx2], propertyValue);
|
|
456
|
-
|
|
457
|
-
// commented out to resolve issue #209 - the path gets popped before async tasks complete
|
|
458
|
-
// all the tests run fine without, there seems to be no reason to have this pop here
|
|
459
|
-
// report.path.pop();
|
|
460
|
+
report.path.pop();
|
|
460
461
|
}
|
|
461
462
|
}
|
|
462
463
|
};
|