-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Closed
Labels
breaking changesChange that can breaking existing codeChange that can breaking existing codefeatureNew functionality or improvementNew functionality or improvement
Milestone
Description
Describe the problem you are trying to fix (provide as much context as possible)
Let's assume I have this validation schema :
Joi.object().keys({
foo : Joi.number()
});With this schema both of this object will be validated since Joi works with number as strings :
let a = {foo : 42};
let b = {foo: "42"};It's perfectly right for me, but the problem comes when I'm trying to work with the valid() method :
Joi.object().keys({
foo : Joi.number().valid([41, 42, 43])
});
//this schema will validate the a object but not the b objectIs there any way to validate the b object in a more elegant way than :
Joi.object().keys({
foo : Joi.number().valid([41, 42, 43, "41", "42", "43"])
});Which API (or modification of the current API) do you suggest to solve that problem ?
Maybe add a flag to the valid method ?
Are you ready to work on a pull request if your suggestion is accepted ?
Yes
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
breaking changesChange that can breaking existing codeChange that can breaking existing codefeatureNew functionality or improvementNew functionality or improvement