Not work with last Joi version (16.*.*)
In the latest version of the Joi, the validation method is called in the schema context, instead of the usual library context
Examples
Before:
Joi.validate(value, schema, [options], [callback])
After:
schema.validate(data)
I had to make a hack for myself
const result = schema[item].validate(toValidateObj, options); instead const result = this.Joi.validate(toValidateObj, schema[item], options);
PS I apologize for my English
I noticed that the version of @hapi/joi in the koa2-validation package is currently 15.1.1 In the repository on the github she is 16.1.7 Did the assembly break?
how to fix it?
Upstream joi (not @hapi/joi anymore) is at v17 already. The published version uses 15.1.1 and I could only get it to run after downgrading my dependency to 15.1.1, too.