JSON numeric getters accept booleans as integers and floats
Maintainer thường phản hồi trong vòng 1 ngày
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 78/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- python
- Lĩnh vực
- backend-api-design
Hướng nghiên cứu
Bắt đầu với JsonParseNode.get_int_value() và get_float_value() trong phần triển khai nút phân tích JSON, sau đó lần theo cách các collection kiểu nguyên thủy chuyển đổi từng phần tử. Thêm các hồi quy cho giá trị trực tiếp, các nút con được phân tích bởi JsonParseNodeFactory và các collection được chỉ định kiểu rõ ràng; giữ nguyên các getter boolean, các chuyển đổi số hợp lệ và các collection boolean được suy luận. Hoàn tất khi boolean trả về None từ các getter số và các hồi quy tập trung cùng các kiểm thử đối chứng hiện có đều đạt.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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.
- Ngôn ngữ chính
- Python
- Star
- 31
- Fork
- 48
- Merge trung bình
- 16 giờ 36 phút
- Pull request đã merge (30 ngày)
- 73
Chuẩn bị môi trường
Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của microsoft/kiota-python
-
Backing store enumeration returns internal tracking tuples instead of stored listsCó thể đã có người làm @pradeep-ramola đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
microsoft/kiota-python#938 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
ensure 304 response code does not throwCó thể làm lại được @nightcityblade đã nhận 92 ngày trước và không có pull request nào đang mở. Đang mởhelp wanted type:bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
microsoft/kiota-python#477 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 48/100
microsoft/kiota-python#901 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 18/100
microsoft/kiota-python#898 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
type:breaking-change
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 12/100
microsoft/kiota-python#777 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của microsoft/kiota-python
Issue tương tự
-
backend: claude chore dependencies
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
briandconnelly/amicus#606 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
semantica-agi/semantica#2320 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 77/100
vllm-project/vllm-omni#11465 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
jxxghp/MoviePilot#7699 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
vllm-project/vllm-ascend#24010 ·
Maintainer thường phản hồi trong vòng 1 ngày