diff options
77 files changed, 339 insertions, 169 deletions
diff --git a/openbb_platform/core/openbb_core/app/static/utils/decorators.py b/openbb_platform/core/openbb_core/app/static/utils/decorators.py index 18eadeffa69..0d44b87427c 100644 --- a/openbb_platform/core/openbb_core/app/static/utils/decorators.py +++ b/openbb_platform/core/openbb_core/app/static/utils/decorators.py @@ -62,7 +62,8 @@ def exception_handler(func: Callable[P, R]) -> Callable[P, R]: validation_error = f"{e.error_count()} validations errors in {e.title}" for error in e.errors(): - arg_error = f"Arg {error['loc'][0]} ->\n" + arg = ".".join(map(str, error["loc"])) + arg_error = f"Arg {arg} ->\n" error_details = ( f" {error['msg']} " f"[validation_error_type={error['type']}, " diff --git a/openbb_platform/core/openbb_core/provider/standard_models/analyst_estimates.py b/openbb_platform/core/openbb_core/provider/standard_models/analyst_estimates.py index 7ffe2462b0a..4a4e76c796d 100644 --- a/openbb_platform/core/openbb_core/provider/standard_models/analyst_estimates.py +++ b/openbb_platform/core/openbb_core/provider/standard_models/analyst_estimates.py @@ -1,7 +1,7 @@ """Analyst Estimates Standard Model.""" from datetime import date as dateType -from typing import List, Literal, Set, Union +from typing import List, Literal, Optional, Set, Union from pydantic import Field, field_validator @@ -24,10 +24,16 @@ class AnalystEstimatesQueryParams(QueryParams): @field_validator("symbol", mode="before", check_fields=False) @classmethod - def upper_symbol(cls, v: str) -> str: - """Convert symbol to uppercase.""" + def to_upper(cls, v: str) -> str: + """Convert field to uppercase.""" return v.upper() + @field_validator("period", mode="before", check_fields=False) + @classmethod + def to_lower(cls, v: Optional[str]) -> Optional[str]: + """Convert field to lowercase.""" + return v.lower() if v else v + class AnalystEstimatesData(Data): """Analyst Estimates data.""" @@ -71,8 +77,8 @@ class AnalystEstimatesData(Data): @field_validator("symbol", mode="before", check_fields=False) @classmethod - def upper_symbol(cls, v: Union[str, List[str], Set[str]]): - """Convert symbol to uppercase.""" + def to_upper(cls, v: Union[str, List[str], Set[str]]): + """Convert field to uppercase.""" if isinstance(v, str): return v.upper() return ",".join([symbol.upper() for symbol in list(v)]) if v else None diff --git a/openbb_platform/core/openbb_core/provider/standard_models/balance_sheet.py b/openbb_platform/core/openbb_core/provider/standard_models/balance_sheet.py index 799b8ab197c..860b28bad1c 100644 --- a/openbb_platform/core/openbb_core/provider/standard_models/balance_sheet.py +++ b/openbb_platform/core/openbb_core/provider/standard_models/balance_sheet.py @@ -26,9 +26,16 @@ class BalanceSheetQueryParams(QueryParams): @field_validator("symbol", mode="before", check_fields=False) @classmethod - def upper_symbol(cls, v: str): + def to_upper(cls, v: str): + """Convert field to uppercase.""" return v.upper() + @field_validator("period", mode="before", check_fields=False) + @classmethod + def to_lower(cls, v: Optional[str]) -> Optional[str]: + """Convert field to lowercase.""" + return v.lower() if v else v + class BalanceSheetData(Data): """Balance Sheet Data.""" diff --git a/openbb_platform/core/openbb_core/provider/standard_models/balance_sheet_growth.py b/openbb_platform/core/openbb_core/provider/standard_models/balance_sheet_growth.py index 746eaacf0e3..e2aff45cb5d 100644 --- a/openbb_platform/core/openbb_core/provider/standard_models/balance_sheet_growth.py +++ b/openbb_platform/core/openbb_core/provider/standard_models/balance_sheet_growth.py @@ -21,8 +21,8 @@ class BalanceSheetGrowthQueryParams(QueryParams): @field_validator("symbol", mode="before", check_fields=False) @classmethod - def upper_symbol(cls, v: str): - """Convert symbol to uppercase.""" + def to_upper(cls, v: str): + """Convert field to uppercase.""" return v.upper() @@ -130,8 +130,8 @@ class BalanceSheetGrowthData(Data): @field_validator("symbol", mode="before", check_fields=False) @classmethod - def upper_symbol(cls, v: Union[str, List[str], Set[str]]): - """Convert symbol to uppercase.""" + def to_upper(cls, v: Union[str, List[str], Set[str]]): + """Convert field to uppercase.""" if isinstance(v, str): |