apigee-127 / swagger-node-runner

The heart of Swagger-Node
MIT License
102 stars 123 forks source link

Ignore response validation upon specific errors #124

Closed FMCorz closed 6 years ago

FMCorz commented 6 years ago

I've been trying this for the past hours without any success. Basically, I want to implement my own middlewares to check for permissions. The security policies are good for authentication, but not enough for my needs. I thought I could create my own middlewares and end the request, or return next(error), but that always ends in validation error.

The security middleware from swagger-tools seems to be exiting early when an authentication error occurs, but I did not figure out how to reproduce this behaviour. So there goes my question, how do I implement another set of security middlewares to early bail from an unauthorised request?

Any suggestion is welcome. Thanks!

theganyo commented 6 years ago

If you're getting a validation error, it seems likely that your spec doesn't allow for the error you're returning.

FMCorz commented 6 years ago

You're right. Sorry for the noise.