microsoftgraph / microsoftgraph/msgraph-sdk-python

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

Offen
#233 2 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Needs: Attention :wave:
Vorherrschende Sprache
Python
Sterne
630
Forks
96
Ø Merge
15 Std. 20 Min.
Gemergte PRs (30 T.)
3

Beschreibung

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

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Beginne mit dem PATCH-Aufruf in msgraph/generated/applications/item/application_item_request_builder.py ungefähr in Zeile 123 und untersuche das AppRole-Modell in msgraph/generated/models/app_role.py. Reproduziere die Anfrage anhand des bereitgestellten Beispiels und ermittle, welche Werte die Microsoft Graph API als Duplikate behandelt. Als erledigt gilt die Aufgabe, wenn die Ursache und das erforderliche PATCH-Verhalten eindeutig festgestellt sind und, sofern das Repository dies unterstützt, ein Regressionstest oder eine Dokumentationsaktualisierung vorhanden ist.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
python
Bereich
api
Issue-Typ
Bug
Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Aktivitätsstatus
Veraltet
Klarheit
Muss geklärt werden
Anfängerfreundlichkeit
25/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.