microsoftgraph / microsoftgraph/msgraph-sdk-python
Patch application to add new app_role throws ODataError `Request contains a property with duplicate values.`
还没有人认领这个 Issue。
- 主要语言
- Python
- 星标
- 630
- 派生
- 96
- 平均合并
- 15 小时 20 分钟
- 30 天内合并 PR
- 3
描述
Hello,
I would like to add a new app_role called test to an app registration, I used following code, but got ODataError Request contains a property with duplicate values.:
from msgraph.generated.models.application import Application
from msgraph.generated.models.app_role import AppRole
from uuid import uuid4
# some other imports and client init ignored here, as not relevant
app_id = "an existing app id"
role_name = "test"
app_role = AppRole()
app_role.allowed_member_types = ["User", "Application"]
app_role.description = role_name
app_role.display_name = role_name
app_role.is_enabled = True
app_role.id = str(uuid4())
app_role.origin = "Application"
app_role.value = role_name
app = Application()
app.app_roles = [app_role]
# get() is OK
get_result = await client.applications.by_application_id(app_id).get()
# patch is KO
patch_result = await client.applications.by_application_id(app_id).patch(body=app)
The below command throws error: 'Request contains a property with duplicate values.' (code: DuplicateValue) after the internal command:
https://github.com/microsoftgraph/msgraph-sdk-python/blob/33cb15a452bd92b85ae62faaecc879761586237f/msgraph/generated/applications/item/application_item_request_builder.py#L123
Could you please give a help to explain what are the duplicate values, I checked the model of app_role, it should be OK:
https://github.com/microsoftgraph/msgraph-sdk-python/blob/main/msgraph/generated/models/app_role.py
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
从 msgraph/generated/applications/item/application_item_request_builder.py 中约第 123 行的 PATCH 调用开始,并检查 msgraph/generated/models/app_role.py 中的 AppRole 模型。使用提供的示例重现请求,并确定 Microsoft Graph API 将哪些值视为重复值。当原因和所需的 PATCH 行为得到明确确认,并且在 repository 支持的情况下包含回归测试或文档更新时,即视为完成。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- python
- 领域
- api
- Issue 类型
- 缺陷
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 活跃度
- 停滞
- 描述清晰度
- 需要澄清
- 新手友好度
- 25/100