Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const validationSchema = Joi.object({
- productId: Joi.number().required(),
- host: Joi.string().required(),
- username: Joi.string().required().description('username required field'),
- password: Joi.string().required().description('password required field'),
- rootFolder: Joi.string().required().description('rootFolder required field')
- })
- .unknown()
- .required();
- const { error, value: validatedPayload } = Joi.validate(payload, validationSchema);
- if (error) {
- throw new Error(`${error}`);
- }
- console.log(validatedPayload);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement