Home > other >  Joi Validator must valid at least given value, but other will also allowed
Joi Validator must valid at least given value, but other will also allowed

Time:04-01

 Joi.object().keys({
              myObject: Joi.array().items(Joi.object().keys({
                key: Joi.string().valid('fristName','lastName'),
                value: Joi.any().required(),
              })),
            });

Here I want must required 'firstName' and 'lastName' but other will also allowed.

CodePudding user response:

I don't know your context, but i think thats it should help you. .unknown() method

CodePudding user response:

You can otherwise with validation refer otherwise api to solve it.

  • Related