You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
the validator throws an error if a string property is empty, e.g. phone = ''. I defined the property phone on the model as follows:
phone: {
type: 'string',
required: false,
}
I get the following error stack trace:
{ Error: ERROR_VALIDATION
at .../node_modules/neode/build/Services/Validator.js:297:23
at internals.Object._validateWithOptions (.../node_modules/@hapi/joi/lib/types/any/index.js:766:20)
at module.exports.internals.Any.root.validate (.../node_modules/@hapi/joi/lib/index.js:145:23)
at .../node_modules/neode/build/Services/Validator.js:295:21
at new Promise (<anonymous>)
at Validator (.../node_modules/neode/build/Services/Validator.js:294:10)
at .../node_modules/neode/build/Services/MergeOn.js:38:38
at processTicksAndRejections (internal/process/next_tick.js:81:5)
details:
[ { message: '"phone" is not allowed to be empty',
path: [Array],
type: 'any.empty',
context: [Object] } ],
input:
{ id: '3564889440353',
phone: '' },
_joiError:
{ ValidationError: child "phone" fails because ["phone" is not allowed to be empty]
at Object.exports.process (.../node_modules/@hapi/joi/lib/errors.js:202:19)
at internals.Object._validateWithOptions (.../node_modules/@hapi/joi/lib/types/any/index.js:763:31)
at module.exports.internals.Any.root.validate (.../node_modules/@hapi/joi/lib/index.js:145:23)
at .../node_modules/neode/build/Services/Validator.js:295:21
at new Promise (<anonymous>)
at Validator (.../node_modules/neode/build/Services/Validator.js:294:10)
at .../node_modules/neode/build/Services/MergeOn.js:38:38
at processTicksAndRejections (internal/process/next_tick.js:81:5)
isJoi: true,
name: 'ValidationError',
details: [ [Object] ],
_object:
{ id: '3564889440353',
phone: ''},
annotate: [Function] } }
I understand that this validation error comes from another library, however, I was wondering if there's a parameter which can be passed to enable empty strings. Otherwise, what is the desired outcome for required: false?
Thank you for sour support!
The text was updated successfully, but these errors were encountered:
I was able to suppress the TypeScript error message for validation with a //@ts-ignore comment
However, now I get the following error:
Error: Not sure how to validate validation on phone
at .../node_modules/neode/build/Services/Validator.js:273:15
at Array.forEach (<anonymous>)
at .../node_modules/neode/build/Services/Validator.js:247:25
at Array.forEach (<anonymous>)
at BuildValidationSchema (.../node_modules/neode/build/Services/Validator.js:165:23)
at Validator (.../node_modules/neode/build/Services/Validator.js:293:16)
at .../node_modules/neode/build/Services/MergeOn.js:38:38
at processTicksAndRejections (internal/process/next_tick.js:81:5)
Hi,
the validator throws an error if a string property is empty, e.g.
phone = ''
. I defined the propertyphone
on the model as follows:I get the following error stack trace:
I understand that this validation error comes from another library, however, I was wondering if there's a parameter which can be passed to enable empty strings. Otherwise, what is the desired outcome for
required: false
?Thank you for sour support!
The text was updated successfully, but these errors were encountered: