-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[feature] Build without OpenAPI spec #139
Comments
Hi, Thanks for the suggestion. |
I'm also interested by this feature. The idea would be to have a parameter for the visibility. So I could enable it in local, but disable for production. |
While that is an option, that sounds like it would be more work than what it's worth. The goal is to have access the schema during development, and for end users of the server not to have access to that schema. There are a few ways that this could be approached. On top of my mind there's two options:
app
#[cfg(debug_assertions)]
.build(...)
#[cfg(not(debug_assertions))]
.unwrap_inner() or any other way of using cfg, like feature flags |
Use case:
In my project I want to be able to generate the OpenAPI spec in development builds for internal use, but not expose it in production.
Currently this is almost impossible, since
.build
and.build_with
functions force having openapi route(s), without the ability to remove or even limit access to that specific route with middleware.My current solution is to use global middleware that checks every request, and limits access only to specified routes - openapi spec and swagger ui in my particular case
Alternatively there could be a way to add middlewares to apistos-generated routes, which might cover more use cases, provided such use cases exists and that would probably be a more complicated feature to implement
The text was updated successfully, but these errors were encountered: