JSON numeric getters accept booleans as integers and floats
メンテナーはふだん 1 日以内に返信
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 78/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- python
調査の方向性
JSON パースノードの実装にある JsonParseNode.get_int_value() と get_float_value() から始め、型付きプリミティブコレクションが各要素をどのように変換するかを追ってください。直接の値、JsonParseNodeFactory でパースされた子、明示的に型指定されたコレクションについて回帰テストを追加し、ブール値の getter、有効な数値変換、推論されたブール値コレクションを維持してください。ブール値が数値 getter から None を返し、対象を絞った回帰テストと既存の確認テストが通れば完了です。
索引モデルが issue の本文から書いたものです。
説明
Describe the bug
JsonParseNode.get_int_value() accepts JSON booleans as integers, and get_float_value() converts them to 1.0/0.0. This also occurs through child nodes parsed from JSON bytes and in explicitly typed numeric collections.
The implementation uses isinstance(value, int) / isinstance(value, (float, int)). In Python, bool is a subclass of int, but JSON booleans are not numeric tokens. Other non-number values already return None from these getters.
Reproduction
from kiota_serialization_json.json_parse_node import JsonParseNode
from kiota_serialization_json.json_parse_node_factory import JsonParseNodeFactory
print(JsonParseNode(True).get_int_value()) # True
print(JsonParseNode(False).get_float_value()) # 0.0
root = JsonParseNodeFactory().get_root_parse_node(
"application/json", b'{"count": true}'
)
print(root.get_child_node("count").get_int_value()) # True
print(JsonParseNode([1, True, False, 0]).get_collection_of_primitive_values(float))
# [1.0, 1.0, 0.0, 0.0]
Expected behavior
Boolean inputs should follow the existing non-number path and return None from integer/float getters, rather than silently becoming numbers. Numeric collection conversion should use the same element conversion behavior it already uses for other non-numeric values. The actual boolean getter, valid integers/floats, integer-to-float conversion, and inferred boolean collections should remain unchanged.
This is not a request to redesign primitive collection nullability (#777), change public signatures, or change JSON writer behavior.
Environment and validation
- Current main: ee58dcf.
- Python 3.14.5, Windows; editable local JSON/abstractions packages.
- Added scalar, real JSON factory/child, and typed collection regressions: 12 failures on unchanged source; focused run also has 20 passing controls/existing tests.
- No production traffic or external API credentials involved.
Discovered through source review and reproduced locally with AI assistance. I can provide the focused parser fix and regression tests.
- 主要言語
- Python
- スター
- 31
- フォーク
- 48
- 平均マージ
- 16時間 36分
- マージ済み PR(30日)
- 73
環境構築
このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
microsoft/kiota-python のほかの issue
-
Backing store enumeration returns internal tracking tuples instead of stored lists対応中かも @pradeep-ramola が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
microsoft/kiota-python#938 ·
メンテナーはふだん 1 日以内に返信
-
ensure 304 response code does not throw再び着手できるかも @nightcityblade が 92 日前に担当しましたが、オープン中のプルリクエストはありません。 オープンhelp wanted type:bug
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
microsoft/kiota-python#477 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 48/100
microsoft/kiota-python#901 ·
メンテナーはふだん 1 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 18/100
microsoft/kiota-python#898 ·
メンテナーはふだん 1 日以内に返信
-
type:breaking-change
難易度 5/5 1週間以上 初心者へのやさしさ 12/100
microsoft/kiota-python#777 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
microsoft/kiota-python の issue をすべて見る
似ている issue
-
backend: claude chore dependencies
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
briandconnelly/amicus#606 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
semantica-agi/semantica#2320 ·
メンテナーはふだん 2 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 77/100
vllm-project/vllm-omni#11465 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
jxxghp/MoviePilot#7699 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
vllm-project/vllm-ascend#24010 ·
メンテナーはふだん 1 日以内に返信