summaryrefslogtreecommitdiffstats
path: root/openbb_platform/core/openbb_core/api/router/commands.py
diff options
context:
space:
mode:
Diffstat (limited to 'openbb_platform/core/openbb_core/api/router/commands.py')
-rw-r--r--openbb_platform/core/openbb_core/api/router/commands.py13
1 files changed, 6 insertions, 7 deletions
diff --git a/openbb_platform/core/openbb_core/api/router/commands.py b/openbb_platform/core/openbb_core/api/router/commands.py
index d524156ddbd..2d2ea3e6a11 100644
--- a/openbb_platform/core/openbb_core/api/router/commands.py
+++ b/openbb_platform/core/openbb_core/api/router/commands.py
@@ -117,7 +117,7 @@ def build_new_signature(path: str, func: Callable) -> Signature:
)
-def validate_output(c_out: OBBject) -> OBBject:
+def validate_output(c_out: OBBject) -> Dict:
"""
Validate OBBject object.
@@ -132,8 +132,8 @@ def validate_output(c_out: OBBject) -> OBBject:
Returns
-------
- OBBject
- Validated OBBject object.
+ Dict
+ Serialized OBBject.
"""
def is_model(type_):
@@ -170,7 +170,7 @@ def validate_output(c_out: OBBject) -> OBBject:
for k, v in c_out.model_copy():
exclude_fields_from_api(k, v)
- return c_out
+ return c_out.model_dump()
def build_api_wrapper(
@@ -188,7 +188,7 @@ def build_api_wrapper(
func.__annotations__ = new_annotations_map
@wraps(wrapped=func)
- async def wrapper(*args: Tuple[Any], **kwargs: Dict[str, Any]):
+ async def wrapper(*args: Tuple[Any], **kwargs: Dict[str, Any]) -> Dict:
user_settings: UserSettings = UserSettings.model_validate(
kwargs.pop(
"__authenticated_user_settings",
@@ -198,8 +198,7 @@ def build_api_wrapper(
execute = partial(command_runner.run, path, user_settings)
output: OBBject = await execute(*args, **kwargs)
- output = validate_output(output)
- return output
+ return validate_output(output)
return wrapper