another-json-schema
Advanced tools
Comparing version 1.1.0 to 1.1.1
@@ -209,3 +209,8 @@ 'use strict'; | ||
if (helper) { | ||
error = new Error('(' + ctx._path + ': ' + JSON.stringify(value) + ') ✖ (' + helper + ': ' + ctx._children[helper] + ')'); | ||
var helperEntry = ctx._children[helper]; | ||
if ('function' === typeof helperEntry) { | ||
error = new Error('(' + ctx._path + ': ' + JSON.stringify(value) + ') ✖ (' + helper + ': ' + helperEntry.name + ')'); | ||
} else { | ||
error = new Error('(' + ctx._path + ': ' + JSON.stringify(value) + ') ✖ (' + helper + ': ' + helperEntry + ')'); | ||
} | ||
error.validator = helper; | ||
@@ -212,0 +217,0 @@ } else { |
{ | ||
"name": "another-json-schema", | ||
"version": "1.1.0", | ||
"version": "1.1.1", | ||
"description": "Another JSON Schema, simple & flexible & intuitive.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -146,3 +146,3 @@ ### another-json-schema | ||
var newSchema = new AJS(); | ||
var userSchema = newSchema.compile({ | ||
var userSchema = newSchema.compile('userSchema', { | ||
_id: { type: 'string', pattern: /^[0-9a-z]{24}$/ }, | ||
@@ -159,4 +159,10 @@ name: { type: 'string', required: true }, | ||
- valid: {Boolean} | ||
- valid: {Boolean} wether a valid json | ||
- error: {Error|null} | ||
- message: error message, eg: `($.comments[].user._id: "wrong_id") ✖ (pattern: /^[0-9a-z]{24}$/)` | ||
- validator: validator name, eg: `pattern`, | ||
- actual: actual value, eg: `wrong_id`, | ||
- expected: expected schema, eg: `{ type: 'string', pattern: /^[0-9a-z]{24}$/ }`, | ||
- path: path in object, eg: `$.comments[].user._id`, | ||
- schema: schema name, eg: `userSchema` | ||
- result: {Any} | ||
@@ -169,11 +175,2 @@ | ||
error: | ||
- message: error message, eg: `($.comments[].user._id: "wrong_id") ✖ (pattern: /^[0-9a-z]{24}$/)` | ||
- validator: validator name, eg: `pattern`, | ||
- actual: actual value, eg: `wrong_id`, | ||
- expected: expected schema, eg: `{ type: 'string', pattern: /^[0-9a-z]{24}$/ }`, | ||
- path: path in object, eg: `$.comments[].user._id`, | ||
- schema: schema name, eg: `userSchema` | ||
### More examples | ||
@@ -180,0 +177,0 @@ |
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
32236
885
197