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 天内回复