Skip to content

Conversation

chipytux
Copy link

@chipytux chipytux commented May 13, 2024

Pull Request Description

Title: Fetch docs_url dynamically from FastAPI app

Description:

This pull request introduces a change to the fastapi-cli library that fetches the docs_url value dynamically from the FastAPI application instead of using a hardcoded value.

Implementation Details:

The change involves modifying the _run function to fetch the docs_url value from the FastAPI application using the app.openapi_url attribute. This ensures that the library always uses the URL specified by the application itself.

Testing:

The updated function has been thoroughly tested to ensure it correctly retrieves the docs_url value from the FastAPI application and show the appropriate URL.

 ╭────────── FastAPI CLI - Development mode ───────────╮                        
 │                                                     │                        
 │  Serving at: http://127.0.0.1:9901                  │                        
 │                                                     │                        
 │  API docs: http://127.0.0.1:9901/any-other-path     │                        
 │                                                     │                        
 │  Running in development mode, for production use:   │                        
 │                                                     │                        
 │  fastapi run                                        │                        
 │                                                     │                        
 ╰─────────────────────────────────────────────────────╯   

@chipytux chipytux changed the title feat: fetch app docs_url fix: fetch app docs_url May 13, 2024
@chipytux chipytux force-pushed the feat/get_app_docs_url branch from becbe1e to dfec882 Compare May 13, 2024 22:43
@chipytux chipytux force-pushed the feat/get_app_docs_url branch from dfec882 to fb3ee8e Compare May 15, 2024 17:29
@chipytux
Copy link
Author

chipytux commented May 22, 2024

Do you think this is a good approach @tiangolo ? 🙏🏻

😉 @pedroimpulcetto

@chipytux chipytux changed the title fix: fetch app docs_url feat: fetch app docs_url Jul 25, 2024
@chipytux chipytux changed the title feat: fetch app docs_url feature: fetch app docs_url Aug 15, 2024
@chipytux
Copy link
Author

@tiangolo I do not have permission to configure a label for the PR. https://github.com/fastapi/fastapi-cli/actions/runs/10408815023/job/28827030912?pr=24

@tobb10001
Copy link

I ran across the same bug today and I can confirm that the provided patch resolves the issue.

Copy link
Contributor

github-actions bot commented Sep 5, 2025

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

@github-actions github-actions bot added the conflicts Automatically generated when a PR has a merge conflict label Sep 5, 2025
@svlandeg svlandeg added docs Improvements or additions to documentation and removed docs Improvements or additions to documentation labels Sep 5, 2025
@svlandeg svlandeg added the bug Something isn't working label Sep 5, 2025
@svlandeg svlandeg changed the title feature: fetch app docs_url 🐛 Fetch the documentation URL dynamically Sep 5, 2025
@svlandeg svlandeg linked an issue Sep 5, 2025 that may be closed by this pull request
@YuriiMotov
Copy link

@chipytux , thank you for your interest and efforts!

This PR needs to be updated to reflect latest changes.
We also need to add some tests (including tests with root_path specified and specifying app path using entrypoint parameter).

Would you like to work on this?

@Infamous003
Copy link

Hi, this sounds interesting. Could you tell me more about what exactly needs to be done?

@pedroimpulcetto
Copy link
Contributor

pedroimpulcetto commented Oct 1, 2025

oh, ok, I'm able to handle these changes since @chipytux isn't aware of it

cc: @YuriiMotov

@YuriiMotov
Copy link

I meant we need to resolve the merge conflicts (merge main branch into the branch of this PR) and ensure it still works as expected.

The entrypoint option was added recently, we need to make sure it works correctly with these changes.
And, we need to add tests with edge cases like root_path.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working conflicts Automatically generated when a PR has a merge conflict
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Hard-coded documentation endpoint
7 participants