Skip to content

Commit a435768

Browse files
committed
fix(requests): approvedBy/rejectedBy untyped — wire shape varies by platform version (BLDX-1611)
Second live failure on the same fields: rejectedBy is a list of approver OBJECTS on kill-argo (first fix assumed list of strings — typed from inference, not evidence). These fields now parse as Any with the variants documented; regression test parses string, string-list, and object-list shapes. Follow-up: capture the real payload and introduce a typed Approver model from evidence.
1 parent 1d427f2 commit a435768

2 files changed

Lines changed: 23 additions & 15 deletions

File tree

pyatlan/model/atlan_request.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -132,18 +132,20 @@ class AtlanRequest(AtlanObject):
132132
default=None,
133133
description="How the request must be approved: `single`, `unanimous` or `consesus`.",
134134
)
135-
approved_by: Optional[Union[str, List[str]]] = Field(
135+
approved_by: Optional[Any] = Field(
136136
default=None,
137137
description=(
138-
"User(s) who approved the request — a list when the request "
139-
"has multiple approvers."
138+
"Who approved the request. The wire shape varies by platform "
139+
"version: a username string, a list of usernames, or a list of "
140+
"approver-detail objects — kept untyped so every variant parses."
140141
),
141142
)
142-
rejected_by: Optional[Union[str, List[str]]] = Field(
143+
rejected_by: Optional[Any] = Field(
143144
default=None,
144145
description=(
145-
"User(s) who rejected the request — a list when the request "
146-
"has multiple approvers."
146+
"Who rejected the request. The wire shape varies by platform "
147+
"version: a username string, a list of usernames, or a list of "
148+
"approver-detail objects — kept untyped so every variant parses."
147149
),
148150
)
149151
status: Optional[str] = Field(

tests/unit/test_requests_client.py

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -86,15 +86,21 @@ def test_actioned_records_with_list_approvers_parse():
8686
"""rejectedBy/approvedBy come back as LISTS for multi-approver requests —
8787
a page containing already-actioned records must parse (regression: the
8888
str-typed fields crashed list() on any tenant with actioned requests)."""
89-
actioned = {
90-
**RAW_REQUEST,
91-
"status": "rejected",
92-
"rejectedBy": ["admin-one", "admin-two"],
93-
"approvedBy": [],
94-
}
95-
parsed = AtlanRequest(**actioned)
96-
assert parsed.rejected_by == ["admin-one", "admin-two"]
97-
assert parsed.approved_by == []
89+
# every shape seen or plausible in the wild must parse
90+
for rejected_by in (
91+
"admin-one",
92+
["admin-one", "admin-two"],
93+
[{"username": "admin-one", "timestamp": 1786100000000}],
94+
):
95+
actioned = {
96+
**RAW_REQUEST,
97+
"status": "rejected",
98+
"rejectedBy": rejected_by,
99+
"approvedBy": [],
100+
}
101+
parsed = AtlanRequest(**actioned)
102+
assert parsed.rejected_by == rejected_by
103+
assert parsed.approved_by == []
98104

99105

100106
def test_filter_builder_combines_with_and():

0 commit comments

Comments
 (0)