configurapi-handler-json
Advanced tools
Comparing version 1.0.8 to 1.0.9
{ | ||
"name": "configurapi-handler-json", | ||
"version": "1.0.8", | ||
"version": "1.0.9", | ||
"description": "Configurapi request handlers for JSON requests/responses", | ||
@@ -5,0 +5,0 @@ "main": "src/index", |
@@ -9,2 +9,3 @@ const Ajv = require('ajv'); | ||
let error = undefined; | ||
let errorDetails = undefined; | ||
@@ -16,2 +17,8 @@ try | ||
isValid = validator.validate(schema, data); | ||
if(isValid === false) | ||
{ | ||
error = validator.errorsText(); | ||
errorDetails = validator.errors; | ||
} | ||
} | ||
@@ -23,3 +30,3 @@ catch(e) | ||
callback(error, isValid); | ||
callback(error, errorDetails, isValid); | ||
} | ||
@@ -41,3 +48,3 @@ | ||
{ | ||
validate(schemaText, event.payload, (error, isValid) => | ||
validate(schemaText, event.payload, (error, errorDetails, isValid) => | ||
{ | ||
@@ -50,3 +57,3 @@ if(isValid) | ||
{ | ||
event.response = new ErrorResponse(error || 'Bad request', 400) | ||
event.response = new ErrorResponse(error || 'Bad request', 400, errorDetails); | ||
this.complete(); | ||
@@ -53,0 +60,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
5303
96