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
constextension=(joi)=>({type: 'objectId',base: Joi.string(),messages: {'mongoId.not': '"{{#label}}" must be object Id'},validate(schema,value,helpers){if(!mongoose.Types.ObjectId.isValid(value.original)){return{ value,errors: helpers.error('mongoId.not')};// helpers is undefined here, an error is thrown}return{ value,errors: null};}});constcustom=Joi.extend(extension);
What was the result you got?
Error in the validate method "Cannot read property "error" of undefined"
What result did you expect?
A 3rd argument with helerp functions.
The text was updated successfully, but these errors were encountered:
This thread has been automatically locked due to inactivity. Please open a new issue for related bugs or questions following the new issue template instructions.
lockbot
locked as resolved and limited conversation to collaborators
Jan 9, 2020
Support plan
Context
What are you trying to achieve or the steps to reproduce?
When extending joi, the documentation (https://hapi.dev/family/joi/?v=16.1.7#extensions) says that validate method takes helpers as 3rd argument, though undefined is passed.
What was the result you got?
Error in the validate method "Cannot read property "error" of undefined"
What result did you expect?
A 3rd argument with helerp functions.
The text was updated successfully, but these errors were encountered: