Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/uipath-platform/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "uipath-platform"
version = "0.1.7"
version = "0.1.8"
description = "HTTP client library for programmatic access to UiPath Platform"
readme = { file = "README.md", content-type = "text/markdown" }
requires-python = ">=3.11"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -761,10 +761,6 @@ def _build_activity_request_spec(
multipart_params[param_name] = value
elif param_name in activity_metadata.parameter_location_info.body_fields:
body_fields[param_name] = value
else:
raise ValueError(
f"Parameter {param_name} does not exist in activity metadata."
)

# path parameter handling
for key, value in path_params.items():
Expand Down
69 changes: 58 additions & 11 deletions packages/uipath-platform/tests/services/test_connections_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -1617,13 +1617,13 @@ def test_invoke_activity_with_none_values_filtered(
request_json = json.loads(sent_request.content.decode())
assert request_json == {"body_field1": "value1"}

def test_invoke_activity_unknown_parameter_raises_error(
def test_invoke_activity_unknown_parameter_is_ignored(
self,
httpx_mock: HTTPXMock,
service: ConnectionsService,
simple_activity_metadata: ActivityMetadata,
) -> None:
"""Test that unknown parameters raise a ValueError."""
"""Test that unknown parameters are ignored."""
connection_id = "test-connection-123"
activity_input = {
"unknown_param": "value", # This parameter doesn't exist in metadata
Expand All @@ -1634,16 +1634,63 @@ def test_invoke_activity_unknown_parameter_raises_error(
status_code=200,
json={"id": connection_id, "name": "Test", "elementInstanceId": 1},
)
httpx_mock.add_response(
method="POST",
status_code=200,
json={},
)

with pytest.raises(
ValueError,
match="Parameter unknown_param does not exist in activity metadata",
):
service.invoke_activity(
activity_metadata=simple_activity_metadata,
connection_id=connection_id,
activity_input=activity_input,
)
service.invoke_activity(
activity_metadata=simple_activity_metadata,
connection_id=connection_id,
activity_input=activity_input,
)

requests = httpx_mock.get_requests()
sent_request = requests[1]
assert "unknown_param" not in sent_request.url.params
assert "unknown_param" not in str(sent_request.url.path)
assert "unknown_param" not in sent_request.headers
request_json = json.loads(sent_request.content.decode())
assert "unknown_param" not in request_json

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: technically not a complete assertion, because parameters can be in headers, paths or queries

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now checking all places


def test_invoke_activity_unknown_parameter_is_ignored_multipart(
self,
httpx_mock: HTTPXMock,
service: ConnectionsService,
multipart_activity_metadata: ActivityMetadata,
) -> None:
"""Test that unknown parameters are ignored in multipart requests."""
connection_id = "test-connection-123"
activity_input = {
"unknown_param": "value", # This parameter doesn't exist in metadata
}

httpx_mock.add_response(
method="GET",
status_code=200,
json={"id": connection_id, "name": "Test", "elementInstanceId": 1},
)
httpx_mock.add_response(
method="POST",
status_code=200,
json={},
)

service.invoke_activity(
activity_metadata=multipart_activity_metadata,
connection_id=connection_id,
activity_input=activity_input,
)

requests = httpx_mock.get_requests()
sent_request = requests[1]

assert "unknown_param" not in sent_request.url.params
assert "unknown_param" not in str(sent_request.url.path)
assert "unknown_param" not in sent_request.headers
body = sent_request.content.decode("utf-8", errors="replace")
assert "unknown_param" not in body

def test_invoke_activity_unsupported_content_type_raises_error(
self,
Expand Down
2 changes: 1 addition & 1 deletion packages/uipath-platform/uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions packages/uipath/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
[project]
name = "uipath"
version = "2.10.27"
version = "2.10.28"
description = "Python SDK and CLI for UiPath Platform, enabling programmatic interaction with automation services, process management, and deployment tools."
readme = { file = "README.md", content-type = "text/markdown" }
requires-python = ">=3.11"
dependencies = [
"uipath-core>=0.5.2, <0.6.0",
"uipath-runtime>=0.9.1, <0.10.0",
"uipath-platform>=0.1.4, <0.2.0",
"uipath-platform>=0.1.8, <0.2.0",
"click>=8.3.1",
"httpx>=0.28.1",
"pyjwt>=2.10.1",
Expand Down
4 changes: 2 additions & 2 deletions packages/uipath/uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading