title: One route, two valid payloads in Hapi.js with Joi
body: <p>I'm trying to validate two different payload schemas on the same route. The two valid options are:</p>
  
  <pre><code>validate: {
    payload: {
      email: Joi.string().required(),
      password: Joi.string().required()
    }
  }
  </code></pre>
  
  <p>and </p>
  
  <pre><code>validate: {
    payload: {
      token: Joi.string().required()
    }
  }
  </code></pre>
  
  <p>I have tried using a combination of the <code>and</code> and <code>or</code> functions which gets very close but it allows all three to be passed as the payload:</p>
  
  <pre><code>validate: {
    payload: Joi.object().keys({
      email: Joi.string().required(),
      password: Joi.string().required(),
      token: Joi.string().required()
    }).and('email', 'password').or('token', 'email', 'password')
  }
  </code></pre>