add support to dynamic url docs based on the FastAPI docs_url param#221
Open
pedroimpulcetto wants to merge 2 commits intofastapi:mainfrom
Open
add support to dynamic url docs based on the FastAPI docs_url param#221pedroimpulcetto wants to merge 2 commits intofastapi:mainfrom
pedroimpulcetto wants to merge 2 commits intofastapi:mainfrom
Conversation
Contributor
Author
Contributor
Author
|
Just enountered this bug, it would be great to merge this fix 🙌🏻 |
This comment was marked as resolved.
This comment was marked as resolved.
4d7462c to
a97e937
Compare
Contributor
Author
|
hey @patrick91 @tiangolo, what are your thoughts about it? we would love to get it in |
|
Hi @pedroimpulcetto! 👋 I'm testing and reviewing this PR as part of my contribution to resolving #162. Initial Review:
Testing Plan:
I'll share detailed findings and any edge cases I discover. Great work on this implementation! 🚀 |
chipytux
approved these changes
Dec 12, 2025
Contributor
|
This pull request has a merge conflict that needs to be resolved. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR adds support for dynamically displaying the correct documentation URL in the CLI output based on the FastAPI application's docs_url parameter configuration.
Fixes #162 issue
Improve and adapt PR #24
Changes
• Dynamic docs URL detection: The CLI now inspects the FastAPI application's⚠️ Conditional docs display: When
docs_urlparameter to determine the correct documentation URL•
docs_urlis set to None, the documentation URL is not displayed in the CLI outputImplementation Details
• Added _get_url_docs() function to extract the docs_url from the FastAPI application instance
• Modified the server startup output to conditionally display documentation URL based on the docs_url parameter
• Updated both dev and run commands to support dynamic URL detection
Testing
Added comprehensive test coverage for:
• Applications with custom docs_url paths
• Applications with docs_url=None (disabled docs)
• Applications with both custom docs_url and root_path
• Both dev and run command modes
• Various host and port configurations