title: Joi array Object validation based on root key value
body: <p>I have a complex scenario that I want to validate using <code>Joi</code>
  here sample Joi Object Schema</p>
  
  <pre><code>const itemSchema = Joi.object({
      product_id: Joi.string().required(),
      quantity: Joi.number().required().min(0)
  });
  
  let objSchema = {
      items: Joi.array().items(itemSchema).required().min(1),
      item_return_flag: Joi.string().optional().valid(true, false)
  };
  </code></pre>
  
  <p>depending opon <code>item_return_flag</code> key value <code>true</code> or <code>false</code>, I want to change the <code>items.quantity</code> min value requirement. When <code>true</code>, quantity will be 0 , otherwise it will be 1.</p>
  
  <p>Is there anyway, to control the definition of validation of the object in an array, based on the root object in <code>Joi</code></p>