koa2-validation icon indicating copy to clipboard operation
koa2-validation copied to clipboard

Not work with last Joi version (16.*.*)

Open repsak opened this issue 6 years ago • 3 comments

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

repsak avatar Dec 09 '19 08:12 repsak

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?

repsak avatar Dec 09 '19 09:12 repsak

how to fix it?

Ha2ryZhang avatar Sep 05 '20 09:09 Ha2ryZhang

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.

milgner avatar Oct 01 '20 18:10 milgner