Open repsak opened 4 years ago
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.
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);
insteadconst result = this.Joi.validate(toValidateObj, schema[item], options);
PS I apologize for my English