summaryrefslogtreecommitdiffstats
path: root/openbb_platform/core/openbb_core/app/static/utils/filters.py
diff options
context:
space:
mode:
Diffstat (limited to 'openbb_platform/core/openbb_core/app/static/utils/filters.py')
-rw-r--r--openbb_platform/core/openbb_core/app/static/utils/filters.py17
1 files changed, 14 insertions, 3 deletions
diff --git a/openbb_platform/core/openbb_core/app/static/utils/filters.py b/openbb_platform/core/openbb_core/app/static/utils/filters.py
index 36e9d3164db..b2262a1e8c8 100644
--- a/openbb_platform/core/openbb_core/app/static/utils/filters.py
+++ b/openbb_platform/core/openbb_core/app/static/utils/filters.py
@@ -7,7 +7,7 @@ from openbb_core.app.utils import check_single_item, convert_to_basemodel
def filter_inputs(
data_processing: bool = False,
- extra_info: Optional[Dict[str, Dict[str, List[str]]]] = None,
+ info: Optional[Dict[str, Dict[str, List[str]]]] = None,
**kwargs,
) -> dict:
"""Filter command inputs."""
@@ -15,13 +15,13 @@ def filter_inputs(
if data_processing and key == "data":
kwargs[key] = convert_to_basemodel(value)
- if extra_info:
+ if info:
PROPERTY = "multiple_items_allowed"
# Here we check if list items are passed and multiple items allowed for
# the given provider/input combination. In that case we transform the list
# into a comma-separated string
- for field, props in extra_info.items():
+ for field, props in info.items():
if PROPERTY in props and (
provider := kwargs.get("provider_choices", {}).get("provider")
):
@@ -42,5 +42,16 @@ def filter_inputs(
kwargs[p][field] = new
break
+ else:
+ provider = kwargs.get("provider_choices", {}).get("provider")
+ for param_category in ("standard_params", "extra_params"):
+ if param_category in kwargs:
+ for field, value in kwargs[param_category].items():
+ if isinstance(value, list):
+ kwargs[param_category][field] = ",".join(map(str, value))
+ check_single_item(
+ kwargs[param_category][field],
+ f"{field} -> multiple items not allowed for '{provider}'",
+ )
return kwargs