Updated the validateSchema util

This commit is contained in:
2023-01-08 03:25:12 +01:00
parent cb441df58b
commit e6b11fee5f
5 changed files with 13 additions and 13 deletions

View File

@ -1,5 +1,5 @@
module.exports.validateSchema = (schema, object) => {
const {error} = schema.validate(object, {errors: {wrap: {label: ''}}});
return error ? error.details[0].message : undefined;
}
return error ? {message: error.details[0].message, field: error.details[0].path[0]}: undefined;
}