-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Closed
Labels
featureNew functionality or improvementNew functionality or improvement
Milestone
Description
Describe the problem you are trying to fix (provide as much context as possible)
From the discussion here:
per @genediazjr
I'm thinking of an API for Joi that would allow a default value similar to any.default() but only if the original value is invalid. The value key on the error object will contain the set infInvalid value instead of the original value. Or we can put it on separate key whichever would be better.
Which API (or modification of the current API) do you suggest to solve that problem ?
I would like to propose adding an optional config param to .default():
Joi.string().default('name', { invalid: true })
Are you ready to work on a pull request if your suggestion is accepted ?
Yes.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
featureNew functionality or improvementNew functionality or improvement