krakenjs / swaggerize-express

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

How to add a global Middleware before all Paths #126

Open OmarSultan85 opened 6 years ago

OmarSultan85 commented 6 years ago

I'm looking for a way to add a global middleware before all handlers. I'm currently creating the handler as an array and making a call to my middleware through there but can't seem to find a way to default this middleware to all handlers.

Thanks and apologies if this is documented somewhere and I missed it.

ryanbecker commented 6 years ago

I'm trying to do the same. My end goal is to support validating custom string formats, like "uuid".

jsdevel commented 6 years ago

express-openapi supports this. See x-express-openapi-additional-middleware: https://github.com/kogosoftwarellc/express-openapi#configuring-middleware