microsoftgraph / microsoftgraph/msgraph-beta-sdk-python

conditionalAccessConditionSet resource type desterilizes dropping agentIdRiskLevels

Aperta
#1,033 0 commenti 1 reazione 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

type:bug type:investigation
Lingua principale
Python
Stelle
44
Fork
16
Merge medio
20h 39m
PR unite (30g)
3

Descrizione

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_

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Inizia con conditional_access_condition_set.py e con l’implementazione di get_collection_of_enum_values in kiota-serialization-json; riproduci la risposta scalare "high" tramite il recupero documentato dei criteri. Determina se la responsabilità è dell’API o del serializzatore, quindi verifica che agent_id_risk_levels conservi il valore come [ConditionalAccessAgentIdRiskLevels.High].

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
python
Ambito
api
Tipo di issue
Bug
Difficoltà
3/5
Tempo stimato
1-2 giorni
Stato di attività
Tranquilla
Chiarezza
Abbastanza chiara
Idoneità per principianti
48/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.