joi-router.js
function checkValidators(spec) {
  if (!spec.validate) return;

  let text;
  if (spec.validate.body) {
    text = 'validate.type must be declared when using validate.body';
    assert(/json|form/.test(spec.validate.type), text);
  }

  if (spec.validate.type) {
    text = 'validate.type must be either json, form, multipart or stream';
    assert(/json|form|multipart|stream/i.test(spec.validate.type), text);
  }

  if (spec.validate.output) {
    spec.validate._outputValidator = new OutputValidator(spec.validate.output);
  }

  // default HTTP status code for failures
  if (!spec.validate.failure) {
    spec.validate.failure = 400;
  }
}
function checkValidators(spec) {
  if (!spec.validate) return;

  let text;
  if (spec.validate.body) {
    text = 'validate.type must be declared when using validate.body';
    assert(/json|form/.test(spec.validate.type), text);
  }

  if (spec.validate.type) {
    text = 'validate.type must be either json, form, multipart or stream';
    assert(/json|form|multipart|stream/i.test(spec.validate.type), text);
  }

  if (spec.validate.output) {
    spec.validate._outputValidator = new OutputValidator(spec.validate.output);
  }

  // default HTTP status code for failures
  if (!spec.validate.failure) {
    spec.validate.failure = 400;
  }
}
function checkValidators ( spec ) { if ( ! spec . validate ) return ; let text ; if ( spec . validate . body ) { text = 'validate.type must be declared when using validate.body' ; assert ( / json|form / . test ( spec . validate . type ) , text ) ; } if ( spec . validate . type ) { text = 'validate.type must be either json, form, multipart or stream' ; assert ( / json|form|multipart|stream / i . test ( spec . validate . type ) , text ) ; } if ( spec . validate . output ) { spec . validate . _outputValidator = new OutputValidator ( spec . validate . output ) ; } // default HTTP status code for failures if ( ! spec . validate . failure ) { spec . validate . failure = 400 ; } }
Validate the spec.validators

@param {Object} spec
@api private
Validate the spec . validators