batch response bodies are dropped when they are JSON objects
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
調査の方向性
まず src/msgraph_core/requests/batch_response_item.py の body デシリアライザーから始め、次に kiota serialization JSON package の JsonParseNode._get_bytes_value() と BatchResponseContent のフローを調べます。BatchRequestBuilder を通じて、個々の body が JSON オブジェクトであるバッチレスポンスを再現します。完了条件は、オブジェクトが None になる代わりに BatchResponseItem.body に保持されることです。
索引モデルが issue の本文から書いたものです。
説明
Summary
After upgrading to the Kiota Python version containing #646, batch responses from Microsoft Graph can no longer be deserialized correctly when an individual response body is a JSON object.
I am updating SharePoint list items in a batch request. The HTTP adapter returns the batch response body as a Python dict. During deserialization, BatchResponseItem passes that value to JsonParseNode.get_bytes_value(). The current _get_bytes_value() implementation only handles str values and returns None for dictionaries, so the response body is silently swallowed.
Before #646, non-string values were converted to a JSON string/UTF-8 byte sequence. That byte sequence was later parsed again as JSON, restoring the response body as a dictionary. #646 removed the non-string fallback needed for JSON object bodies.
This issue might originally stem from incorrect use of JsonParseNode in https://github.com/microsoftgraph/msgraph-sdk-python-core/blob/d23507bf38497aa514763f3ffa56b8ed8eceef70/src/msgraph_core/requests/batch_response_item.py#L159 but it didn't occur until the changes made in #646. If a fix should rather be made in msgraph-core, please let me know and I will raise the issue there.
Environment
- Python: 3.13
microsoft-kiota-bundle: 1.12.3microsoft-kiota-serialization-json: 1.12.3microsoft-kiota-http: 1.12.3msgraph-core: 1.5.1
Reproduction
- Create a Microsoft Graph batch request containing SharePoint list-item updates.
- Send the request through
msgraph_core.requests.batch_request_builder.BatchRequestBuilder. - Return a successful response whose individual
bodyis a JSON object. - Deserialize the batch response as
BatchResponseContent.
The individual BatchResponseItem.body is expected to contain the JSON object, but it becomes None during deserialization.
Debugger call stack
I'm including a trace to where my app is hitting this regression.
Traceback (most recent call last):
File ".venv/Lib/site-packages/msgraph_core/requests/batch_request_builder.py", line 103, in _post_batch_collection
response = await self.post(batch_request_content, error_map)
File ".venv/Lib/site-packages/msgraph_core/requests/batch_request_builder.py", line 65, in post
response = await self._request_adapter.send_async(
File ".venv/Lib/site-packages/kiota_http/httpx_request_adapter.py", line 198, in send_async
value = root_node.get_object_value(parsable_factory)
File ".venv/Lib/site-packages/kiota_serialization_json/json_parse_node.py", line 213, in get_object_value
self._assign_field_values(result)
File ".venv/Lib/site-packages/kiota_serialization_json/json_parse_node.py", line 352, in _assign_field_values
field_deserializer(JsonParseNode(field_value))
File ".venv/Lib/site-packages/msgraph_core/requests/batch_response_content.py", line 156, in <lambda>
return {'responses': lambda n: set_responses(n)}
File ".venv/Lib/site-packages/msgraph_core/requests/batch_response_content.py", line 150, in set_responses
values = n.get_collection_of_object_values(BatchResponseItem)
File ".venv/Lib/site-packages/kiota_serialization_json/json_parse_node.py", line 153, in <lambda>
lambda x: self._create_new_node(x).get_object_value(factory),
File ".venv/Lib/site-packages/kiota_serialization_json/json_parse_node.py", line 213, in get_object_value
self._assign_field_values(result)
File ".venv/Lib/site-packages/kiota_serialization_json/json_parse_node.py", line 352, in _assign_field_values
field_deserializer(JsonParseNode(field_value))
File ".venv/Lib/site-packages/msgraph_core/requests/batch_response_item.py", line 159, in <lambda>
"body": lambda x: setattr(self, "body", x.get_bytes_value()),
File ".venv/Lib/site-packages/kiota_serialization_json/json_parse_node.py", line 223, in get_bytes_value
return self._get_bytes_value(self._json_node)
File ".venv/Lib/site-packages/kiota_serialization_json/json_parse_node.py", line 296, in _get_bytes_value
return None
- 主要言語
- Python
- スター
- 31
- フォーク
- 40
- 平均マージ
- 1日 1時間
- マージ済み PR(30日)
- 32
環境構築
このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
microsoft/kiota-python のほかの issue
-
help wanted type:bug
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
microsoft/kiota-python#477 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 3/5 1〜2日 初心者へのやさしさ 55/100
microsoft/kiota-python#745 ·
メンテナーはふだん 1 日以内に返信
-
難易度 3/5 1〜2日 初心者へのやさしさ 55/100
microsoft/kiota-python#744 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 5/5 1週間以上 初心者へのやさしさ 35/100
microsoft/kiota-python#722 · コメント 4 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 5/5 1週間以上 初心者へのやさしさ 18/100
microsoft/kiota-python#533 · コメント 1 件 · リアクション 1 件 ·
メンテナーはふだん 1 日以内に返信
microsoft/kiota-python の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 83/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 86/100
FuRongJun-1999/dsh-memory#65 ·
メンテナーはふだん 1 日以内に返信
-
ci needs-ac
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
Ikalus1988/MisakaNet#2930 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
Qiskit/qiskit-aer#2466 ·
-
area/cli
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100