microsoftgraph / microsoftgraph/msgraph-sdk-python
Patch application to add new app_role throws ODataError `Request contains a property with duplicate values.`
Personne n'a encore pris cette issue.
- Langage dominant
- Python
- Étoiles
- 630
- Forks
- 96
- Merge moyen
- 15 h 20 min
- PR mergées (30 j)
- 3
Description
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
Guide de contribution
Ouvrir le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Piste de recherche
Commencez par l’appel PATCH dans msgraph/generated/applications/item/application_item_request_builder.py vers la ligne 123 et examinez le modèle AppRole dans msgraph/generated/models/app_role.py. Reproduisez la requête à l’aide de l’exemple fourni et déterminez quelles valeurs la Microsoft Graph API traite comme des doublons. Le travail est considéré comme terminé lorsque la cause et le comportement PATCH requis sont clairement établis, avec un test de régression ou une mise à jour de la documentation si le dépôt en prend en charge un ou une.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Évaluation
- Stack technique
- python
- Domaine
- api
- Type d'issue
- Bug
- Difficulté
- 4/5
- Temps estimé
- 3-5 jours
- Activité
- À l'abandon
- Clarté
- À clarifier
- Accessibilité débutants
- 25/100