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

[BugFix] API: Reverse Output Of Wrapper Checking Object To Pass Custom Response Model #7039

Merged
merged 1 commit into from
Feb 21, 2025

Conversation

deeleeramone
Copy link
Contributor

  1. Why?:

    • This PR corrects the API command wrapper for the desired behavior.
      • no_validate=True in the @command decorator is for discarding all output response models entirely.
        • Setting as True will defeat the automatic generation of columnsDefs by openbb-platform-api
      • The default, False, retains the response models and allows any type to be defined - i.e, -> dict or -> SomeModel or -> OBBject.
  2. What?:

    • Basically just reverses what the check was to look for instance of OBBject before acting.
  3. Impact:

    • Most notably impacted are the data processing routers.
  4. Testing Done:

@router.command(methods=["GET"])
async def some_metric(
    symbol: str,
) -> dict:
    """Some metric for a stock."""
    return {
        "label": "P/E",
        "value": 600,
        "delta": "",
    }

@deeleeramone deeleeramone added bug Fix bug platform OpenBB Platform labels Feb 21, 2025
@deeleeramone deeleeramone requested a review from piiq February 21, 2025 18:44
@github-actions github-actions bot added v4 PRs for v4 labels Feb 21, 2025
@piiq piiq added this pull request to the merge queue Feb 21, 2025
Merged via the queue into develop with commit 3662037 Feb 21, 2025
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Fix bug platform OpenBB Platform v4 PRs for v4
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants