Skip to content

Commit aa5bb7e

Browse files
valentinabojanValentina Bojanclaude
authored
feat(guardrails): add enum/text/text-list validator parameter types (#1726)
Co-authored-by: Valentina Bojan <valentina.bojan@uipath.com> Co-authored-by: Claude <noreply@anthropic.com>
1 parent 0ac9070 commit aa5bb7e

4 files changed

Lines changed: 39 additions & 4 deletions

File tree

packages/uipath-platform/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-platform"
3-
version = "0.1.69"
3+
version = "0.1.70"
44
description = "HTTP client library for programmatic access to UiPath Platform"
55
readme = { file = "README.md", content-type = "text/markdown" }
66
requires-python = ">=3.11"

packages/uipath-platform/src/uipath/platform/guardrails/guardrails.py

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,43 @@ class NumberParameterValue(BaseModel):
3737
model_config = ConfigDict(populate_by_name=True, extra="allow")
3838

3939

40+
class EnumParameterValue(BaseModel):
41+
"""Single-select enum parameter value."""
42+
43+
parameter_type: Literal["enum"] = Field(alias="$parameterType")
44+
id: str
45+
value: str
46+
47+
model_config = ConfigDict(populate_by_name=True, extra="allow")
48+
49+
50+
class TextParameterValue(BaseModel):
51+
"""Free-text parameter value."""
52+
53+
parameter_type: Literal["text"] = Field(alias="$parameterType")
54+
id: str
55+
value: str
56+
57+
model_config = ConfigDict(populate_by_name=True, extra="allow")
58+
59+
60+
class TextListParameterValue(BaseModel):
61+
"""List-of-text parameter value."""
62+
63+
parameter_type: Literal["text-list"] = Field(alias="$parameterType")
64+
id: str
65+
value: list[str]
66+
67+
model_config = ConfigDict(populate_by_name=True, extra="allow")
68+
69+
4070
ValidatorParameter = Annotated[
41-
EnumListParameterValue | MapEnumParameterValue | NumberParameterValue,
71+
EnumListParameterValue
72+
| MapEnumParameterValue
73+
| NumberParameterValue
74+
| EnumParameterValue
75+
| TextParameterValue
76+
| TextListParameterValue,
4277
Field(discriminator="parameter_type"),
4378
]
4479

packages/uipath-platform/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.

packages/uipath/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)