microsoftgraph / microsoftgraph/msgraph-sdk-java
The Api response not match with sdk response.
還沒有人認領這個 Issue。
- 主要語言
- Java
- 星號
- 444
- 分支
- 154
- 平均合併
- 18 小時 28 分鐘
- 30 天內合併 PR
- 4
描述
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:
-
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 withnullvalues. For example, a response might contain:{ "displayName": "John Doe", "jobTitle": null, "mobilePhone": "123-456-7890", "officeLocation": null, // ... other properties }In this example,
jobTitleandofficeLocationare explicitly present withnullvalues. -
Using Microsoft Graph Java SDK:
I am using themicrosoft-graphSDK (version 6.19.0) and have initialized aGraphServiceClient. When I perform a similar operation to retrieve user data (e.g.,graphServiceClient.me().buildRequest().get()), and then attempt to access the deserializedUserobject, properties that hadnullvalues in the raw API response are seemingly filtered out or omitted during the deserialization process.After retrieving the
Userobject 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 theBackingStorelayer), only the keys with non-null values are present. The properties that werenullin the original API response are entirely absent from the deserializedUserobject'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-graphversion: [6.19.0]- Java Version: [24.0.1]
貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
研究方向
首先使用 microsoft-graph 6.19.0 重現 GraphServiceClient.me().buildRequest().get() 的行為,將 Microsoft Graph 的直接回應與反序列化後的 User 物件及其重新序列化後的形式進行比較。接著檢查 Kiota 產生的模型和 BackingStore 的行為,以判斷是否能區分明確為 null 的屬性與不存在的屬性。完成的標準是記錄可用的設定,或確認 SDK 不會保留這項區別。
由索引模型根據 Issue 內容生成。
評估
- 技術堆疊
- java
- 領域
- api
- Issue 類型
- 缺陷
- 難度
- 4/5
- 預估耗時
- 3-5 天
- 活躍度
- 停滯
- 描述清晰度
- 需要釐清
- 新手友好度
- 35/100