krakenjs / swaggerize-express

Design-driven apis with swagger 2.0 and express.
Other
354 stars 81 forks source link

Only use the schema validation feature #108

Closed JordanTheriault closed 7 years ago

JordanTheriault commented 7 years ago

Hello,

I'm just trying to use the schema validation aspect of this repo for now. Is it possible for this middleware to simply validate incoming requests based on the schema outlined in the swagger documentation and respond accordingly (400)?

I assume it's as simple using the repository like so:

    app.use(swaggerize({
      api: require('./swagger.json'),
    }));
subeeshcbabu-zz commented 7 years ago

Yes. The validation of request parameters (defined by the parameters in the swagger document), is already part of this module. By default, Validators are added for routes (based on paths in swagger spec) corresponding to parameters and the security auth handlers.