microsoftgraph / microsoftgraph/msgraph-beta-sdk-python
conditionalAccessConditionSet resource type desterilizes dropping agentIdRiskLevels
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- Python
- Sterne
- 44
- Forks
- 16
- Ø Merge
- 20 Std. 39 Min.
- Gemergte PRs (30 T.)
- 3
Beschreibung
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
-
Have a Conditional Access policy with an agent ID risk level condition set (e.g. high)
-
Fetch policies via the Beta SDK:
result = await graph_client.identity.conditional_access.policies.get() -
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_
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Beginne mit conditional_access_condition_set.py und der Implementierung von get_collection_of_enum_values in kiota-serialization-json; reproduziere die skalare Antwort "high" über den dokumentierten Richtlinienabruf. Bestimme, ob die API oder der Serializer dafür verantwortlich ist, und überprüfe anschließend, dass agent_id_risk_levels den Wert als [ConditionalAccessAgentIdRiskLevels.High] beibehält.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- python
- Bereich
- api
- Issue-Typ
- Bug
- Schwierigkeit
- 3/5
- Geschätzter Aufwand
- 1-2 Tage
- Aktivitätsstatus
- Ruhig
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 48/100