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
Is your feature request related to a problem? Please describe.
Naa, not a problem, just an extension for my use case.
Describe the solution you'd like
An option (via config or a function) to whitelist or blacklist paths
Describe alternatives you've considered
I've considered adding a post-processing step after the tests that will strip out paths from the doc.
This is likely trivial, but other items like tags, schemas and responses (schemas and responses are auto-generated, so very tricky to remove in a post-processing step).
Another alternative is to use an unless middleware that only runs the getResponseExpress(...) on select routes
/** * Helper to apply middleware selectively to routes * @param {*} prefixes * @param {*} middleware */functionunless(prefixes=[],middleware){returnfunction(req,res,next){if(prefixes.includes(req.url)){returnnext();}else{returnmiddleware(req,res,next);}};}
This could be run in userland, but I'm not sure if sonic-express has any expectations regarding how its attached as a middleware.
Additional context
We have an API, housed in a single codebase that will feed both internal and external consumers.
For now, this distinction is via route groups and different authorizers.
I'm using sonic-express to update the swagger doc we expose to internal consumers.
I need a way to not include routes that are meant for other consumers.
The text was updated successfully, but these errors were encountered:
I wrapped the middleware step in the unless middleware effectively only calling sonic-express for the routes I need.
I'm curious to see how your solution looks like.
Is your feature request related to a problem? Please describe.
Naa, not a problem, just an extension for my use case.
Describe the solution you'd like
An option (via config or a function) to whitelist or blacklist paths
Describe alternatives you've considered
I've considered adding a post-processing step after the tests that will strip out paths from the doc.
This is likely trivial, but other items like tags, schemas and responses (schemas and responses are auto-generated, so very tricky to remove in a post-processing step).
Another alternative is to use an
unless
middleware that only runs thegetResponseExpress(...)
on select routesThis could be run in userland, but I'm not sure if sonic-express has any expectations regarding how its attached as a middleware.
Additional context
We have an API, housed in a single codebase that will feed both internal and external consumers.
For now, this distinction is via route groups and different authorizers.
I'm using sonic-express to update the swagger doc we expose to internal consumers.
I need a way to not include routes that are meant for other consumers.
The text was updated successfully, but these errors were encountered: