kogosoftwarellc / open-api

A Monorepo of various packages to power OpenAPI in node
MIT License
892 stars 235 forks source link

openapi-framework: add middleware for operations #769

Closed jjdonov closed 3 years ago

jjdonov commented 3 years ago

The goal of this PR is to bring the functionality of args.operations up to speed with how args.paths works with regards to middleware.

While args.paths (autoload like functionality) allows you to expose an array of middleware as an operation handler, the args.operations requires that the operation handler be a function. Attempting to pass an array result in a TypeError

/path/to/project/node_modules/openapi-framework/dist/index.js:165
                                return innerFunction.bind({
                                                     ^

TypeError: innerFunction.bind is not a function

I believe this was first documented in #618, and can make mounting middleware awkward or impossible at times.

This PR is may me incomplete. If the maintainers are open to a change like this, then I'd love to take it across the finish line. However, since I'm relatively new to the codebase, I expect I may need some guidance.

jjdonov commented 2 years ago

@jsdevel thanks for the merge 😄 hate to be a bother, but any idea when we might get a new version published? We have a lot of middleware work on the immediate horizon that this PR would help a ton with.

And in general, is there a roadmap/release calendar/similar available? We've become pretty heavy users of the library and would love to learn more about where its headed or ways to get involved!

jsdevel commented 2 years ago

soon @jjdonov