Skip to content

Commit c247ae7

Browse files
authored
Merge pull request #54 from UiPath/fix/wrap-output-primitives
fix: wrap output str primitive
2 parents 8c18242 + 11833a6 commit c247ae7

File tree

4 files changed

+17
-2
lines changed

4 files changed

+17
-2
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "uipath-runtime"
3-
version = "0.2.8"
3+
version = "0.2.9"
44
description = "Runtime abstractions and interfaces for building agents and automation scripts in the UiPath ecosystem"
55
readme = { file = "README.md", content-type = "text/markdown" }
66
requires-python = ">=3.11"

src/uipath/runtime/result.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ def to_dict(self) -> dict[str, Any]:
3737
output_data = {}
3838
elif isinstance(self.output, BaseModel):
3939
output_data = self.output.model_dump()
40+
elif isinstance(self.output, str):
41+
output_data = {"output": self.output}
4042
else:
4143
output_data = self.output
4244

tests/test_context.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,3 +234,16 @@ def test_from_config_loads_runtime_and_fps_properties(tmp_path: Path) -> None:
234234
assert ctx.message_id == "msg-ghi"
235235
assert ctx.mcp_server_id == "mcp-server-456"
236236
assert ctx.mcp_server_slug == "test-server-slug"
237+
238+
239+
def test_string_output_wrapped_in_dict() -> None:
240+
"""Test that string output is wrapped in a dict with key 'output'."""
241+
result = UiPathRuntimeResult(
242+
status=UiPathRuntimeStatus.SUCCESSFUL,
243+
output="primitive str",
244+
)
245+
246+
result_dict = result.to_dict()
247+
248+
assert result_dict["output"] == {"output": "primitive str"}
249+
assert result_dict["status"] == UiPathRuntimeStatus.SUCCESSFUL

uv.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)