microsoftgraph / microsoftgraph/msgraph-sdk-java

The Api response not match with sdk response.

Aperta
#2,417 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Lingua principale
Java
Stelle
444
Fork
154
Merge medio
18h 28m
PR unite (30g)
4

Descrizione

Issue: Null Values Not Being Deserialized for Microsoft Graph API Responses via Java SDK

Description:

I am encountering an unexpected behavior when using the Microsoft Graph Java SDK to retrieve user data. Specifically, properties with null values in the API response are not being included in the deserialized object when using the SDK, while they are present when making a direct API call.

Detailed Scenario:

  1. Direct API Call (e.g., Postman):
    When I make a direct GET request to the Microsoft Graph API (e.g., https://graph.microsoft.com/v1.0/me) using a tool like Postman, the JSON response includes all properties, even those with null values. For example, a response might contain:

    {
      "displayName": "John Doe",
      "jobTitle": null,
      "mobilePhone": "123-456-7890",
      "officeLocation": null,
      // ... other properties
    }
    

    In this example, jobTitle and officeLocation are explicitly present with null values.

  2. Using Microsoft Graph Java SDK:
    I am using the microsoft-graph SDK (version 6.19.0) and have initialized a GraphServiceClient. When I perform a similar operation to retrieve user data (e.g., graphServiceClient.me().buildRequest().get()), and then attempt to access the deserialized User object, properties that had null values in the raw API response are seemingly filtered out or omitted during the deserialization process.

    After retrieving the User object and attempting to access its members, or after performing serialization of this SDK-generated object (especially when dealing with the Kiota-generated models and potentially abstracting the BackingStore layer), only the keys with non-null values are present. The properties that were null in the original API response are entirely absent from the deserialized User object's fields or when re-serializing the object.

Expected Behavior:

I expect the Microsoft Graph Java SDK's deserialization process to faithfully represent the entire API response, including properties that have null values. These null properties should be present in the deserialized User object, allowing me to differentiate between a property that is genuinely absent from the response and one that is explicitly present but with a null value.

Question/Request:

Is there any configuration or setting available within the Microsoft Graph Java SDK (or the underlying Kiota libraries) that allows for the deserialization of properties with null values, ensuring they are retained in the resulting Java objects? My goal is to prevent the implicit filtering of these null-valued keys.

SDK Version: :

  • microsoft-graph version: [6.19.0]
  • Java Version: [24.0.1]

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

Iniziare riproducendo il comportamento di GraphServiceClient.me().buildRequest().get() con microsoft-graph 6.19.0, confrontando la risposta diretta di Microsoft Graph con l’oggetto User deserializzato e la sua forma nuovamente serializzata. Esaminare quindi il modello generato da Kiota e il comportamento di BackingStore per determinare se le proprietà esplicitamente nulle possono essere distinte dalle proprietà assenti. Il lavoro è completato quando viene documentata la configurazione disponibile oppure viene confermato che l’SDK non conserva questa distinzione.

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

Valutazione

Stack tecnologico
java
Ambito
api
Tipo di issue
Bug
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Ferma
Chiarezza
Da chiarire
Idoneità per principianti
35/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.