🐛 Fix hardcoded docs URL#386
Conversation
| ] | ||
| if docs_links: | ||
| toolkit.print( | ||
| f"Documentation at {docs_links[0]}", |
There was a problem hiding this comment.
Why do you create a list of url and just print the first ? What about swagger and redoc urls ?
There was a problem hiding this comment.
I decided to keep it closer to the current behavior (only Swagger docs link is shown).
But I was in doubts about whether we should limit it to only first link or show all of them.
I actually wanted to highlight this in the comments, but forgot. So, thanks for pointing to it!)
I personally think that showing only one link is OK, and there is no big difference where to drop others (I mean whether to return all links from get_docs_utls or to return the only one that should be shown).
Let's wait for Sebastian to take a look and decide
|
This pull request has a merge conflict that needs to be resolved. |
|
Just for the information: this PR is on pause until we finish some refactoring in FastAPI that can affect this functionality |
Closes: #162
FastAPI allows configuring the docs URLs, but
fastapi-clicurrently doesn't respect it:(docs URL should be
http://0.0.0.0:8000/api/swagger_docs)This PR fixes this.
Use cases:
openapi_url=Nonedocs_url=None, Redoc docs URL will be shownroot_pathspecified as an option tofastapi run\devcommand or as a parameter toFastAPIWith this fix:
See also #381 that solves the issue with docs being unreachable via links due to
0.0.0.0in host addressThis PR is based on #119, credits to @FlavienRx