Socket
Socket
Sign inDemoInstall

tv4

Package Overview
Dependencies
Maintainers
1
Versions
39
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tv4 - npm Package Compare versions

Comparing version 1.0.1 to 1.0.2

tests/tests/09 - Multiple errors/01 - validateMultiple.js

0

LICENSE.txt

@@ -0,0 +0,0 @@ Author: Geraint Luff and others

2

package.json
{
"name": "tv4",
"version": "1.0.1",
"version": "1.0.2",
"author": "Geraint Luff",

@@ -5,0 +5,0 @@ "description": "A public domain JSON Schema validator for JavaScript",

#Tiny Validator (for v4 JSON Schema)
All you need is ```tv4.js``` (19.7KB) or ```tv4.min.js``` (11.8KB, 3.51KB gzipped).
All you need is ```tv4.js``` (24KB) or ```tv4.min.js``` (12.9KB, 3.8KB gzipped).
There is support for `$ref` with JSON Pointer fragment paths (```other-schema.json#/properties/myKey```).
## Usage
## Usage 1:

@@ -34,3 +34,3 @@ ```javascript

## Multi-threaded validation
## Usage 2: Multi-threaded validation

@@ -52,2 +52,22 @@ Storing the error and missing schemas does not work well in multi-threaded environments, so there is an alternative syntax:

## Usage 3: Multiple errors
Normally, `tv4` stops when it encounters the first validation error. However, you can collect an array of validation errors using
```javascript
var result = tv4.validateMultiple(data, schema);
```
The result will look something like:
```json
{
"valid": false,
"errors": [
{...},
...
],
"missing": [...]
}
```
## Asynchronous validation

@@ -54,0 +74,0 @@

})((typeof module !== 'undefined' && module.exports) ? exports : this);

@@ -103,2 +103,15 @@ var ErrorCodes = {

},
validateMultiple: function (data, schema) {
var context = new ValidatorContext(globalContext, true);
if (typeof schema == "string") {
schema = {"$ref": schema};
}
context.addSchema("", schema);
context.validateAll(data, schema);
var result = {};
result.errors = context.errors;
result.missing = context.missing;
result.valid = (result.errors.length == 0);
return result;
},
addSchema: function (url, schema) {

@@ -105,0 +118,0 @@ return globalContext.addSchema(url, schema);

@@ -46,4 +46,4 @@ ValidatorContext.prototype.validateArray = function validateArray(data, schema) {

if (i < schema.items.length) {
if (error = this.validateAll(data[i], schema.items[i])) {
return error.prefixWith(null, "" + i).prefixWith("" + i, "items");
if (error = this.validateAll(data[i], schema.items[i], [i], ["items", i])) {
return error;
}

@@ -55,4 +55,4 @@ } else if (schema.additionalItems != undefined) {

}
} else if (error = this.validateAll(data[i], schema.additionalItems)) {
return error.prefixWith("" + i, "additionalItems");
} else if (error = this.validateAll(data[i], schema.additionalItems, [i], ["additionalItems"])) {
return error;
}

@@ -63,4 +63,4 @@ }

for (var i = 0; i < data.length; i++) {
if (error = this.validateAll(data[i], schema.items)) {
return error.prefixWith("" + i, "items");
if (error = this.validateAll(data[i], schema.items, [i], ["items"])) {
return error;
}

@@ -67,0 +67,0 @@ }

@@ -0,0 +0,0 @@ ValidatorContext.prototype.validateBasic = function validateBasic(data, schema) {

@@ -17,4 +17,4 @@ ValidatorContext.prototype.validateCombinations = function validateCombinations(data, schema) {

var subSchema = schema.allOf[i];
if (error = this.validateAll(data, subSchema)) {
return error.prefixWith(null, "" + i).prefixWith(null, "allOf");
if (error = this.validateAll(data, subSchema, [], ["allOf", i])) {
return error;
}

@@ -30,10 +30,19 @@ }

var errors = [];
var startErrorCount = this.errors.length;
for (var i = 0; i < schema.anyOf.length; i++) {
var subSchema = schema.anyOf[i];
var error = this.validateAll(data, subSchema);
if (error == null) {
var errorCount = this.errors.length;
var error = this.validateAll(data, subSchema, [], ["anyOf", i]);
if (error == null && errorCount == this.errors.length) {
this.errors = this.errors.slice(0, startErrorCount);
return null;
}
errors.push(error.prefixWith(null, "" + i).prefixWith(null, "anyOf"));
if (error) {
errors.push(error.prefixWith(null, "" + i).prefixWith(null, "anyOf"));
}
}
errors = errors.concat(this.errors.slice(startErrorCount));
this.errors = this.errors.slice(0, startErrorCount);
return new ValidationError(ErrorCodes.ANY_OF_MISSING, "Data does not match any schemas from \"anyOf\"", "", "/anyOf", errors);

@@ -48,12 +57,17 @@ }

var errors = [];
var startErrorCount = this.errors.length;
for (var i = 0; i < schema.oneOf.length; i++) {
var subSchema = schema.oneOf[i];
var error = this.validateAll(data, subSchema);
if (error == null) {
var errorCount = this.errors.length;
var error = this.validateAll(data, subSchema, [], ["oneOf", i]);
if (error == null && errorCount == this.errors.length) {
if (validIndex == null) {
validIndex = i;
} else {
this.errors = this.errors.slice(0, startErrorCount);
return new ValidationError(ErrorCodes.ONE_OF_MULTIPLE, "Data is valid against more than one schema from \"oneOf\": indices " + validIndex + " and " + i, "", "/oneOf");
}
} else {
} else if (error) {
errors.push(error.prefixWith(null, "" + i).prefixWith(null, "oneOf"));

@@ -63,2 +77,4 @@ }

if (validIndex == null) {
errors = errors.concat(this.errors.slice(startErrorCount));
this.errors = this.errors.slice(0, startErrorCount);
return new ValidationError(ErrorCodes.ONE_OF_MISSING, "Data does not match any schemas from \"oneOf\"", "", "/oneOf", errors);

@@ -73,4 +89,7 @@ }

}
var oldErrorCount = this.errors.length;
var error = this.validateAll(data, schema.not);
if (error == null) {
var notErrors = this.errors.slice(oldErrorCount);
this.errors = this.errors.slice(0, oldErrorCount);
if (error == null && notErrors.length == 0) {
return new ValidationError(ErrorCodes.NOT_PASSED, "Data matches schema from \"not\"", "", "/not")

@@ -77,0 +96,0 @@ }

@@ -0,0 +0,0 @@ function normSchema(schema, baseUri) {

@@ -0,0 +0,0 @@ ValidatorContext.prototype.validateNumeric = function validateNumeric(data, schema) {

@@ -45,4 +45,4 @@ ValidatorContext.prototype.validateObject = function validateObject(data, schema) {

foundMatch = true;
if (error = this.validateAll(data[key], schema.properties[key])) {
return error.prefixWith(key, key).prefixWith(null, "properties");
if (error = this.validateAll(data[key], schema.properties[key], [key], ["properties", key])) {
return error;
}

@@ -55,4 +55,4 @@ }

foundMatch = true;
if (error = this.validateAll(data[key], schema.patternProperties[patternKey])) {
return error.prefixWith(key, patternKey).prefixWith(null, "patternProperties");
if (error = this.validateAll(data[key], schema.patternProperties[patternKey], [key], ["patternProperties", patternKey])) {
return error;
}

@@ -68,4 +68,4 @@ }

} else {
if (error = this.validateAll(data[key], schema.additionalProperties)) {
return error.prefixWith(key, "additionalProperties");
if (error = this.validateAll(data[key], schema.additionalProperties, [key], ["additionalProperties"])) {
return error;
}

@@ -96,4 +96,4 @@ }

} else {
if (error = this.validateAll(data, dep)) {
return error.prefixWith(null, depKey).prefixWith(null, "dependencies");
if (error = this.validateAll(data, dep, [], ["dependencies", depKey])) {
return error;
}

@@ -100,0 +100,0 @@ }

@@ -0,0 +0,0 @@ // parseURI() and resolveUrl() are from https://gist.github.com/1088850

@@ -0,0 +0,0 @@ ValidatorContext.prototype.validateString = function validateString(data, schema) {

@@ -1,5 +0,23 @@

var ValidatorContext = function (parent) {
var ValidatorContext = function (parent, collectMultiple) {
this.missing = [];
this.schemas = parent ? Object.create(parent.schemas) : {};
this.collectMultiple = collectMultiple;
this.errors = [];
this.handleError = collectMultiple ? this.collectError : this.returnError;
};
ValidatorContext.prototype.returnError = function (error) {
return error;
};
ValidatorContext.prototype.collectError = function (error) {
if (error) {
this.errors.push(error);
}
return null;
}
ValidatorContext.prototype.prefixErrors = function (startIndex, dataPath, schemaPath) {
for (var i = startIndex; i < this.errors.length; i++) {
this.errors[i] = this.errors[i].prefixWith(dataPath, schemaPath);
}
return this;
}

@@ -54,3 +72,3 @@ ValidatorContext.prototype.getSchema = function (url) {

ValidatorContext.prototype.validateAll = function validateAll(data, schema) {
ValidatorContext.prototype.validateAll = function validateAll(data, schema, dataPathParts, schemaPathParts) {
if (schema['$ref'] != undefined) {

@@ -62,4 +80,5 @@ schema = this.getSchema(schema['$ref']);

}
var error = false;
return this.validateBasic(data, schema)
var errorCount = this.errors.length;
var error = this.validateBasic(data, schema)
|| this.validateNumeric(data, schema)

@@ -70,3 +89,15 @@ || this.validateString(data, schema)

|| this.validateCombinations(data, schema)
|| null;
|| null
if (error || errorCount != this.errors.length) {
while ((dataPathParts && dataPathParts.length) || (schemaPathParts && schemaPathParts.length)) {
var dataPart = (dataPathParts && dataPathParts.length) ? "" + dataPathParts.pop() : null;
var schemaPart = (schemaPathParts && schemaPathParts.length) ? "" + schemaPathParts.pop() : null;
if (error) {
error = error.prefixWith(dataPart, schemaPart);
}
this.prefixErrors(errorCount, dataPart, schemaPart);
}
}
return this.handleError(error);
}

@@ -73,0 +104,0 @@

@@ -0,0 +0,0 @@ function renderTestSet(testSet, resultsContainer) {

@@ -0,0 +0,0 @@ (function () {

@@ -0,0 +0,0 @@ //

@@ -0,0 +0,0 @@ tests.add("no type specified", function () {

@@ -0,0 +0,0 @@ tests.add("enum [1], was 1", function () {

@@ -0,0 +0,0 @@ tests.add("multipleOf", function () {

@@ -0,0 +0,0 @@ tests.add("minimum success", function () {

@@ -0,0 +0,0 @@ tests.add("no length constraints", function () {

@@ -0,0 +0,0 @@ tests.add("pattern success", function () {

@@ -0,0 +0,0 @@ tests.add("no length constraints", function () {

@@ -0,0 +0,0 @@ tests.add("uniqueItems success", function () {

@@ -0,0 +0,0 @@ tests.add("plain items success", function () {

@@ -0,0 +0,0 @@ tests.add("plain items success", function () {

@@ -0,0 +0,0 @@ tests.add("additional items schema success", function () {

@@ -0,0 +0,0 @@ tests.add("minimum length success", function () {

@@ -0,0 +0,0 @@ tests.add("required success", function () {

@@ -0,0 +0,0 @@ tests.add("properties success", function () {

@@ -0,0 +0,0 @@ tests.add("patternProperties success", function () {

@@ -0,0 +0,0 @@ tests.add("additionalProperties schema success", function () {

@@ -0,0 +0,0 @@ tests.add("string dependency success", function () {

@@ -0,0 +0,0 @@ tests.add("allOf success", function () {

@@ -0,0 +0,0 @@ tests.add("anyOf success", function () {

@@ -0,0 +0,0 @@ tests.add("oneOf success", function () {

@@ -0,0 +0,0 @@ tests.add("not success", function () {

@@ -0,0 +0,0 @@ tests.add("normalise - untouched immediate $ref", function () {

@@ -0,0 +0,0 @@ tests.add("skip unneeded", function () {

@@ -0,0 +0,0 @@ tests.add("addSchema(), getSchema()", function () {

@@ -0,0 +0,0 @@ tests.add("addSchema(), $ref", function () {

@@ -0,0 +0,0 @@ tests.add("inline addressing for fragments", function () {

@@ -0,0 +0,0 @@ tests.add("validateResult returns object with appropriate properties", function () {

tests.add("tv4.errorCodes exists", function () {
return typeof tv4.errorCodes == "object";
});

@@ -0,0 +0,0 @@ // Provides support for asynchronous validation (fetching schemas) using jQuery

@@ -11,6 +11,24 @@ /**

(function (global) {
var ValidatorContext = function (parent) {
var ValidatorContext = function (parent, collectMultiple) {
this.missing = [];
this.schemas = parent ? Object.create(parent.schemas) : {};
this.collectMultiple = collectMultiple;
this.errors = [];
this.handleError = collectMultiple ? this.collectError : this.returnError;
};
ValidatorContext.prototype.returnError = function (error) {
return error;
};
ValidatorContext.prototype.collectError = function (error) {
if (error) {
this.errors.push(error);
}
return null;
}
ValidatorContext.prototype.prefixErrors = function (startIndex, dataPath, schemaPath) {
for (var i = startIndex; i < this.errors.length; i++) {
this.errors[i] = this.errors[i].prefixWith(dataPath, schemaPath);
}
return this;
}

@@ -65,3 +83,3 @@ ValidatorContext.prototype.getSchema = function (url) {

ValidatorContext.prototype.validateAll = function validateAll(data, schema) {
ValidatorContext.prototype.validateAll = function validateAll(data, schema, dataPathParts, schemaPathParts) {
if (schema['$ref'] != undefined) {

@@ -73,4 +91,5 @@ schema = this.getSchema(schema['$ref']);

}
var error = false;
return this.validateBasic(data, schema)
var errorCount = this.errors.length;
var error = this.validateBasic(data, schema)
|| this.validateNumeric(data, schema)

@@ -81,3 +100,15 @@ || this.validateString(data, schema)

|| this.validateCombinations(data, schema)
|| null;
|| null
if (error || errorCount != this.errors.length) {
while ((dataPathParts && dataPathParts.length) || (schemaPathParts && schemaPathParts.length)) {
var dataPart = (dataPathParts && dataPathParts.length) ? "" + dataPathParts.pop() : null;
var schemaPart = (schemaPathParts && schemaPathParts.length) ? "" + schemaPathParts.pop() : null;
if (error) {
error = error.prefixWith(dataPart, schemaPart);
}
this.prefixErrors(errorCount, dataPart, schemaPart);
}
}
return this.handleError(error);
}

@@ -289,4 +320,4 @@

if (i < schema.items.length) {
if (error = this.validateAll(data[i], schema.items[i])) {
return error.prefixWith(null, "" + i).prefixWith("" + i, "items");
if (error = this.validateAll(data[i], schema.items[i], [i], ["items", i])) {
return error;
}

@@ -298,4 +329,4 @@ } else if (schema.additionalItems != undefined) {

}
} else if (error = this.validateAll(data[i], schema.additionalItems)) {
return error.prefixWith("" + i, "additionalItems");
} else if (error = this.validateAll(data[i], schema.additionalItems, [i], ["additionalItems"])) {
return error;
}

@@ -306,4 +337,4 @@ }

for (var i = 0; i < data.length; i++) {
if (error = this.validateAll(data[i], schema.items)) {
return error.prefixWith("" + i, "items");
if (error = this.validateAll(data[i], schema.items, [i], ["items"])) {
return error;
}

@@ -358,4 +389,4 @@ }

foundMatch = true;
if (error = this.validateAll(data[key], schema.properties[key])) {
return error.prefixWith(key, key).prefixWith(null, "properties");
if (error = this.validateAll(data[key], schema.properties[key], [key], ["properties", key])) {
return error;
}

@@ -368,4 +399,4 @@ }

foundMatch = true;
if (error = this.validateAll(data[key], schema.patternProperties[patternKey])) {
return error.prefixWith(key, patternKey).prefixWith(null, "patternProperties");
if (error = this.validateAll(data[key], schema.patternProperties[patternKey], [key], ["patternProperties", patternKey])) {
return error;
}

@@ -381,4 +412,4 @@ }

} else {
if (error = this.validateAll(data[key], schema.additionalProperties)) {
return error.prefixWith(key, "additionalProperties");
if (error = this.validateAll(data[key], schema.additionalProperties, [key], ["additionalProperties"])) {
return error;
}

@@ -409,4 +440,4 @@ }

} else {
if (error = this.validateAll(data, dep)) {
return error.prefixWith(null, depKey).prefixWith(null, "dependencies");
if (error = this.validateAll(data, dep, [], ["dependencies", depKey])) {
return error;
}

@@ -436,4 +467,4 @@ }

var subSchema = schema.allOf[i];
if (error = this.validateAll(data, subSchema)) {
return error.prefixWith(null, "" + i).prefixWith(null, "allOf");
if (error = this.validateAll(data, subSchema, [], ["allOf", i])) {
return error;
}

@@ -449,10 +480,19 @@ }

var errors = [];
var startErrorCount = this.errors.length;
for (var i = 0; i < schema.anyOf.length; i++) {
var subSchema = schema.anyOf[i];
var error = this.validateAll(data, subSchema);
if (error == null) {
var errorCount = this.errors.length;
var error = this.validateAll(data, subSchema, [], ["anyOf", i]);
if (error == null && errorCount == this.errors.length) {
this.errors = this.errors.slice(0, startErrorCount);
return null;
}
errors.push(error.prefixWith(null, "" + i).prefixWith(null, "anyOf"));
if (error) {
errors.push(error.prefixWith(null, "" + i).prefixWith(null, "anyOf"));
}
}
errors = errors.concat(this.errors.slice(startErrorCount));
this.errors = this.errors.slice(0, startErrorCount);
return new ValidationError(ErrorCodes.ANY_OF_MISSING, "Data does not match any schemas from \"anyOf\"", "", "/anyOf", errors);

@@ -467,12 +507,17 @@ }

var errors = [];
var startErrorCount = this.errors.length;
for (var i = 0; i < schema.oneOf.length; i++) {
var subSchema = schema.oneOf[i];
var error = this.validateAll(data, subSchema);
if (error == null) {
var errorCount = this.errors.length;
var error = this.validateAll(data, subSchema, [], ["oneOf", i]);
if (error == null && errorCount == this.errors.length) {
if (validIndex == null) {
validIndex = i;
} else {
this.errors = this.errors.slice(0, startErrorCount);
return new ValidationError(ErrorCodes.ONE_OF_MULTIPLE, "Data is valid against more than one schema from \"oneOf\": indices " + validIndex + " and " + i, "", "/oneOf");
}
} else {
} else if (error) {
errors.push(error.prefixWith(null, "" + i).prefixWith(null, "oneOf"));

@@ -482,2 +527,4 @@ }

if (validIndex == null) {
errors = errors.concat(this.errors.slice(startErrorCount));
this.errors = this.errors.slice(0, startErrorCount);
return new ValidationError(ErrorCodes.ONE_OF_MISSING, "Data does not match any schemas from \"oneOf\"", "", "/oneOf", errors);

@@ -492,4 +539,7 @@ }

}
var oldErrorCount = this.errors.length;
var error = this.validateAll(data, schema.not);
if (error == null) {
var notErrors = this.errors.slice(oldErrorCount);
this.errors = this.errors.slice(0, oldErrorCount);
if (error == null && notErrors.length == 0) {
return new ValidationError(ErrorCodes.NOT_PASSED, "Data matches schema from \"not\"", "", "/not")

@@ -672,2 +722,15 @@ }

},
validateMultiple: function (data, schema) {
var context = new ValidatorContext(globalContext, true);
if (typeof schema == "string") {
schema = {"$ref": schema};
}
context.addSchema("", schema);
context.validateAll(data, schema);
var result = {};
result.errors = context.errors;
result.missing = context.missing;
result.valid = (result.errors.length == 0);
return result;
},
addSchema: function (url, schema) {

@@ -674,0 +737,0 @@ return globalContext.addSchema(url, schema);

@@ -1,24 +0,26 @@

(function(q){function j(b,a){if(b===a)return!0;if("object"==typeof b&&"object"==typeof a){if(Array.isArray(b)!=Array.isArray(a))return!1;if(Array.isArray(b)){if(b.length!=a.length)return!1;for(var c=0;c<b.length;c++)if(!j(b[c],a[c]))return!1}else{for(c in b)if(void 0===a[c]&&void 0!==b[c])return!1;for(c in a)if(void 0===b[c]&&void 0!==a[c])return!1;for(c in b)if(!j(b[c],a[c]))return!1}return!0}return!1}function n(b){return(b=String(b).replace(/^\s+|\s+$/g,"").match(/^([^:\/?#]+:)?(\/\/(?:[^:@]*(?::[^:@]*)?@)?(([^:\/?#]*)(?::(\d*))?))?([^?#]*)(\?[^#]*)?(#[\s\S]*)?/))?
{href:b[0]||"",protocol:b[1]||"",authority:b[2]||"",host:b[3]||"",hostname:b[4]||"",port:b[5]||"",pathname:b[6]||"",search:b[7]||"",hash:b[8]||""}:null}function l(b,a){a=n(a||"");b=n(b||"");var c;if(!a||!b)c=null;else{c=(a.protocol||b.protocol)+(a.protocol||a.authority?a.authority:b.authority);var d;d=a.protocol||a.authority||"/"===a.pathname.charAt(0)?a.pathname:a.pathname?(b.authority&&!b.pathname?"/":"")+b.pathname.slice(0,b.pathname.lastIndexOf("/")+1)+a.pathname:b.pathname;var f=[];d.replace(/^(\.\.?(\/|$))+/,
"").replace(/\/(\.(\/|$))+/g,"/").replace(/\/\.\.$/,"/../").replace(/\/?[^\/]*/g,function(a){"/.."===a?f.pop():f.push(a)});d=f.join("").replace(/^\//,"/"===d.charAt(0)?"/":"");c=c+d+(a.protocol||a.authority||a.pathname?a.search:a.search||b.search)+a.hash}return c}function k(b,a){void 0==a?a=b.id:"string"==typeof b.id&&(a=l(a,b.id),b.id=a);if("object"==typeof b)if(Array.isArray(b))for(var c=0;c<b.length;c++)k(b[c],a);else if("string"==typeof b.$ref)b.$ref=l(a,b.$ref);else for(c in b)"enum"!=c&&k(b[c],
a)}function g(b,a,c,d,f){if(void 0==b)throw Error("No code supplied for error: "+a);this.code=b;this.message=a;this.dataPath=c?c:"";this.schemaPath=d?d:"";this.subErrors=f?f:null}function p(b,a,c){if("string"==typeof a.id&&a.id.substring(0,c.length)==c){var d=a.id.substring(c.length);if(0<c.length&&"/"==c.charAt(c.length-1)||"#"==d.charAt(0)||"?"==d.charAt(0))void 0==b[a.id]&&(b[a.id]=a)}if("object"==typeof a)for(var f in a)"enum"!=f&&"object"==typeof a[f]&&p(b,a[f],c);return b}var e=function(b){this.missing=
[];this.schemas=b?Object.create(b.schemas):{}};e.prototype.getSchema=function(b){if(void 0!=this.schemas[b])return b=this.schemas[b];var a=b,c="";-1!=b.indexOf("#")&&(c=b.substring(b.indexOf("#")+1),a=b.substring(0,b.indexOf("#")));if(void 0!=this.schemas[a]){b=this.schemas[a];c=decodeURIComponent(c);if(""==c)return b;if("/"!=c.charAt(0))return;for(var c=c.split("/").slice(1),d=0;d<c.length;d++){var f=c[d].replace("~1","/").replace("~0","~");if(void 0==b[f]){b=void 0;break}b=b[f]}if(void 0!=b)return b}void 0==
this.missing[a]&&(this.missing.push(a),this.missing[a]=a)};e.prototype.addSchema=function(b,a){var c={};c[b]=a;k(a,b);p(c,a,b);for(var d in c)this.schemas[d]=c[d];return c};e.prototype.validateAll=function(b,a){return void 0!=a.$ref&&(a=this.getSchema(a.$ref),!a)?null:this.validateBasic(b,a)||this.validateNumeric(b,a)||this.validateString(b,a)||this.validateArray(b,a)||this.validateObject(b,a)||this.validateCombinations(b,a)||null};e.prototype.validateBasic=function(b,a){var c;return(c=this.validateType(b,
a))||(c=this.validateEnum(b,a))?c.prefixWith(null,"type"):null};e.prototype.validateType=function(b,a){if(void 0==a.type)return null;var c=typeof b;null==b?c="null":Array.isArray(b)&&(c="array");var d=a.type;"object"!=typeof d&&(d=[d]);for(var f=0;f<d.length;f++){var e=d[f];if(e==c||"integer"==e&&"number"==c&&0==b%1)return null}return new g(h.INVALID_TYPE,"invalid data type: "+c)};e.prototype.validateEnum=function(b,a){if(void 0==a["enum"])return null;for(var c=0;c<a["enum"].length;c++)if(j(b,a["enum"][c]))return null;
return new g(h.ENUM_MISMATCH,"No enum match for: "+JSON.stringify(b))};e.prototype.validateNumeric=function(b,a){return this.validateMultipleOf(b,a)||this.validateMinMax(b,a)||null};e.prototype.validateMultipleOf=function(b,a){var c=a.multipleOf||a.divisibleBy;return void 0==c?null:"number"==typeof b&&0!=b%c?new g(h.NUMBER_MULTIPLE_OF,"Value "+b+" is not a multiple of "+c):null};e.prototype.validateMinMax=function(b,a){if("number"!=typeof b)return null;if(void 0!=a.minimum){if(b<a.minimum)return(new g(h.NUMBER_MINIMUM,
"Value "+b+" is less than minimum "+a.minimum)).prefixWith(null,"minimum");if(a.exclusiveMinimum&&b==a.minimum)return(new g(h.NUMBER_MINIMUM_EXCLUSIVE,"Value "+b+" is equal to exclusive minimum "+a.minimum)).prefixWith(null,"exclusiveMinimum")}if(void 0!=a.maximum){if(b>a.maximum)return(new g(h.NUMBER_MAXIMUM,"Value "+b+" is greater than maximum "+a.maximum)).prefixWith(null,"maximum");if(a.exclusiveMaximum&&b==a.maximum)return(new g(h.NUMBER_MAXIMUM_EXCLUSIVE,"Value "+b+" is equal to exclusive maximum "+
a.maximum)).prefixWith(null,"exclusiveMaximum")}return null};e.prototype.validateString=function(b,a){return this.validateStringLength(b,a)||this.validateStringPattern(b,a)||null};e.prototype.validateStringLength=function(b,a){return"string"!=typeof b?null:void 0!=a.minLength&&b.length<a.minLength?(h.STRING_LENGTH_SHORT,new g("String is too short ("+b.length+" chars), minimum "+a.minLength)).prefixWith(null,"minLength"):void 0!=a.maxLength&&b.length>a.maxLength?(h.STRING_LENGTH_LONG,new g("String is too long ("+
b.length+" chars), maximum "+a.maxLength)).prefixWith(null,"maxLength"):null};e.prototype.validateStringPattern=function(b,a){return"string"!=typeof b||void 0==a.pattern?null:!RegExp(a.pattern).test(b)?(new g(h.STRING_PATTERN,"String does not match pattern")).prefixWith(null,"pattern"):null};e.prototype.validateArray=function(b,a){return!Array.isArray(b)?null:this.validateArrayLength(b,a)||this.validateArrayUniqueItems(b,a)||this.validateArrayItems(b,a)||null};e.prototype.validateArrayLength=function(b,
a){return void 0!=a.minItems&&b.length<a.minItems?(new g(h.ARRAY_LENGTH_SHORT,"Array is too short ("+b.length+"), minimum "+a.minItems)).prefixWith(null,"minItems"):void 0!=a.maxItems&&b.length>a.maxItems?(new g(h.ARRAY_LENGTH_LONG,"Array is too long ("+b.length+" chars), maximum "+a.maxItems)).prefixWith(null,"maxItems"):null};e.prototype.validateArrayUniqueItems=function(b,a){if(a.uniqueItems)for(var c=0;c<b.length;c++)for(var d=c+1;d<b.length;d++)if(j(b[c],b[d]))return(new g(h.ARRAY_UNIQUE,"Array items are not unique (indices "+
c+" and "+d+")")).prefixWith(null,"uniqueItems");return null};e.prototype.validateArrayItems=function(b,a){if(void 0==a.items)return null;var c;if(Array.isArray(a.items))for(var d=0;d<b.length;d++)if(d<a.items.length){if(c=this.validateAll(b[d],a.items[d]))return c.prefixWith(null,""+d).prefixWith(""+d,"items")}else{if(void 0!=a.additionalItems)if("boolean"==typeof a.additionalItems){if(!a.additionalItems)return(new g(h.ARRAY_ADDITIONAL_ITEMS,"Additional items not allowed")).prefixWith(""+d,"additionalItems")}else if(c=
this.validateAll(b[d],a.additionalItems))return c.prefixWith(""+d,"additionalItems")}else for(d=0;d<b.length;d++)if(c=this.validateAll(b[d],a.items))return c.prefixWith(""+d,"items");return null};e.prototype.validateObject=function(b,a){return"object"!=typeof b||null==b||Array.isArray(b)?null:this.validateObjectMinMaxProperties(b,a)||this.validateObjectRequiredProperties(b,a)||this.validateObjectProperties(b,a)||this.validateObjectDependencies(b,a)||null};e.prototype.validateObjectMinMaxProperties=
function(b,a){var c=Object.keys(b);return void 0!=a.minProperties&&c.length<a.minProperties?(new g(h.OBJECT_PROPERTIES_MINIMUM,"Too few properties defined ("+c.length+"), minimum "+a.minProperties)).prefixWith(null,"minProperties"):void 0!=a.maxProperties&&c.length>a.maxProperties?(new g(h.OBJECT_PROPERTIES_MAXIMUM,"Too many properties defined ("+c.length+"), maximum "+a.maxProperties)).prefixWith(null,"maxProperties"):null};e.prototype.validateObjectRequiredProperties=function(b,a){if(void 0!=a.required)for(var c=
0;c<a.required.length;c++){var d=a.required[c];if(void 0===b[d])return(new g(h.OBJECT_REQUIRED,"Missing required property: "+d)).prefixWith(null,""+c).prefixWith(null,"required")}return null};e.prototype.validateObjectProperties=function(b,a){var c,d;for(d in b){var f=!1;if(void 0!=a.properties&&void 0!=a.properties[d]&&(f=!0,c=this.validateAll(b[d],a.properties[d])))return c.prefixWith(d,d).prefixWith(null,"properties");if(void 0!=a.patternProperties)for(var e in a.patternProperties)if(RegExp(e).test(d)&&
(f=!0,c=this.validateAll(b[d],a.patternProperties[e])))return c.prefixWith(d,e).prefixWith(null,"patternProperties");if(!f&&void 0!=a.additionalProperties)if("boolean"==typeof a.additionalProperties){if(!a.additionalProperties)return(new g(h.OBJECT_ADDITIONAL_PROPERTIES,"Additional properties not allowed")).prefixWith(d,"additionalProperties")}else if(c=this.validateAll(b[d],a.additionalProperties))return c.prefixWith(d,"additionalProperties")}return null};e.prototype.validateObjectDependencies=function(b,
a){var c;if(void 0!=a.dependencies)for(var d in a.dependencies)if(void 0!==b[d])if(c=a.dependencies[d],"string"==typeof c){if(void 0===b[c])return(new g(h.OBJECT_DEPENDENCY_KEY,"Dependency failed - key must exist: "+c)).prefixWith(null,d).prefixWith(null,"dependencies")}else if(Array.isArray(c))for(var f=0;f<c.length;f++){var e=c[f];if(void 0===b[e])return(new g(h.OBJECT_DEPENDENCY_KEY,"Dependency failed - key must exist: "+e)).prefixWith(null,""+f).prefixWith(null,d).prefixWith(null,"dependencies")}else if(c=
this.validateAll(b,c))return c.prefixWith(null,d).prefixWith(null,"dependencies");return null};e.prototype.validateCombinations=function(b,a){return this.validateAllOf(b,a)||this.validateAnyOf(b,a)||this.validateOneOf(b,a)||this.validateNot(b,a)||null};e.prototype.validateAllOf=function(b,a){if(void 0==a.allOf)return null;for(var c,d=0;d<a.allOf.length;d++)if(c=this.validateAll(b,a.allOf[d]))return c.prefixWith(null,""+d).prefixWith(null,"allOf");return null};e.prototype.validateAnyOf=function(b,
a){if(void 0==a.anyOf)return null;for(var c=[],d=0;d<a.anyOf.length;d++){var e=this.validateAll(b,a.anyOf[d]);if(null==e)return null;c.push(e.prefixWith(null,""+d).prefixWith(null,"anyOf"))}return new g(h.ANY_OF_MISSING,'Data does not match any schemas from "anyOf"',"","/anyOf",c)};e.prototype.validateOneOf=function(b,a){if(void 0==a.oneOf)return null;for(var c=null,d=[],e=0;e<a.oneOf.length;e++){var j=this.validateAll(b,a.oneOf[e]);if(null==j)if(null==c)c=e;else return new g(h.ONE_OF_MULTIPLE,'Data is valid against more than one schema from "oneOf": indices '+
c+" and "+e,"","/oneOf");else d.push(j.prefixWith(null,""+e).prefixWith(null,"oneOf"))}return null==c?new g(h.ONE_OF_MISSING,'Data does not match any schemas from "oneOf"',"","/oneOf",d):null};e.prototype.validateNot=function(b,a){return void 0==a.not?null:null==this.validateAll(b,a.not)?new g(h.NOT_PASSED,'Data matches schema from "not"',"","/not"):null};var h={INVALID_TYPE:0,ENUM_MISMATCH:1,ANY_OF_MISSING:10,ONE_OF_MISSING:11,ONE_OF_MULTIPLE:12,NOT_PASSED:13,NUMBER_MULTIPLE_OF:100,NUMBER_MINIMUM:101,
NUMBER_MINIMUM_EXCLUSIVE:102,NUMBER_MAXIMUM:103,NUMBER_MAXIMUM_EXCLUSIVE:104,STRING_LENGTH_SHORT:200,STRING_LENGTH_LONG:201,STRING_PATTERN:202,OBJECT_PROPERTIES_MINIMUM:300,OBJECT_PROPERTIES_MAXIMUM:301,OBJECT_REQUIRED:302,OBJECT_ADDITIONAL_PROPERTIES:303,OBJECT_DEPENDENCY_KEY:304,ARRAY_LENGTH_SHORT:400,ARRAY_LENGTH_LONG:401,ARRAY_UNIQUE:402,ARRAY_ADDITIONAL_ITEMS:403};g.prototype={prefixWith:function(b,a){null!=b&&(b=b.replace("~","~0").replace("/","~1"),this.dataPath="/"+b+this.dataPath);null!=
a&&(a=a.replace("~","~0").replace("/","~1"),this.schemaPath="/"+a+this.schemaPath);if(null!=this.subErrors)for(var c=0;c<this.subErrors.length;c++)this.subErrors[c].prefixWith(b,a);return this}};var m=new e;q.tv4={validate:function(b,a){var c=new e(m);"string"==typeof a&&(a={$ref:a});c.addSchema("",a);var d=c.validateAll(b,a);this.error=d;this.missing=c.missing;return this.valid=null==d},validateResult:function(){var b={};this.validate.apply(b,arguments);return b},addSchema:function(b,a){return m.addSchema(b,
a)},getSchema:function(b){return m.getSchema(b)},missing:[],error:null,normSchema:k,resolveUrl:l,errorCodes:h}})("undefined"!==typeof module&&module.exports?exports:this);
(function(s){function k(b,a){if(b===a)return!0;if("object"==typeof b&&"object"==typeof a){if(Array.isArray(b)!=Array.isArray(a))return!1;if(Array.isArray(b)){if(b.length!=a.length)return!1;for(var c=0;c<b.length;c++)if(!k(b[c],a[c]))return!1}else{for(c in b)if(void 0===a[c]&&void 0!==b[c])return!1;for(c in a)if(void 0===b[c]&&void 0!==a[c])return!1;for(c in b)if(!k(b[c],a[c]))return!1}return!0}return!1}function q(b){return(b=String(b).replace(/^\s+|\s+$/g,"").match(/^([^:\/?#]+:)?(\/\/(?:[^:@]*(?::[^:@]*)?@)?(([^:\/?#]*)(?::(\d*))?))?([^?#]*)(\?[^#]*)?(#[\s\S]*)?/))?
{href:b[0]||"",protocol:b[1]||"",authority:b[2]||"",host:b[3]||"",hostname:b[4]||"",port:b[5]||"",pathname:b[6]||"",search:b[7]||"",hash:b[8]||""}:null}function p(b,a){a=q(a||"");b=q(b||"");var c;if(!a||!b)c=null;else{c=(a.protocol||b.protocol)+(a.protocol||a.authority?a.authority:b.authority);var d;d=a.protocol||a.authority||"/"===a.pathname.charAt(0)?a.pathname:a.pathname?(b.authority&&!b.pathname?"/":"")+b.pathname.slice(0,b.pathname.lastIndexOf("/")+1)+a.pathname:b.pathname;var h=[];d.replace(/^(\.\.?(\/|$))+/,
"").replace(/\/(\.(\/|$))+/g,"/").replace(/\/\.\.$/,"/../").replace(/\/?[^\/]*/g,function(a){"/.."===a?h.pop():h.push(a)});d=h.join("").replace(/^\//,"/"===d.charAt(0)?"/":"");c=c+d+(a.protocol||a.authority||a.pathname?a.search:a.search||b.search)+a.hash}return c}function m(b,a){void 0==a?a=b.id:"string"==typeof b.id&&(a=p(a,b.id),b.id=a);if("object"==typeof b)if(Array.isArray(b))for(var c=0;c<b.length;c++)m(b[c],a);else if("string"==typeof b.$ref)b.$ref=p(a,b.$ref);else for(c in b)"enum"!=c&&m(b[c],
a)}function f(b,a,c,d,h){if(void 0==b)throw Error("No code supplied for error: "+a);this.code=b;this.message=a;this.dataPath=c?c:"";this.schemaPath=d?d:"";this.subErrors=h?h:null}function r(b,a,c){if("string"==typeof a.id&&a.id.substring(0,c.length)==c){var d=a.id.substring(c.length);if(0<c.length&&"/"==c.charAt(c.length-1)||"#"==d.charAt(0)||"?"==d.charAt(0))void 0==b[a.id]&&(b[a.id]=a)}if("object"==typeof a)for(var h in a)"enum"!=h&&"object"==typeof a[h]&&r(b,a[h],c);return b}var e=function(b,a){this.missing=
[];this.schemas=b?Object.create(b.schemas):{};this.collectMultiple=a;this.errors=[];this.handleError=a?this.collectError:this.returnError};e.prototype.returnError=function(b){return b};e.prototype.collectError=function(b){b&&this.errors.push(b);return null};e.prototype.prefixErrors=function(b,a,c){for(;b<this.errors.length;b++)this.errors[b]=this.errors[b].prefixWith(a,c);return this};e.prototype.getSchema=function(b){if(void 0!=this.schemas[b])return b=this.schemas[b];var a=b,c="";-1!=b.indexOf("#")&&
(c=b.substring(b.indexOf("#")+1),a=b.substring(0,b.indexOf("#")));if(void 0!=this.schemas[a]){b=this.schemas[a];c=decodeURIComponent(c);if(""==c)return b;if("/"!=c.charAt(0))return;for(var c=c.split("/").slice(1),d=0;d<c.length;d++){var h=c[d].replace("~1","/").replace("~0","~");if(void 0==b[h]){b=void 0;break}b=b[h]}if(void 0!=b)return b}void 0==this.missing[a]&&(this.missing.push(a),this.missing[a]=a)};e.prototype.addSchema=function(b,a){var c={};c[b]=a;m(a,b);r(c,a,b);for(var d in c)this.schemas[d]=
c[d];return c};e.prototype.validateAll=function(b,a,c,d){if(void 0!=a.$ref&&(a=this.getSchema(a.$ref),!a))return null;var h=this.errors.length;if((b=this.validateBasic(b,a)||this.validateNumeric(b,a)||this.validateString(b,a)||this.validateArray(b,a)||this.validateObject(b,a)||this.validateCombinations(b,a)||null)||h!=this.errors.length)for(;c&&c.length||d&&d.length;){a=c&&c.length?""+c.pop():null;var e=d&&d.length?""+d.pop():null;b&&(b=b.prefixWith(a,e));this.prefixErrors(h,a,e)}return this.handleError(b)};
e.prototype.validateBasic=function(b,a){var c;return(c=this.validateType(b,a))||(c=this.validateEnum(b,a))?c.prefixWith(null,"type"):null};e.prototype.validateType=function(b,a){if(void 0==a.type)return null;var c=typeof b;null==b?c="null":Array.isArray(b)&&(c="array");var d=a.type;"object"!=typeof d&&(d=[d]);for(var h=0;h<d.length;h++){var e=d[h];if(e==c||"integer"==e&&"number"==c&&0==b%1)return null}return new f(g.INVALID_TYPE,"invalid data type: "+c)};e.prototype.validateEnum=function(b,a){if(void 0==
a["enum"])return null;for(var c=0;c<a["enum"].length;c++)if(k(b,a["enum"][c]))return null;return new f(g.ENUM_MISMATCH,"No enum match for: "+JSON.stringify(b))};e.prototype.validateNumeric=function(b,a){return this.validateMultipleOf(b,a)||this.validateMinMax(b,a)||null};e.prototype.validateMultipleOf=function(b,a){var c=a.multipleOf||a.divisibleBy;return void 0==c?null:"number"==typeof b&&0!=b%c?new f(g.NUMBER_MULTIPLE_OF,"Value "+b+" is not a multiple of "+c):null};e.prototype.validateMinMax=function(b,
a){if("number"!=typeof b)return null;if(void 0!=a.minimum){if(b<a.minimum)return(new f(g.NUMBER_MINIMUM,"Value "+b+" is less than minimum "+a.minimum)).prefixWith(null,"minimum");if(a.exclusiveMinimum&&b==a.minimum)return(new f(g.NUMBER_MINIMUM_EXCLUSIVE,"Value "+b+" is equal to exclusive minimum "+a.minimum)).prefixWith(null,"exclusiveMinimum")}if(void 0!=a.maximum){if(b>a.maximum)return(new f(g.NUMBER_MAXIMUM,"Value "+b+" is greater than maximum "+a.maximum)).prefixWith(null,"maximum");if(a.exclusiveMaximum&&
b==a.maximum)return(new f(g.NUMBER_MAXIMUM_EXCLUSIVE,"Value "+b+" is equal to exclusive maximum "+a.maximum)).prefixWith(null,"exclusiveMaximum")}return null};e.prototype.validateString=function(b,a){return this.validateStringLength(b,a)||this.validateStringPattern(b,a)||null};e.prototype.validateStringLength=function(b,a){return"string"!=typeof b?null:void 0!=a.minLength&&b.length<a.minLength?(g.STRING_LENGTH_SHORT,new f("String is too short ("+b.length+" chars), minimum "+a.minLength)).prefixWith(null,
"minLength"):void 0!=a.maxLength&&b.length>a.maxLength?(g.STRING_LENGTH_LONG,new f("String is too long ("+b.length+" chars), maximum "+a.maxLength)).prefixWith(null,"maxLength"):null};e.prototype.validateStringPattern=function(b,a){return"string"!=typeof b||void 0==a.pattern?null:!RegExp(a.pattern).test(b)?(new f(g.STRING_PATTERN,"String does not match pattern")).prefixWith(null,"pattern"):null};e.prototype.validateArray=function(b,a){return!Array.isArray(b)?null:this.validateArrayLength(b,a)||this.validateArrayUniqueItems(b,
a)||this.validateArrayItems(b,a)||null};e.prototype.validateArrayLength=function(b,a){return void 0!=a.minItems&&b.length<a.minItems?(new f(g.ARRAY_LENGTH_SHORT,"Array is too short ("+b.length+"), minimum "+a.minItems)).prefixWith(null,"minItems"):void 0!=a.maxItems&&b.length>a.maxItems?(new f(g.ARRAY_LENGTH_LONG,"Array is too long ("+b.length+" chars), maximum "+a.maxItems)).prefixWith(null,"maxItems"):null};e.prototype.validateArrayUniqueItems=function(b,a){if(a.uniqueItems)for(var c=0;c<b.length;c++)for(var d=
c+1;d<b.length;d++)if(k(b[c],b[d]))return(new f(g.ARRAY_UNIQUE,"Array items are not unique (indices "+c+" and "+d+")")).prefixWith(null,"uniqueItems");return null};e.prototype.validateArrayItems=function(b,a){if(void 0==a.items)return null;var c;if(Array.isArray(a.items))for(var d=0;d<b.length;d++)if(d<a.items.length){if(c=this.validateAll(b[d],a.items[d],[d],["items",d]))return c}else{if(void 0!=a.additionalItems)if("boolean"==typeof a.additionalItems){if(!a.additionalItems)return(new f(g.ARRAY_ADDITIONAL_ITEMS,
"Additional items not allowed")).prefixWith(""+d,"additionalItems")}else if(c=this.validateAll(b[d],a.additionalItems,[d],["additionalItems"]))return c}else for(d=0;d<b.length;d++)if(c=this.validateAll(b[d],a.items,[d],["items"]))return c;return null};e.prototype.validateObject=function(b,a){return"object"!=typeof b||null==b||Array.isArray(b)?null:this.validateObjectMinMaxProperties(b,a)||this.validateObjectRequiredProperties(b,a)||this.validateObjectProperties(b,a)||this.validateObjectDependencies(b,
a)||null};e.prototype.validateObjectMinMaxProperties=function(b,a){var c=Object.keys(b);return void 0!=a.minProperties&&c.length<a.minProperties?(new f(g.OBJECT_PROPERTIES_MINIMUM,"Too few properties defined ("+c.length+"), minimum "+a.minProperties)).prefixWith(null,"minProperties"):void 0!=a.maxProperties&&c.length>a.maxProperties?(new f(g.OBJECT_PROPERTIES_MAXIMUM,"Too many properties defined ("+c.length+"), maximum "+a.maxProperties)).prefixWith(null,"maxProperties"):null};e.prototype.validateObjectRequiredProperties=
function(b,a){if(void 0!=a.required)for(var c=0;c<a.required.length;c++){var d=a.required[c];if(void 0===b[d])return(new f(g.OBJECT_REQUIRED,"Missing required property: "+d)).prefixWith(null,""+c).prefixWith(null,"required")}return null};e.prototype.validateObjectProperties=function(b,a){var c,d;for(d in b){var h=!1;if(void 0!=a.properties&&void 0!=a.properties[d]&&(h=!0,c=this.validateAll(b[d],a.properties[d],[d],["properties",d])))return c;if(void 0!=a.patternProperties)for(var e in a.patternProperties)if(RegExp(e).test(d)&&
(h=!0,c=this.validateAll(b[d],a.patternProperties[e],[d],["patternProperties",e])))return c;if(!h&&void 0!=a.additionalProperties)if("boolean"==typeof a.additionalProperties){if(!a.additionalProperties)return(new f(g.OBJECT_ADDITIONAL_PROPERTIES,"Additional properties not allowed")).prefixWith(d,"additionalProperties")}else if(c=this.validateAll(b[d],a.additionalProperties,[d],["additionalProperties"]))return c}return null};e.prototype.validateObjectDependencies=function(b,a){var c;if(void 0!=a.dependencies)for(var d in a.dependencies)if(void 0!==
b[d])if(c=a.dependencies[d],"string"==typeof c){if(void 0===b[c])return(new f(g.OBJECT_DEPENDENCY_KEY,"Dependency failed - key must exist: "+c)).prefixWith(null,d).prefixWith(null,"dependencies")}else if(Array.isArray(c))for(var e=0;e<c.length;e++){var j=c[e];if(void 0===b[j])return(new f(g.OBJECT_DEPENDENCY_KEY,"Dependency failed - key must exist: "+j)).prefixWith(null,""+e).prefixWith(null,d).prefixWith(null,"dependencies")}else if(c=this.validateAll(b,c,[],["dependencies",d]))return c;return null};
e.prototype.validateCombinations=function(b,a){return this.validateAllOf(b,a)||this.validateAnyOf(b,a)||this.validateOneOf(b,a)||this.validateNot(b,a)||null};e.prototype.validateAllOf=function(b,a){if(void 0==a.allOf)return null;for(var c,d=0;d<a.allOf.length;d++)if(c=this.validateAll(b,a.allOf[d],[],["allOf",d]))return c;return null};e.prototype.validateAnyOf=function(b,a){if(void 0==a.anyOf)return null;for(var c=[],d=this.errors.length,e=0;e<a.anyOf.length;e++){var j=this.errors.length,l=this.validateAll(b,
a.anyOf[e],[],["anyOf",e]);if(null==l&&j==this.errors.length)return this.errors=this.errors.slice(0,d),null;l&&c.push(l.prefixWith(null,""+e).prefixWith(null,"anyOf"))}c=c.concat(this.errors.slice(d));this.errors=this.errors.slice(0,d);return new f(g.ANY_OF_MISSING,'Data does not match any schemas from "anyOf"',"","/anyOf",c)};e.prototype.validateOneOf=function(b,a){if(void 0==a.oneOf)return null;for(var c=null,d=[],e=this.errors.length,j=0;j<a.oneOf.length;j++){var l=this.errors.length,k=this.validateAll(b,
a.oneOf[j],[],["oneOf",j]);if(null==k&&l==this.errors.length)if(null==c)c=j;else return this.errors=this.errors.slice(0,e),new f(g.ONE_OF_MULTIPLE,'Data is valid against more than one schema from "oneOf": indices '+c+" and "+j,"","/oneOf");else k&&d.push(k.prefixWith(null,""+j).prefixWith(null,"oneOf"))}return null==c?(d=d.concat(this.errors.slice(e)),this.errors=this.errors.slice(0,e),new f(g.ONE_OF_MISSING,'Data does not match any schemas from "oneOf"',"","/oneOf",d)):null};e.prototype.validateNot=
function(b,a){if(void 0==a.not)return null;var c=this.errors.length,d=this.validateAll(b,a.not),e=this.errors.slice(c);this.errors=this.errors.slice(0,c);return null==d&&0==e.length?new f(g.NOT_PASSED,'Data matches schema from "not"',"","/not"):null};var g={INVALID_TYPE:0,ENUM_MISMATCH:1,ANY_OF_MISSING:10,ONE_OF_MISSING:11,ONE_OF_MULTIPLE:12,NOT_PASSED:13,NUMBER_MULTIPLE_OF:100,NUMBER_MINIMUM:101,NUMBER_MINIMUM_EXCLUSIVE:102,NUMBER_MAXIMUM:103,NUMBER_MAXIMUM_EXCLUSIVE:104,STRING_LENGTH_SHORT:200,
STRING_LENGTH_LONG:201,STRING_PATTERN:202,OBJECT_PROPERTIES_MINIMUM:300,OBJECT_PROPERTIES_MAXIMUM:301,OBJECT_REQUIRED:302,OBJECT_ADDITIONAL_PROPERTIES:303,OBJECT_DEPENDENCY_KEY:304,ARRAY_LENGTH_SHORT:400,ARRAY_LENGTH_LONG:401,ARRAY_UNIQUE:402,ARRAY_ADDITIONAL_ITEMS:403};f.prototype={prefixWith:function(b,a){null!=b&&(b=b.replace("~","~0").replace("/","~1"),this.dataPath="/"+b+this.dataPath);null!=a&&(a=a.replace("~","~0").replace("/","~1"),this.schemaPath="/"+a+this.schemaPath);if(null!=this.subErrors)for(var c=
0;c<this.subErrors.length;c++)this.subErrors[c].prefixWith(b,a);return this}};var n=new e;s.tv4={validate:function(b,a){var c=new e(n);"string"==typeof a&&(a={$ref:a});c.addSchema("",a);var d=c.validateAll(b,a);this.error=d;this.missing=c.missing;return this.valid=null==d},validateResult:function(){var b={};this.validate.apply(b,arguments);return b},validateMultiple:function(b,a){var c=new e(n,!0);"string"==typeof a&&(a={$ref:a});c.addSchema("",a);c.validateAll(b,a);var d={};d.errors=c.errors;d.missing=
c.missing;d.valid=0==d.errors.length;return d},addSchema:function(b,a){return n.addSchema(b,a)},getSchema:function(b){return n.getSchema(b)},missing:[],error:null,normSchema:m,resolveUrl:p,errorCodes:g}})("undefined"!==typeof module&&module.exports?exports:this);

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc