apigee-127 / swagger-tools

A Node.js and browser module that provides tooling around Swagger.
MIT License
701 stars 373 forks source link

Successful response validation actually returns 'skipped'? #571

Open paulkchen opened 6 years ago

paulkchen commented 6 years ago

When turning on the validator, I noticed the following debug output: swagger-tools:middleware:validator Validation: skipped (No response definition) 500 +0ms

However, I do have a response defined for 500. So looking through swagger-validator.js, I'm wondering if the code below is incorrect (lines 281-290 in swagger-validator.js):

  if (_.isUndefined(schema)) {
    sendData(swaggerVersion, res, val, encoding, true);
  } else {
    validateValue(req, schema, vPath, val, 'body', function (err) {
      if (err) {
        throw err;
      }
      sendData(swaggerVersion, res, val, encoding, false);
    });
  }

If err isn't thrown, shouldn't the last parameter to the subsequent sendData call be 'true'?

paulkchen commented 6 years ago

Oh yeah, did a debug print of 'schema', and it's an honest-to-goodness object. 😉