joi validation 22joi when 28 29 22

Solutions on MaxInterview for joi validation 22joi when 28 29 22 by the best coders in the world

showing results for - "joi validation 22joi when 28 29 22"
Isidora
31 Jul 2018
1Joi.object().keys({
2    contact: Joi.object().keys({
3        first_name: Joi.string(),
4        last_name: Joi.string(),
5        phone: Joi.string(),
6    }),
7    address: Joi.object().keys({
8        place: Joi.string(),
9        city: Joi.string().min(2).max(30),
10        street: Joi.string(),
11        house_number: Joi.string()
12    }).when('contact', {
13        is: Joi.object().keys({
14            first_name: Joi.exist(),
15            last_name: Joi.exist(),
16            phone: Joi.exist(),
17        }),
18        then: Joi.object({ place: Joi.required() }).required(),
19        otherwise: Joi.object({ place: Joi.forbidden() })
20    }),
21    passengers_amount: Joi.number(),
22    notes: Joi.string()
23});
24