code: function validateInput(prop, ctx, validate) {
    debug('validating %s', prop);
  
    const request = ctx.request;
    const res = Joi.validate(request[prop], validate[prop]);
  
    if (res.error) {
      res.error.status = validate.failure;
      return res.error;
    }
  
    // update our request w/ the casted values
    switch (prop) {
      case 'header': // request.header is getter only, cannot set it
      case 'query': // setting request.query directly causes casting back to strings
        Object.keys(res.value).forEach((key) => {
          request[prop][key] = res.value[key];
        });
        break;
      case 'params':
        request.params = ctx.params = res.value;
        break;
      default:
        request[prop] = res.value;
    }
  }
docs: Validates request[prop] data with the defined validation schema.
  
  @param {String} prop
  @param {koa.Request} request
  @param {Object} validate
  @returns {Error|undefined}
  @api private