jsonpolice
Advanced tools
Comparing version 8.1.1 to 8.2.0
@@ -6,2 +6,8 @@ export declare class SchemaError extends Error { | ||
} | ||
export interface ValidationErrorInfo { | ||
type: string; | ||
path?: string; | ||
scope?: string; | ||
errors?: ValidationErrorInfo[]; | ||
} | ||
export declare class ValidationError extends Error { | ||
@@ -12,2 +18,4 @@ path: string; | ||
constructor(path: string, scope: string, type: string, errors?: Error[] | undefined); | ||
getInfo(): ValidationErrorInfo; | ||
static getInfo(err: Error): ValidationErrorInfo; | ||
} |
@@ -23,4 +23,19 @@ "use strict"; | ||
} | ||
getInfo() { | ||
return ValidationError.getInfo(this); | ||
} | ||
static getInfo(err) { | ||
const out = { type: err.message }; | ||
if (err.name === 'ValidationError') { | ||
const verr = err; | ||
out.path = verr.path; | ||
out.scope = verr.scope; | ||
if (verr.errors) { | ||
out.errors = verr.errors.map((e) => ValidationError.getInfo(e)); | ||
} | ||
} | ||
return out; | ||
} | ||
} | ||
exports.ValidationError = ValidationError; | ||
//# sourceMappingURL=errors.js.map |
@@ -10,3 +10,3 @@ "use strict"; | ||
var __exportStar = (this && this.__exportStar) || function(m, exports) { | ||
for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p); | ||
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); | ||
}; | ||
@@ -13,0 +13,0 @@ Object.defineProperty(exports, "__esModule", { value: true }); |
{ | ||
"name": "jsonpolice", | ||
"version": "8.1.1", | ||
"version": "8.2.0", | ||
"description": "JSON Schema parser and validator", | ||
@@ -50,26 +50,26 @@ "main": "dist/index.js", | ||
"devDependencies": { | ||
"@commitlint/config-conventional": "^8.3.4", | ||
"@types/chai": "^4.2.7", | ||
"@types/chai-as-promised": "^7.1.2", | ||
"@types/chai-spies": "^1.0.1", | ||
"@types/mocha": "^5.2.7", | ||
"@types/node": "^13.1.4", | ||
"@commitlint/config-conventional": "^9.1.2", | ||
"@types/chai": "^4.2.12", | ||
"@types/chai-as-promised": "^7.1.3", | ||
"@types/chai-spies": "^1.0.2", | ||
"@types/mocha": "^8.0.3", | ||
"@types/node": "^14.6.2", | ||
"chai": "^4.2.0", | ||
"chai-as-promised": "^7.1.1", | ||
"chai-spies": "^1.0.0", | ||
"commitizen": "^4.0.3", | ||
"commitlint": "^8.3.4", | ||
"coveralls": "^3.0.9", | ||
"cz-conventional-changelog": "^3.0.2", | ||
"husky": "^4.0.1", | ||
"mocha": "^7.0.0", | ||
"mochawesome": "^4.1.0", | ||
"nyc": "^15.0.0", | ||
"rimraf": "^3.0.0", | ||
"semantic-release": "^15.14.0", | ||
"typescript": "^3.7.4" | ||
"commitizen": "^4.2.1", | ||
"commitlint": "^9.1.2", | ||
"coveralls": "^3.1.0", | ||
"cz-conventional-changelog": "^3.3.0", | ||
"husky": "^4.2.5", | ||
"mocha": "^8.1.3", | ||
"mochawesome": "^6.1.1", | ||
"nyc": "^15.1.0", | ||
"rimraf": "^3.0.2", | ||
"semantic-release": "^17.1.1", | ||
"typescript": "^4.0.2" | ||
}, | ||
"dependencies": { | ||
"jsonref": "^5.2.1", | ||
"lodash": "^4.17.15" | ||
"jsonref": "^5.3.0", | ||
"lodash": "^4.17.20" | ||
}, | ||
@@ -76,0 +76,0 @@ "config": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
41898
822
Updatedjsonref@^5.3.0
Updatedlodash@^4.17.20