microsoftgraph / microsoftgraph/msgraph-beta-sdk-python
conditionalAccessConditionSet resource type desterilizes dropping agentIdRiskLevels
Chưa có ai nhận issue này.
- Ngôn ngữ chính
- Python
- Star
- 44
- Fork
- 16
- Merge trung bình
- 20 giờ 39 phút
- Pull request đã merge (30 ngày)
- 3
Mô tả
Describe the bug
The SDK model in conditional_access_condition_set.py correctly declares this as a collection:
"agentIdRiskLevels": lambda n: setattr(
self, 'agent_id_risk_levels',
n.get_collection_of_enum_values(ConditionalAccessAgentIdRiskLevels)
)
However, kiota-serialization-json's get_collection_of_enum_values only handles list inputs:
def get_collection_of_enum_values(self, enum_class: K) -> Optional[list[K]]:
if isinstance(self._json_node, list): # scalar string fails this check
return list(map(
lambda x: self._create_new_node(x).get_enum_value(enum_class),
self._json_node
))
return [] # ← value silently dropped
When the API returns "high" (a string, not a list), isinstance(self._json_node, list) is False, so the method returns [] and the actual value is silently lost.
Expected behavior
policy.conditions.agent_id_risk_levels should return [ConditionalAccessAgentIdRiskLevels.High].
The issue could be:
API-side: The API should return ["high"] (array) per the documentation, which describes this as a collection
Kiota-side: get_collection_of_enum_values should handle a scalar gracefully by wrapping it in a list (this may warrant a separate issue on microsoft/kiota-serialization-json-python)
How to reproduce
-
Have a Conditional Access policy with an agent ID risk level condition set (e.g. high)
-
Fetch policies via the Beta SDK:
result = await graph_client.identity.conditional_access.policies.get() -
Inspect policy.conditions.agent_id_risk_levels — it will be [] instead of [ConditionalAccessAgentIdRiskLevels.High]
SDK Version
1.57
Latest version known to work for scenario above?
No response
Known Workarounds
No response
Debug output
Click to expand log
```</details>
### Configuration
_No response_
### Other information
_No response_
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Hướng nghiên cứu
Bắt đầu với conditional_access_condition_set.py và phần triển khai get_collection_of_enum_values trong kiota-serialization-json; tái hiện phản hồi vô hướng "high" thông qua việc truy xuất policy theo tài liệu. Xác định API hay serializer chịu trách nhiệm, sau đó xác minh rằng agent_id_risk_levels giữ nguyên giá trị dưới dạng [ConditionalAccessAgentIdRiskLevels.High].
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- python
- Lĩnh vực
- api
- Loại issue
- Lỗi
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức độ hoạt động
- Ít trao đổi
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 48/100