microsoftgraph / microsoftgraph/msgraph-beta-sdk-python

conditionalAccessConditionSet resource type desterilizes dropping agentIdRiskLevels

未关闭
#1,033 0 条评论 1 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

type:bug type:investigation
主要语言
Python
星标
44
派生
16
平均合并
20 小时 39 分钟
30 天内合并 PR
3

描述

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
  1. Have a Conditional Access policy with an agent ID risk level condition set (e.g. high)

  2. Fetch policies via the Beta SDK:
    result = await graph_client.identity.conditional_access.policies.get()

  3. 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_

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

从 conditional_access_condition_set.py 以及 kiota-serialization-json 中 get_collection_of_enum_values 的实现开始;通过文档所述的策略获取来重现标量 "high" 响应。确定问题是由 API 还是序列化器负责,然后验证 agent_id_risk_levels 是否将该值保留为 [ConditionalAccessAgentIdRiskLevels.High]。

由索引模型根据 Issue 内容生成。

评估

技术栈
python
领域
api
Issue 类型
缺陷
难度
3/5
预计耗时
1-2 天
活跃度
冷清
描述清晰度
基本清楚
新手友好度
48/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。