Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

response validator attempt to validate non swagger operations #56

Closed
niallmccullagh opened this issue Aug 23, 2016 · 3 comments
Closed

Comments

@niallmccullagh
Copy link

I've a error handler set up

swaggerExpress.runner.on('responseValidationError', function(validationResponse, request, response) { ... }

and I'm also serving up the swagger-ui using static serve.

However the hookResponseForValidation fails with

TypeError: Cannot read property 'validateResponse' of undefined api_1 | at ServerResponse.hookEnd (/app/node_modules/swagger-node-runner/lib/connect_middleware.js:163:63)

as operation is undefined on context.request.swagger.operation.validateResponse

I'll submit a pull request shortly but the gist of the change is to filter out based on

if(context.request.swagger.operation == undefined){ debug('not a swagger operation, will not validate response'); }

@321ckatz123
Copy link

@theganyo do you have a timeframe for this to get pushed to NPM? I am also running into it. It's not deal breaking, but it is quite annoying (as I'm loading swagger-ui as well).

@revnode
Copy link

revnode commented Dec 25, 2016

Yup, same here. Please push to NPM. Thanks!

@theganyo
Copy link
Collaborator

theganyo commented Jan 4, 2017

You got it: swagger-node-runner@0.7.2

szilveszterb added a commit to exosite-archive/swagger-express that referenced this issue May 18, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants