{"action":"published","release":{"url":"https://api.github.com/repos/theganyo/swagger-node-runner/releases/2066893","assets_url":"https://api.github.com/repos/theganyo/swagger-node-runner/releases/2066893/assets","upload_url":"https://uploads.github.com/repos/theganyo/swagger-node-runner/releases/2066893/assets{?name,label}","html_url":"https://github.com/theganyo/swagger-node-runner/releases/tag/v0.6.4","id":2066893,"tag_name":"v0.6.4","target_commitish":"master","name":"Response validation","draft":false,"author":{"login":"theganyo","id":772731,"avatar_url":"https://avatars.githubusercontent.com/u/772731?v=3","gravatar_id":"","url":"https://api.github.com/users/theganyo","html_url":"https://github.com/theganyo","followers_url":"https://api.github.com/users/theganyo/followers","following_url":"https://api.github.com/users/theganyo/following{/other_user}","gists_url":"https://api.github.com/users/theganyo/gists{/gist_id}","starred_url":"https://api.github.com/users/theganyo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/theganyo/subscriptions","organizations_url":"https://api.github.com/users/theganyo/orgs","repos_url":"https://api.github.com/users/theganyo/repos","events_url":"https://api.github.com/users/theganyo/events{/privacy}","received_events_url":"https://api.github.com/users/theganyo/received_events","type":"User","site_admin":false},"prerelease":false,"created_at":"2015-11-03T23:29:15Z","published_at":"2015-11-04T01:02:50Z","assets":[],"tarball_url":"https://api.github.com/repos/theganyo/swagger-node-runner/tarball/v0.6.4","zipball_url":"https://api.github.com/repos/theganyo/swagger-node-runner/zipball/v0.6.4","body":"New Features\r\n------------------\r\n\r\n**Response validation**\r\n\r\nResponse validation is now enabled as an event listener. No longer will turning on response validation overwrite your API responses - so now you may turn it on anytime and log the errors however you'd like without affecting your API clients. To catch validation errors, just listen for the 'responseValidationError' on the runner you create. \r\n\r\nFor example, if you have a swagger-node connect, express, restify, or hapi application, your app.js would look something like this:\r\n\r\n```javascript\r\nSwaggerExpress.create(config, function(err, swaggerExpress) {\r\n  if (err) { throw err; }\r\n\r\n  // install middleware\r\n  swaggerExpress.register(app);\r\n\r\n  // install response validation listener (this will only be called if there actually are any errors or warnings)\r\n  swaggerExpress.runner.on('responseValidationError', function(validationResponse, request, response) {\r\n    // log your validationResponse here...\r\n    console.error(validationResponse.errors);\r\n  });\r\n\r\n  var port = process.env.PORT || 10010;\r\n  app.listen(port);\r\n```\r\n\r\nIf you have a swagger-node sails application, the bottom of your app.js would look like this:\r\n\r\n```\r\n  sails.lift(rc('sails'), function(err, server) {\r\n\r\n    sails.hooks['swagger-sails-hook'].runner.on('responseValidationError', function(validationResponse, request, response) {\r\n      // log your validationResponse here...\r\n      console.error(validationResponse.errors);\r\n    });\r\n  });\r\n```\r\n\r\nNotes:\r\n\r\n* The validationResponse returned is the same format as Sway returns for its validateResponse function - ([docs here](https://github.com/apigee-127/sway/blob/master/docs/API.md#Operation+validateResponse)).\r\n* If there are no responseValidationError handlers, the response will not be validated, so there is no overhead.\r\n"}}