You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This project has been really nicely designed to be modular with separated middleware, but all of the middleware seems to be included by default. In express, koa and other frameworks all middleware is optional so you are free to add what you wish and use alternatives which allows for a rich ecosystem.
I suggest we define a middleware spec for express-openapi.
function myCoolMiddleware(apiDoc) {
return function (req, res, next) {
// Do stuff
next();
}
}
// or
function myCoolMiddleware(req, res, next) {
const apiDoc = req.apiDoc;
// Do stuff
next();
}
const openapiInstance = openapi.initialize({
});
openapiInstance.use(myCoolMiddleware);
// or
openapi.initialize({
middleware: [myCoolMiddleware, express-openapi-defaults]
});
The text was updated successfully, but these errors were encountered:
DaleLJefferson
changed the title
Middleware should be opt in like express
Middleware should be opt-in like express
Mar 3, 2016
The problem is that express-openapi-defaults directly depends on your operation doc, so it's almost necessary that it's baked in and managed with vendor extensions.
This project has been really nicely designed to be modular with separated middleware, but all of the middleware seems to be included by default. In express, koa and other frameworks all middleware is optional so you are free to add what you wish and use alternatives which allows for a rich ecosystem.
I suggest we define a middleware spec for express-openapi.
The text was updated successfully, but these errors were encountered: