another-json-schema
Advanced tools
Comparing version 3.3.0 to 3.4.0
@@ -0,1 +1,6 @@ | ||
## 3.4.0/2018-01-09 | ||
- fix validate logic, even pass `required: false` or `default: false`, still check type & other validators | ||
- upgrade deps | ||
## 3.3.0/2018-01-08 | ||
@@ -2,0 +7,0 @@ |
14
index.js
@@ -186,4 +186,2 @@ const helpersFuncs = require('./helpers') | ||
value = parent[key] | ||
} else { | ||
return value | ||
} | ||
@@ -199,12 +197,10 @@ } | ||
} | ||
} else { | ||
return value | ||
} | ||
} else { | ||
// no required, and value is null, then pass | ||
if (value == null) { | ||
return | ||
} | ||
} | ||
// null will return, not check type & other validators | ||
if (value == null) { | ||
return value | ||
} | ||
// then check type | ||
@@ -211,0 +207,0 @@ try { |
{ | ||
"name": "another-json-schema", | ||
"version": "3.3.0", | ||
"version": "3.4.0", | ||
"description": "Another JSON Schema, simple & flexible & intuitive.", | ||
@@ -25,14 +25,14 @@ "main": "index.js", | ||
"devDependencies": { | ||
"eslint-config-standard": "10.2.1", | ||
"eslint-plugin-import": "2.7.0", | ||
"eslint-plugin-node": "5.2.0", | ||
"eslint-plugin-promise": "3.5.0", | ||
"eslint-config-standard": "11.0.0-beta.0", | ||
"eslint-plugin-import": "2.8.0", | ||
"eslint-plugin-node": "5.2.1", | ||
"eslint-plugin-promise": "3.6.0", | ||
"eslint-plugin-standard": "3.0.1", | ||
"intelli-espower-loader": "1.0.1", | ||
"istanbul": "^0.4.2", | ||
"mocha": "^2.4.5", | ||
"mongodb": "2.2.33", | ||
"istanbul": "^0.4.5", | ||
"mocha": "^4.1.0", | ||
"mongodb": "3.0.1", | ||
"power-assert": "1.4.4", | ||
"validator": "9.0.0" | ||
"validator": "9.2.0" | ||
} | ||
} |
@@ -264,2 +264,13 @@ const AJS = require('..') | ||
}) | ||
assert.deepEqual(schema.validate({ name: 1 }, { required: false }), { | ||
valid: false, | ||
error: | ||
{ | ||
validator: 'type', | ||
path: '$.name', | ||
actual: 1, | ||
expected: { type: 'string', required: true }, | ||
schema: 'requiredSchema' }, | ||
result: { name: 1 } }) | ||
assert.deepEqual(schema.validate({ name: 'nswbmw' }), { valid: true, error: null, result: { name: 'nswbmw' } }) | ||
@@ -266,0 +277,0 @@ assert.deepEqual(schema.validate({}), { valid: false, |
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
44559
1143