microsoftgraph / microsoftgraph/msgraph-sdk-python

Patch application to add new app_role throws ODataError `Request contains a property with duplicate values.`

Đang mở
#233 2 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Needs: Attention :wave:
Ngôn ngữ chính
Python
Star
630
Fork
96
Merge trung bình
15 giờ 20 phút
Pull request đã merge (30 ngày)
3

Mô tả

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

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. 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.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Hướng nghiên cứu

Bắt đầu với lệnh gọi PATCH trong msgraph/generated/applications/item/application_item_request_builder.py, khoảng dòng 123, và kiểm tra mô hình AppRole trong msgraph/generated/models/app_role.py. Tái hiện yêu cầu bằng ví dụ được cung cấp và xác định những giá trị nào được Microsoft Graph API coi là trùng lặp. Được xem là hoàn tất khi nguyên nhân và hành vi PATCH bắt buộc đã được xác lập rõ ràng, kèm theo một bài kiểm thử hồi quy hoặc bản cập nhật tài liệu nếu repository hỗ trợ một trong hai.

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ó
4/5
Thời gian dự kiến
3-5 ngày
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Cần làm rõ
Mức phù hợp với người mới
25/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.