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] openbb-platform-api: Adds Configurations Supplied In Router Decorator To widgets.json #7014

Merged
merged 6 commits into from
Jan 31, 2025

Conversation

deeleeramone
Copy link
Contributor

@deeleeramone deeleeramone commented Jan 30, 2025

  1. Why?:

    • Provides a way to define some, or all, widget configuration settings that will override the automatically-generated content.
  2. What?:

    • Reads a dictionary supplied in the @router.command decorator and updates the generated widget entry with the supplied settings.
  3. Impact:

    • Improves developer experience.
    • Requires knowing the nested dictionary structure that is widgets.json.
  4. Testing Done:

    • Some router extension, and change the "type".
"""Empty Router Extenision for OpenBB Platform."""

from datetime import datetime
from typing import Annotated

from fastapi import Query
from fastapi.responses import JSONResponse
from openbb_core.app.router import Router

router = Router(prefix="", description="A custom OpenBB router extension.")


@router.command(
    methods=["GET"],
    no_validate=True,
    openapi_extra={"widget_config": {"type": "markdown"}},
)
async def hello(
    input: Annotated[str, Query(description="some description")] = "Hello",
) -> str:
    """Widget description created by doctring."""

    return "Hello from the Empty Router extension!"
Screenshot 2025-01-30 at 1 47 44 PM

Removing all params from the function:

Screenshot 2025-01-30 at 1 59 40 PM

@deeleeramone deeleeramone added enhancement Enhancement platform OpenBB Platform v4 PRs for v4 labels Jan 30, 2025
@deeleeramone deeleeramone added this pull request to the merge queue Jan 31, 2025
Merged via the queue into develop with commit 90a7ad3 Jan 31, 2025
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Enhancement platform OpenBB Platform v4 PRs for v4
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants