docs: function _validateParameter(parameter) {
          var result, error;
          switch (parameter.in) {
          case 'query':
              if (parameter.required && _.isUndefined(req.query[parameter.name])) {
                  logger.warn('Missing query parameter "%s" for operation "%s"', parameter.name, data.operationId);
                  error = _createRequestValidationError(
                      util.format('Missing %s query parameter', parameter.name), parameter, [{
                          code: 11404,
                          message: 'Missing required query parameter: ' + parameter.name
                      }]);
              } else if (!_.isUndefined(req.query[parameter.name])) {
                  result = swaggerUtil.validateParameterType(parameter, req.query[parameter.name]);
                  if (!result.valid) {
                      error = _createRequestValidationError(util.format('Error validating query parameter %s',
                          parameter.name), parameter, result.errors);
                  }
              }
              break;
  
          case 'header':
              if (parameter.required && _.isUndefined(req.get(parameter.name))) {
                  logger.warn('Missing header "%s" for operation "%s"', parameter.name, data.operationId);
                  error = _createRequestValidationError(
                      util.format('Missing %s header', parameter.name), parameter, [{
                          code: 12404,
                          message: 'Missing required header: ' + parameter.name
                      }]);
              } else if (!_.isUndefined(req.get(parameter.name))) {
                  result = swaggerUtil.validateParameterType(parameter, req.get(parameter.name));
                  if (!result.valid) {
                      error = _createRequestValidationError(util.format('Error validating %s header', parameter.name),
                          parameter, result.errors);
                  }
              }
              break;
  
          case 'path':
              result = swaggerUtil.validateParameterType(parameter, req.params[parameter.name]);
              if (!result.valid) {
                  error = _createRequestValidationError(util.format('Error validating %s path parameter', parameter.name),
                      parameter, result.errors);
              }
              break;
  
          case 'formData':
              // fyi: the swagger parser will fail if the user didn't set 'consumes' to
              // multipart/form-data or application/x-www-form-urlencoded
              if (parameter.required && parameter.type === 'file') {
                  if (!req.files[parameter.name]) {
                      logger.warn('Missing form parameter "%s" for operation "%s"', parameter.name, data.operationId);
                      error = _createRequestValidationError(
                          util.format('Missing %s form parameter', parameter.name), parameter, [{
                              code: 13404,
                              message: 'Missing required form parameter: ' + parameter.name
                          }]);
                  }
              }
              else if (!req.body[parameter.name]) { //multer puts the non-file parameters in the request body
                  if (parameter.required) { //something other than file
                      logger.warn('Missing form parameter "%s" for operation "%s"', parameter.name, data.operationId);
                      error = _createRequestValidationError(
                          util.format('Missing %s form parameter', parameter.name), parameter, [{
                              code: 13404,
                              message: 'Missing required form parameter: ' + parameter.name
                          }]);
                  }
              } else {
                  //go through the param-parsing code which is able to take text and validate
                  //it as any type, such as number, or array
                  result = swaggerUtil.validateParameterType(parameter, req.body[parameter.name]);
                  if (!result.valid) {
                      error = _createRequestValidationError(
                          util.format('Error validating form parameter %s', parameter.name),
                          parameter, result.errors);
                  }
              }
              break;
  
          case 'body':
              var validationConfig = {
                  spec: swaggerDoc,
                  failFast: rejectRequestAfterFirstValidationError,
                  skipPolymorphicChecks: (polymorphicValidation === 'off')
              };
              result = swaggerService.validateObject(validationConfig, parameter.schema, req.body);
              if (!_.isEmpty(result.polymorphicValidationErrors) && polymorphicValidation === 'warn') {
                  var warning = {
                      errors: result.polymorphicValidationErrors,
                      body: req.body || null
                  };
                  logger.warn('Request body polymorphic validation error for %s %s:', req.method, req.path,
                      JSON.stringify(warning, null, 2));
                  result.polymorphicValidationErrors = [];
                  result.valid = true;
              }
              if (!result.valid) {
                  error = _createRequestValidationError('Error validating request body', parameter,
                      _.compact([].concat(result.errors, result.polymorphicValidationErrors)));
              }
              break;
          }
  
          return error;
      }