apigee-127 / swagger-node-runner

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

API-level security handlers #96

Open ashtarcommunications opened 7 years ago

ashtarcommunications commented 7 years ago

Using swagger-express-mw v0.7.0. I can't seem to get an API-level security handler to work on all routes.

swagger.yaml:

securityDefinitions:
  basic:
    type: basic
security:
  - basic: []

I get: Cannot read property 'type' of undefined at swagger_security.js line 81: if (securityDefinition.type === 'oauth2') {

It appears req.swagger.operation.securityDefinitions is coming through undefined with an API-level security handler definition.

When I move the security definition to a single path in the yaml file, it works as expected. I'd prefer to not have to repeat the security definition for all paths individually if I can avoid it.

Any ideas?

motorro commented 7 years ago

@ashtarcommunications, seems to be sway bug. Take a look at this PR