Advertisement
Guest User

Untitled

a guest
Oct 12th, 2017
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. const validationSchema = Joi.object({
  2. productId: Joi.number().required(),
  3. host: Joi.string().required(),
  4. username: Joi.string().required().description('username required field'),
  5. password: Joi.string().required().description('password required field'),
  6. rootFolder: Joi.string().required().description('rootFolder required field')
  7. })
  8. .unknown()
  9. .required();
  10.  
  11. const { error, value: validatedPayload } = Joi.validate(payload, validationSchema);
  12. if (error) {
  13. throw new Error(`${error}`);
  14. }
  15.  
  16. console.log(validatedPayload);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement