Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request: Customize FastAPI Metadata #270

Open
bhimrazy opened this issue Sep 6, 2024 · 5 comments
Open

Feature Request: Customize FastAPI Metadata #270

bhimrazy opened this issue Sep 6, 2024 · 5 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@bhimrazy
Copy link
Contributor

bhimrazy commented Sep 6, 2024

Feature Request: Customize FastAPI Metadata

Description

Add a way to change FastAPI metadata (like title, description, license info, contact details, etc) and control the visibility of documentation URLs through the app_config parameter in LitServer.

Motivation

It would be helpful to easily customize API documentation details and hide docs URLs if needed, to keep things private or more tailored to specific needs.

Proposal

Update LitServer to accept an app_config dictionary for metadata settings:

server = LitServer(..., app_config={
    "title": "Lit API",
    "description": "Lit API Description",
    "license_info": {"name": "MIT", "url": "https://opensource.org/licenses/MIT"},

    # "docs_url": None,  # to Hide docs URL
    ...
})

In server.py, apply these settings to FastAPI:

self.app = FastAPI(lifespan=self.lifespan, **app_config)

Alternatives

Additional Context

@bhimrazy bhimrazy added enhancement New feature or request help wanted Extra attention is needed labels Sep 6, 2024
@ankitsharma07
Copy link
Contributor

Hi @bhimrazy I can take this up

@bhimrazy
Copy link
Contributor Author

bhimrazy commented Sep 6, 2024

Hi @ankitsharma07,

Thanks for your interest!
Let’s wait to hear feedback from the maintainers first, and once we have their feedback, feel free to proceed.

cc: @aniketmaurya @lantiga

@vrdn-23
Copy link

vrdn-23 commented Sep 19, 2024

This is something that our team would find useful as well. Is this still being prioritized? @aniketmaurya @lantiga

@aniketmaurya
Copy link
Collaborator

hi @vrdn-23, could you elaborate the use case if possible?

  • What will this feature enable you to do that you aren't able to do already?
  • Are you blocked because of this?

@vrdn-23
Copy link

vrdn-23 commented Sep 19, 2024

What will this feature enable you to do that you aren't able to do already?

I think the biggest plus point would be the ability to turn off the documentation url for an application that we are providing as a REST API. We typically have our own generated API docs that are not running on the same server as the application and having an endpoint exposed that we have not explicitly allowed and have no control to turn off, is often flagged as a security issue (related to information disclosure).

Are you blocked because of this?

Nope. Not currently. I do believe however this is a simple enough change that shouldn't add overhead complexity but at the same time provide small wins for people who need this level of configurability.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

4 participants