@spinajs/validation
Advanced tools
Comparing version 1.2.88 to 1.2.103
@@ -44,6 +44,7 @@ "use strict"; | ||
Load() { | ||
if (!this.SchemaDirs) | ||
return []; | ||
return this.SchemaDirs.filter((dir) => fs.existsSync(dir)) | ||
.flatMap((d) => glob.sync(path.join(d, '/**/*.+(json|js)'))) | ||
.map((f) => { | ||
//Log.trace(`Found schema at: ${f}`, 'validation'); | ||
return { | ||
@@ -50,0 +51,0 @@ schema: require(f), |
@@ -84,3 +84,3 @@ "use strict"; | ||
let schema = null; | ||
if (!data) { | ||
if (data === null || data === undefined) { | ||
schema = Reflect.getMetadata(decorators_1.SCHEMA_SYMBOL, schemaOrData); | ||
@@ -100,21 +100,19 @@ } | ||
} | ||
if (!schema) { | ||
if (!schema) { | ||
return [ | ||
false, | ||
[ | ||
{ | ||
keyword: 'empty_schema', | ||
instancePath: './', | ||
schemaPath: '', | ||
params: { data: '' }, | ||
}, | ||
], | ||
]; | ||
if (schema) { | ||
// return [ | ||
// false, | ||
// [ | ||
// { | ||
// keyword: 'empty_schema', | ||
// instancePath: './', | ||
// schemaPath: '', | ||
// params: { data: '' }, | ||
// }, | ||
// ], | ||
// ]; | ||
const result = this.Validator.validate(schema, data ? data : schemaOrData); | ||
if (!result) { | ||
return [false, (_c = this.Validator.errors) !== null && _c !== void 0 ? _c : null]; | ||
} | ||
} | ||
const result = this.Validator.validate(schema, data ? data : schemaOrData); | ||
if (!result) { | ||
return [false, (_c = this.Validator.errors) !== null && _c !== void 0 ? _c : null]; | ||
} | ||
return [true, null]; | ||
@@ -121,0 +119,0 @@ } |
{ | ||
"name": "@spinajs/validation", | ||
"version": "1.2.88", | ||
"version": "1.2.103", | ||
"description": "validation library for spinajs framework", | ||
@@ -44,3 +44,3 @@ "main": "lib/index.js", | ||
"@spinajs/exceptions": "^1.2.81", | ||
"@spinajs/log": "^1.2.88", | ||
"@spinajs/log": "^1.2.103", | ||
"ajv": "^8.8.2", | ||
@@ -52,3 +52,3 @@ "ajv-formats": "^2.1.1", | ||
}, | ||
"gitHead": "7c42b937cd76ac16d6af25d7d503eb1a93ce5271" | ||
"gitHead": "18a08cf4cd3e4d2c728d2d372e3a42ddde071be8" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
26465
465
Updated@spinajs/log@^1.2.103