We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I am expecting error in this case, but the validation is getting success.
Joi.object({ isTemplate: Joi.boolean().optional().valid(true, false), fileId: Joi.string().optional(), req:Joi.object({ template: Joi.alternatives().conditional('isTemplate', { is: Joi.valid(true), then: Joi.string().required(), otherwise: Joi.string().optional(), }) }) }); Sample data: { isTemplate: true, fileId: "435" }
The text was updated successfully, but these errors were encountered:
You need to add .required() to the req: Joi.object(/* ... */) part:
.required()
req: Joi.object(/* ... */)
Joi.object({ isTemplate: Joi.boolean().optional().valid(true, false), fileId: Joi.string().optional(), req:Joi.object({ template: Joi.alternatives().conditional('isTemplate', { is: Joi.valid(true), then: Joi.string().required(), otherwise: Joi.string().optional(), }) }).required() });
Sorry, something went wrong.
@MallRoy change .alternatives().conditional to .when and viola
.alternatives().conditional
.when
No branches or pull requests
Support plan
Context
How can we help?
I am expecting error in this case, but the validation is getting success.
The text was updated successfully, but these errors were encountered: