conditionalAccessConditionSet resource type desterilizes dropping agentIdRiskLevels

Ouverte
#1,033 0 commentaires 1 réaction 0 personnes assignées Voir sur GitHub

Personne n'a encore pris cette issue.

Évaluation

Difficulté
3/5
Temps estimé
1-2 jours
Accessibilité débutants
48/100
Type d'issue
Bug
Clarté
Plutôt claire
Activité
Calme
Stack technique
python
Domaine
api

Piste de recherche

Commencez par conditional_access_condition_set.py et l’implémentation de get_collection_of_enum_values dans kiota-serialization-json ; reproduisez la réponse scalaire "high" via la récupération documentée de la stratégie. Déterminez si l’API ou le sérialiseur est responsable, puis vérifiez que agent_id_risk_levels conserve la valeur sous la forme [ConditionalAccessAgentIdRiskLevels.High].

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Description

type:bug type:investigation
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_
Langage dominant
Python
Étoiles
44
Forks
16
Merge moyen
20 h 39 min
PR mergées (30 j)
3

Guide de contribution

Ouvrir le guide de contribution

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Autres issues de microsoftgraph/msgraph-beta-sdk-python

Toutes les issues de microsoftgraph/msgraph-beta-sdk-python

Issues similaires

Plus d'issues Python

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.