microsoftgraph / microsoftgraph/msgraph-sdk-java

The Api response not match with sdk response.

Abierto
#2,417 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Lenguaje dominante
Java
Estrellas
444
Forks
154
Merge medio
18 h 28 min
PR fusionados (30 d)
4

Descripción

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]

Guía de contribución

Abrir la guía de contribución

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Línea de trabajo

Empiece reproduciendo el comportamiento de GraphServiceClient.me().buildRequest().get() con microsoft-graph 6.19.0, comparando la respuesta directa de Microsoft Graph con el objeto User deserializado y su forma serializada de nuevo. Después, inspeccione el modelo generado por Kiota y el comportamiento de BackingStore para determinar si las propiedades nulas explícitas pueden distinguirse de las propiedades ausentes. Se considera terminado cuando se documente la configuración disponible o se confirme que el SDK no conserva esta distinción.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
java
Área
api
Tipo de issue
Error
Dificultad
4/5
Tiempo estimado
3-5 días
Estado de actividad
Estancado
Claridad
Necesita aclaración
Aptitud para principiantes
35/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.