title: Joi validation - how to make a field optional based on input
body: <p>I've been trying to implement the following joi validation.</p>
  
  <pre><code>joiSchema = Joi.object().keys({
        taskno: Joi.string().alphanum().required().uppercase().trim(),
        taskstatus: Joi.valid('G', 'C', 'I', 'S'),
        taskpriority: Joi.number().integer().max(5).min(1),
        stuckreason: Joi.string().allow('').max(200).trim(),
        dttarget: Joi.date().iso(),
        dtdue: Joi.date().iso(),
        dtcomplete: Joi.when('taskstatus', {
          is: Joi.valid('C', 'I'),
          then: Joi.date().iso().required(),
        })
      });
  </code></pre>
  
  <p>My object contains taskno, dttarget and dtdue and I only want to validate this. <br>
  If i <code>joi.validate()</code> object it returns error <em>"dtcomplete is required"</em>. <br>
  Is there a way to optionally check <em>"dtcomplete"</em></p>