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] Fix Provider Interface Body Assignment Of Dict-Like Parameters #6561

Merged
merged 3 commits into from
Jul 4, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 18 additions & 1 deletion openbb_platform/core/openbb_core/app/provider_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
Union,
)

from fastapi import Query
from fastapi import Body, Query
from pydantic import (
BaseModel,
ConfigDict,
Expand Down Expand Up @@ -290,6 +290,23 @@ def _create_field(
else:
default = field.default

if (
hasattr(annotation, "__name__")
and annotation.__name__ in ["Dict", "dict", "Data"] # type: ignore
or field.kw_only is True
):
return DataclassField(
new_name,
annotation,
Body(
default=default,
title=provider_name,
description=description,
alias=field.alias or None,
json_schema_extra=getattr(field, "json_schema_extra", None),
),
)

if query:
# We need to use query if we want the field description to show
# up in the swagger, it's a fastapi limitation
Expand Down
Loading