docs: function registerRoute(app, auth, additionalMiddleware, method, path, data, allowedTypes, handlerFunc, swaggerDoc,
      logger) {
  
      var authMiddleware = auth.getAuthMiddleware() || [];
      additionalMiddleware = authMiddleware.concat(additionalMiddleware);
  
      if (_.includes(data.consumes, 'multipart/form-data')) {
          var fieldData = _.filter(data.parameters, {in: 'formData', type: 'file'});
          fieldData = _.map(fieldData, function (item) {
              return {
                  name: item.name,
                  maxCount: 1
              };
          });
  
          additionalMiddleware.push(_upload.fields(fieldData));
      }
  
      app[method].call(app, path, additionalMiddleware, function (req, res, next) {
  
          validateRequestParameters(req, data, swaggerDoc, logger, function (err) {
              if (err) {
                  return next(err);
              }
              setDefaultQueryParams(req, data, logger);
              setDefaultHeaders(req, data, logger);
  
              //Wrap the set function, which is responsible for setting headers
              if (allowedTypes) {
                  //Validate that the content-type is correct per the swagger definition
                  wrapCall(res, 'set', function (name, value) {
                      if (name === 'Content-Type') {
                          var type = _.split(value, ';')[0]; //parse off the optional encoding
                          if (!_.includes(allowedTypes, type)) {
                              logger.warn('Invalid content type specified: %s. Expecting one of %s', type, allowedTypes);
                          }
                      }
                  });
              }
  
              if (responseModelValidationLevel) {
                  var responseSender = res.send;
                  res.send = function (body) {
                      var isBodyValid = isValidDataType(body);
                      if (!isBodyValid) {
                          try { //body can come in as JSON, we want it unJSONified
                              body = JSON.parse(body);
                          } catch (err) {
                              logger.error('Unexpected format when attempting to validate response');
                              res.send = responseSender;
                              responseSender.call(res, body);
                              res.sentBody = body;
                              return;
                          }
                      } else if (body) {
                          // if the response object has a property which is an object that implements toJSON() ...
                          // it will cause validation to fail (it'll be an object while a string will be expected)
                          // this dumb-looking code, ensures that we're validating what will be sent over the wire
                          body = JSON.parse(JSON.stringify(body));
                      }
                      var validationErrors = validateResponseModels(res, body, data, swaggerDoc, logger);
                      // check the model for any validation errors, and handle them based on the validation level
                      if (validationErrors) {
                          // 'error'
                          // errors added in the `_response_validation_errors` property of the response,
                          // or of that property of the first and last array entries
                          // we'll create a response object (or array entry) if there isn't one (will break client code)
                          var alteredBody;
                          if (responseModelValidationLevel === 'error') {
                              var invalidBodyDetails = _.cloneDeep(validationErrors);
                              alteredBody = _.cloneDeep(body);
                              if (_.isArray(alteredBody)) {
                                  if (alteredBody.length === 0) {
                                      alteredBody.push(invalidBodyDetails);
                                  } else {
                                      alteredBody[0]._response_validation_errors = invalidBodyDetails;
                                      if (alteredBody.length > 1) {
                                          alteredBody[alteredBody.length - 1]._response_validation_errors =
                                              invalidBodyDetails;
                                      }
                                  }
                              } else {
                                  alteredBody = alteredBody || {};
                                  alteredBody._response_validation_errors = invalidBodyDetails;
                              }
                          }
  
                          // 'warn'
                          // response is sent to the caller unmodified, errors (this model) are only logged (see below)
                          validationErrors.invalidResponse = {
                              method: req.method,
                              path: req.path,
                              statusCode: res.statusCode,
                              body: body || null
                          };
  
                          // 'fail'
                          // changes the http response code to 522 and separates the validation errors and response body.
                          // Will break client code; should only be used when developing/testing an API in stand alone
                          if (responseModelValidationLevel === 'fail') {
                              body = validationErrors;
                              res.statusCode = validationErrors.status;
                          } else if (alteredBody) {
                              body = alteredBody;
                          }
  
                          // in all cases, log the validation errors
                          logger[responseModelValidationLevel === 'warn' ? 'warn' : 'error'](
                              'Response validation error:', JSON.stringify(validationErrors, null, 2)
                          );
                      }
  
                      // after this initial call (sometimes `send` will call itself again),
                      // we don't need to get the response for validation anymore
                      res.send = responseSender;
                      // if we parsed JSON at the start, reJSONify
                      responseSender.call(res, isBodyValid ? body : JSON.stringify(body));
  
                      // attach the body object for post-send() middlewares
                      res.sentBody = body;
                  };
              }
              handlerFunc(req, res, next);
          });
  
      });
  }