How to use the exist function from joi

Find comprehensive JavaScript joi.exist code examples handpicked from public code repositorys.

70
71
72
73
74
75
76
77
78
79
super();

const configJoi = joi.object({
    zookeeper: joi.object({
        connectionString: joi.string().required(),
    }).when('kafka.backlogMetrics', { is: joi.exist(), then: joi.required() }),
    kafka: joi.object({
        hosts: joi.string().required(),
        backlogMetrics: {
            zkPath: joi.string().required(),
fork icon18
star icon51
watch icon60

3283
3284
3285
3286
3287
3288
3289
3290
3291
.max(MAX_ATTACHMENT_SIZE)
.required()
.example('R0lGODlhAQABAIAAAP///wAAACwAAAAAAQABAAACAkQBADs=')
.description('Base64 formatted attachment file')
.when('reference', {
    is: Joi.exist().not(false, null),
    then: Joi.forbidden(),
    otherwise: Joi.required()
}),
fork icon113
star icon0
watch icon16

+ 80 other calls in file

197
198
199
200
201
202
203
204
205
206
).required(),
petitionFile: joi.object().required(), // object of type File
petitionFileSize: JoiValidationConstants.MAX_FILE_SIZE_BYTES.when(
  'petitionFile',
  {
    is: joi.exist().not(null),
    otherwise: joi.optional().allow(null),
    then: joi.required(),
  },
),
fork icon36
star icon72
watch icon19

+ 27 other calls in file

491
492
493
494
495
496
497
498
499
500
  .meta({
    tags: ['Restricted'],
  }),
caseType: JoiValidationConstants.STRING.valid(...CASE_TYPES).required(),
closedDate: JoiValidationConstants.ISO_DATE.when('status', {
  is: joi.exist().valid(...CLOSED_CASE_STATUSES),
  otherwise: joi.optional(),
  then: joi.required(),
}),
correspondence: joi
fork icon36
star icon72
watch icon19

+ 15 other calls in file