-
-
Notifications
You must be signed in to change notification settings - Fork 345
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
Bug: New create_static_files_router
automatically adds routes to schema docs
#3374
Comments
Why wouldn't it add them to the schema? It's just regular route handlers, which, by default, are added to the schema. You can use the regular Not sure about the name; We do include a |
We didn't include them before, but I feel like - by default - they should be disabled. I'm fine with whatever here, but at the very least I hope we would tag this as something more not- |
If you pass |
I, for one, chose to stick with StaticFilesConfig as much as possible just because it does NOT add the routes to the schema docs. Since I'll never use them, I'd rather not see/have them there. So, for what it's worth, I'd also classify this as a bug (especially if you take into consideration that create_static_files_router is presented as the replacement for StaticFilesConfig, but it does not replace/mimic its behavior exactly). |
FWIW, I think |
I checked again just now and realized there was one additional reason/inconsistency: after switching to create_static_files_router (using the exact same settings I had for StaticFilesConfig: directories=["static"], path="/static") I immediately noticed my favicon was 404ing all of a sudden because its URL was now /schema/static/favicon.ico instead of StaticFilesConfig's /favicon.ico . The new URL didn't make sense to me, so as I previously mentioned, I switched back to StaticFilesConfig... |
That would be a bug in |
True, but I don't understand/want that "/schema" part/folder from create_static_files_router's URL |
Can you provide an MCVE for this? |
A fix for this issue has been released in v2.9.0 |
Description
I found this suprising when using the new static files feature that
1: It auto adds these to the schema
2: It adds them under a sort've "ugly" router header
default
We should fix one or both of those
URL to code causing the issue
No response
MCVE
Steps to reproduce
1. run mcve 2. visit /schema 3. See schema for default
Screenshots
Logs
No response
Litestar Version
2.7/2.8
Platform
The text was updated successfully, but these errors were encountered: