diff --git a/openbb_platform/extensions/platform_api/openbb_platform_api/utils/openapi.py b/openbb_platform/extensions/platform_api/openbb_platform_api/utils/openapi.py index 2a9f39a9d4e..52be10910a3 100644 --- a/openbb_platform/extensions/platform_api/openbb_platform_api/utils/openapi.py +++ b/openbb_platform/extensions/platform_api/openbb_platform_api/utils/openapi.py @@ -225,10 +225,6 @@ def set_parameter_options(p: dict, p_schema: dict, providers: list[str]) -> dict if is_provider_specific: p["available_providers"] = list(available_providers) - - if (title := p_schema.get("title", "")) and title not in providers: - p["label"] = title - return p @@ -296,6 +292,14 @@ def process_parameter(param: dict, providers: list[str]) -> dict: p = set_parameter_options(p, p_schema, providers) p = set_parameter_type(p, p_schema) + if title := p_schema.get("title", ""): + p["label"] = ( + p.get("parameter_name", "").replace("_", " ").title() + if ("," in title and title.replace(",", "").islower()) + or title.lower() in providers + else title + ) + if _widget_config := p_schema.get("x-widget_config", {}): p.update(_widget_config) @@ -401,7 +405,7 @@ def get_data_schema_for_widget(openapi_json, operation_id, route: Optional[str] return None -def data_schema_to_columns_defs( # noqa: PLR0912 +def data_schema_to_columns_defs( # noqa: PLR0912 # pylint: disable=too-many-branches openapi_json, operation_id, provider, route: Optional[str] = None ): """Convert data schema to column definitions for the widget."""