joi complex when

Solutions on MaxInterview for joi complex when by the best coders in the world

showing results for - "joi complex when"
Erika
09 Aug 2018
1// a === 'avalue' || b === 'bvalue'
2
3var schema = {
4    a: Joi.string(),
5    b: Joi.string(),
6    c: Joi.string().when('a', { is: 'avalue', then: Joi.string().required() }).concat(Joi.string().when('b', { is: 'bvalue', then: Joi.string().required() }))
7};
8
9// a === 'avalue' && b === 'bvalue'
10
11var schema = {
12  a: Joi.string(),
13  b: Joi.string(),
14  c: Joi.string().when(
15    'a', {
16      is: 'avalue',
17      then: Joi.when(
18        'b', {
19          is: 'bvalue',
20          then: Joi.string().required()
21        }
22      )
23    }
24  )
25};
queries leading to this page
joi complex whenjoi complex when