Skip to content

Conversation

@pedroimpulcetto
Copy link
Contributor

@pedroimpulcetto pedroimpulcetto commented Oct 2, 2025

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 docs_url parameter to determine the correct documentation URL
⚠️ Conditional docs display: When docs_url is set to None, the documentation URL is not displayed in the CLI output

Implementation 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

@pedroimpulcetto
Copy link
Contributor Author

hey @svlandeg, as we are stuck with the other PR, I just made the changes to fix #162

@pedroimpulcetto
Copy link
Contributor Author

hey @tiangolo I would love to have it merged and fix #162 issue 🙏 let me know your thoughts

@svlandeg svlandeg added the feature New feature or request label Oct 7, 2025
@marrrcin
Copy link

marrrcin commented Nov 3, 2025

Just enountered this bug, it would be great to merge this fix 🙌🏻

@github-actions github-actions bot added the conflicts Automatically generated when a PR has a merge conflict label Nov 10, 2025
@github-actions
Copy link
Contributor

This pull request has a merge conflict that needs to be resolved.

@github-actions github-actions bot removed the conflicts Automatically generated when a PR has a merge conflict label Nov 10, 2025
@pedroimpulcetto
Copy link
Contributor Author

hey @patrick91 @tiangolo, what are your thoughts about it? we would love to get it in

@themojtabajaveed
Copy link

Hi @pedroimpulcetto! 👋

I'm testing and reviewing this PR as part of my contribution to resolving #162.

Initial Review:

  • ✅ All 17 checks passing
  • ✅ No merge conflicts
  • ✅ Clean implementation with the _get_url_docs() function
  • ✅ Comprehensive test coverage added

Testing Plan:
I'll be thoroughly testing:

  1. Default behavior (docs_url="/docs")
  2. Custom docs URL (e.g., docs_url="/api-docs")
  3. Disabled docs (docs_url=None)
  4. Combination with root_path
  5. Both fastapi dev and fastapi run commands

I'll share detailed findings and any edge cases I discover. Great work on this implementation! 🚀

@github-actions github-actions bot added the conflicts Automatically generated when a PR has a merge conflict label Dec 22, 2025
@github-actions
Copy link
Contributor

This pull request has a merge conflict that needs to be resolved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

conflicts Automatically generated when a PR has a merge conflict feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Hard-coded documentation endpoint

5 participants