better-ajv-errors
Advanced tools
Comparing version 0.6.7 to 0.7.0
# better-ajv-errors | ||
## 0.7.0 | ||
### Minor Changes | ||
- 4e6e4c7: Support json option to get accurate line/column listings | ||
## 0.6.7 | ||
@@ -4,0 +10,0 @@ |
@@ -23,4 +23,6 @@ "use strict"; | ||
_options$indent = _options.indent, | ||
indent = _options$indent === void 0 ? null : _options$indent; | ||
var jsonRaw = JSON.stringify(data, null, indent); | ||
indent = _options$indent === void 0 ? null : _options$indent, | ||
_options$json = _options.json, | ||
json = _options$json === void 0 ? null : _options$json; | ||
var jsonRaw = json || JSON.stringify(data, null, indent); | ||
var jsonAst = (0, _jsonToAst.default)(jsonRaw, { | ||
@@ -27,0 +29,0 @@ loc: true |
@@ -26,3 +26,3 @@ "use strict"; | ||
_regenerator.default.mark(function _callee(name, dirPath) { | ||
var schemaPath, schema, dataPath, data; | ||
var schemaPath, schema, dataPath, json, data; | ||
return _regenerator.default.wrap(function _callee$(_context) { | ||
@@ -43,6 +43,7 @@ while (1) { | ||
dataPath = _context.sent; | ||
data = JSON.parse((0, _fs.readFileSync)(dataPath, 'utf8')); | ||
return _context.abrupt("return", [schema, data]); | ||
json = (0, _fs.readFileSync)(dataPath, 'utf8'); | ||
data = JSON.parse(json); | ||
return _context.abrupt("return", [schema, data, json]); | ||
case 9: | ||
case 10: | ||
case "end": | ||
@@ -49,0 +50,0 @@ return _context.stop(); |
@@ -15,5 +15,6 @@ "use strict"; | ||
format = 'cli', | ||
indent = null | ||
indent = null, | ||
json = null | ||
} = options; | ||
const jsonRaw = JSON.stringify(data, null, indent); | ||
const jsonRaw = json || JSON.stringify(data, null, indent); | ||
const jsonAst = (0, _jsonToAst.default)(jsonRaw, { | ||
@@ -20,0 +21,0 @@ loc: true |
@@ -16,4 +16,5 @@ "use strict"; | ||
const dataPath = await (0, _jestFixtures.getFixturePath)(dirPath, name, 'data.json'); | ||
const data = JSON.parse((0, _fs.readFileSync)(dataPath, 'utf8')); | ||
return [schema, data]; | ||
const json = (0, _fs.readFileSync)(dataPath, 'utf8'); | ||
const data = JSON.parse(json); | ||
return [schema, data, json]; | ||
} |
{ | ||
"name": "better-ajv-errors", | ||
"version": "0.6.7", | ||
"version": "0.7.0", | ||
"description": "JSON Schema validation for Human", | ||
@@ -78,2 +78,2 @@ "repository": "atlassian/better-ajv-errors", | ||
} | ||
} | ||
} |
@@ -107,2 +107,12 @@ <h1 align="center"> | ||
If you have an unindented JSON payload and you want the error output indented | ||
If you have an unindented JSON payload and you want the error output indented. | ||
This option have no effect when using the `json` option. | ||
##### json | ||
Type: `string` `null` | ||
Default: `null` | ||
Raw JSON payload used when formatting codeframe. | ||
Gives accurate line and column listings. |
@@ -12,2 +12,5 @@ import { ErrorObject } from 'ajv'; | ||
indent?: number | null; | ||
/** Raw JSON used when highlighting error location */ | ||
json?: string | null; | ||
} | ||
@@ -14,0 +17,0 @@ |
49449
1217
118