pFad - Phone/Frame/Anonymizer/Declutterfier! Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

URL: http://github.com/fastapi/fastapi-cli/pull/221

ts/global-0bd78641c0a1f3e0.css" /> add support to dynamic url docs based on the FastAPI docs_url param by pedroimpulcetto · Pull Request #221 · fastapi/fastapi-cli · GitHub
Skip to content

add support to dynamic url docs based on the FastAPI docs_url param#221

Open
pedroimpulcetto wants to merge 2 commits intofastapi:mainfrom
pedroimpulcetto:feat/dynamic-url-docs
Open

add support to dynamic url docs based on the FastAPI docs_url param#221
pedroimpulcetto wants to merge 2 commits intofastapi:mainfrom
pedroimpulcetto:feat/dynamic-url-docs

Conversation

@pedroimpulcetto
Copy link
Copy Markdown
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
Copy Markdown
Contributor Author

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

@pedroimpulcetto
Copy link
Copy Markdown
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
Copy Markdown

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

This comment was marked as 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
Copy Markdown
Contributor Author

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

@themojtabajaveed
Copy link
Copy Markdown

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
Copy Markdown
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

6 participants

pFad - Phonifier reborn

Pfad - The Proxy pFad © 2024 Your Company Name. All rights reserved.





Check this box to remove all script contents from the fetched content.



Check this box to remove all images from the fetched content.


Check this box to remove all CSS styles from the fetched content.


Check this box to keep images inefficiently compressed and original size.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy