better-ajv-errors
Advanced tools
Comparing version 0.5.7 to 0.6.0
@@ -6,6 +6,10 @@ "use strict"; | ||
exports.__esModule = true; | ||
exports.getMetaFromPath = void 0; | ||
exports.getDecoratedDataPath = exports.getMetaFromPath = void 0; | ||
var _getMetaFromPath = _interopRequireDefault(require("./get-meta-from-path")); | ||
exports.getMetaFromPath = _getMetaFromPath.default; | ||
exports.getMetaFromPath = _getMetaFromPath.default; | ||
var _getDecoratedDataPah = _interopRequireDefault(require("./get-decorated-data-pah")); | ||
exports.getDecoratedDataPath = _getDecoratedDataPah.default; |
@@ -49,3 +49,4 @@ "use strict"; | ||
return Object.assign({}, this.getLocation(`${dataPath}/${params.additionalProperty}`), { | ||
error: `Property ${params.additionalProperty} is not expected to be here` | ||
error: `${this.getDecoratedPath(dataPath)} Property ${params.additionalProperty} is not expected to be here`, | ||
path: dataPath | ||
}); | ||
@@ -52,0 +53,0 @@ }; |
@@ -51,2 +51,11 @@ "use strict"; | ||
_proto.getDecoratedPath = function getDecoratedPath(dataPath) { | ||
if (dataPath === void 0) { | ||
dataPath = this.options.dataPath; | ||
} | ||
var decoratedPath = (0, _json.getDecoratedDataPath)(this.jsonAst, dataPath); | ||
return decoratedPath; | ||
}; | ||
_proto.getCodeFrame = function getCodeFrame(message, dataPath) { | ||
@@ -53,0 +62,0 @@ if (dataPath === void 0) { |
@@ -41,3 +41,4 @@ "use strict"; | ||
return Object.assign({}, this.getLocation(), { | ||
error: `${dataPath}: ${keyword} ${message}` | ||
error: `${this.getDecoratedPath(dataPath)}: ${keyword} ${message}`, | ||
path: dataPath | ||
}); | ||
@@ -44,0 +45,0 @@ }; |
@@ -51,3 +51,4 @@ "use strict"; | ||
var output = Object.assign({}, this.getLocation(), { | ||
error: `${dataPath} ${message}: ${params.allowedValues.join(', ')}` | ||
error: `${this.getDecoratedPath(dataPath)} ${message}: ${params.allowedValues.join(', ')}`, | ||
path: dataPath | ||
}); | ||
@@ -54,0 +55,0 @@ |
@@ -51,6 +51,6 @@ "use strict"; | ||
message = _this$options2.message, | ||
dataPath = _this$options2.dataPath, | ||
params = _this$options2.params; | ||
dataPath = _this$options2.dataPath; | ||
return Object.assign({}, this.getLocation(), { | ||
error: `${dataPath} ${message}` | ||
error: `${this.getDecoratedPath(dataPath)} ${message}`, | ||
path: dataPath | ||
}); | ||
@@ -57,0 +57,0 @@ }; |
"use strict"; | ||
exports.__esModule = true; | ||
exports.getMetaFromPath = void 0; | ||
exports.getDecoratedDataPath = exports.getMetaFromPath = void 0; | ||
@@ -10,2 +10,6 @@ var _getMetaFromPath = _interopRequireDefault(require("./get-meta-from-path")); | ||
var _getDecoratedDataPah = _interopRequireDefault(require("./get-decorated-data-pah")); | ||
exports.getDecoratedDataPath = _getDecoratedDataPah.default; | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } |
@@ -34,3 +34,4 @@ "use strict"; | ||
return Object.assign({}, this.getLocation(`${dataPath}/${params.additionalProperty}`), { | ||
error: `Property ${params.additionalProperty} is not expected to be here` | ||
error: `${this.getDecoratedPath(dataPath)} Property ${params.additionalProperty} is not expected to be here`, | ||
path: dataPath | ||
}); | ||
@@ -37,0 +38,0 @@ } |
@@ -40,2 +40,7 @@ "use strict"; | ||
getDecoratedPath(dataPath = this.options.dataPath) { | ||
const decoratedPath = (0, _json.getDecoratedDataPath)(this.jsonAst, dataPath); | ||
return decoratedPath; | ||
} | ||
getCodeFrame(message, dataPath = this.options.dataPath) { | ||
@@ -42,0 +47,0 @@ return (0, _codeFrame.codeFrameColumns)(this.jsonRaw, this.getLocation(dataPath), { |
@@ -29,3 +29,4 @@ "use strict"; | ||
return Object.assign({}, this.getLocation(), { | ||
error: `${dataPath}: ${keyword} ${message}` | ||
error: `${this.getDecoratedPath(dataPath)}: ${keyword} ${message}`, | ||
path: dataPath | ||
}); | ||
@@ -32,0 +33,0 @@ } |
@@ -39,3 +39,4 @@ "use strict"; | ||
const output = Object.assign({}, this.getLocation(), { | ||
error: `${dataPath} ${message}: ${params.allowedValues.join(', ')}` | ||
error: `${this.getDecoratedPath(dataPath)} ${message}: ${params.allowedValues.join(', ')}`, | ||
path: dataPath | ||
}); | ||
@@ -42,0 +43,0 @@ |
@@ -34,7 +34,7 @@ "use strict"; | ||
message, | ||
dataPath, | ||
params | ||
dataPath | ||
} = this.options; | ||
return Object.assign({}, this.getLocation(), { | ||
error: `${dataPath} ${message}` | ||
error: `${this.getDecoratedPath(dataPath)} ${message}`, | ||
path: dataPath | ||
}); | ||
@@ -41,0 +41,0 @@ } |
{ | ||
"name": "better-ajv-errors", | ||
"version": "0.5.7", | ||
"version": "0.6.0", | ||
"description": "JSON Schema validation for Human", | ||
@@ -72,3 +72,3 @@ "repository": "torifat/better-ajv-errors", | ||
"testMatch": [ | ||
"<rootDir>/src/**/__tests__/*.js" | ||
"<rootDir>/src/**/__tests__/**/*.js" | ||
] | ||
@@ -75,0 +75,0 @@ }, |
45917
31
1064