Primitive and enum collections contain None despite non-nullable element annotations
維護者通常 1 天內回覆
還沒有人認領這個 Issue。
評估
研究方向
Start with get_collection_of_primitive_values and get_collection_of_enum_values in packages/serialization/json/kiota_serialization_json/json_parse_node.py, plus the nullable converters below them, and compare them with the public contracts in packages/abstractions/kiota_abstractions/serialization/parse_node.py. The issue asks maintainers to choose between widening the annotations and rejecting nulls, so agree on that direction before editing. Done means a decision is recorded and tests cover nulls, wrong shapes, temporal failures and array-versus-CSV enum behaviour.
由索引模型根據 Issue 內容生成。
描述
Problem
Optional[list[T]] permits an absent collection, not None elements. JSON primitive and enum collection readers retain nullable conversion results, while generated properties expose non-nullable elements.
Reproduction
import json
from enum import Enum
from kiota_serialization_json.json_parse_node import JsonParseNode
JsonParseNode(json.loads('["a", null, 42]')).get_collection_of_primitive_values(str)
# ["a", None, None], despite Optional[list[str]]
class Colour(Enum):
Red = "red"
JsonParseNode(json.loads('["red", null, "unknown"]')).get_collection_of_enum_values(Colour)
# [Colour.Red, None, None]
These reproductions are source-derived. CSV enum parsing filters unsuccessful results, unlike enum array parsing. Some malformed temporal/UUID values throw while other conversions return None. Model factories normally create empty models for JSON null; they are not included in this confirmed mismatch.
Source
- Public collection contracts
- Primitive mapping
- Enum mapping
- Nullable converters
- Typed model and collection assignment
Expected resolution and breaking impact
Either reflect nullable elements in abstractions, implementations and generated models, or reject null/unsuccessful conversions when promising non-nullable elements. Widening annotations is source-breaking; throwing changes behavior. Avoid casts that hide the mismatch or silent filtering of position-sensitive arrays. Cover nulls, wrong primitive shapes, temporal conversion failures and array-versus-CSV enum behavior. Coordinate runtime and generator releases.
Related cross-language audit: microsoft/kiota#8377.
- 主要語言
- Python
- 星號
- 31
- 分支
- 48
- 平均合併
- 16 小時 36 分鐘
- 30 天內合併 PR
- 73
環境準備
在瀏覽器裡用你自己的 GitHub 帳號啟動這個專案的開發容器。
- 沒有 Dockerfile 或 Docker Compose 檔案
- 有 Pull Request 範本
- 閱讀貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 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 天內回覆
-
JSON numeric getters accept booleans as integers and floats可能已有人在做 @pradeep-ramola 今天認領。 未關閉
難度 2/5 1-3 小時 新手友好度 78/100
microsoft/kiota-python#935 ·
維護者通常 1 天內回覆
-
ensure 304 response code does not throw可能重新可做 @nightcityblade 於 92 天前認領,目前沒有進行中的 PR。 未關閉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 天內回覆
查看 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 天內回覆