Issue with unevaluatedProperties and allOf and arrays
维护者通常 6 天内回复
还没有人认领这个 Issue。
评估
调研方向
未提及任何仓库文件、测试或入口点。首先使用 validator 运行提供的 schema 和实例数据,然后单独研究 unevaluatedProperties 在 allOf 数组项中的行为。完成标准是确定所报告的对 Nestedppty 的拒绝是预期行为还是 validator 缺陷;如果是缺陷,则添加一个有针对性的回归测试。
由索引模型根据 Issue 内容生成。
描述
I need to have a schema allowing extra fields only under one specific node (ExtensionProperties).
It works well using "additionalProperties": false with simple schemas:
{
"$schema": "https://json-schema.org/draft/2019-09/schema#",
"type": "object",
"additionalProperties": false,
"properties": {
"rootppty": {
"type": "string"
},
"ExtensionProperties": {
"type": "object"
}
}
}
This data is ok
{
"rootppty": "ad",
"ExtensionProperties": {
"whatever": "you want"
}
}
and this one fails validation as expected
{
"rootppty": "ok",
"other": "fail",
"ExtensionProperties": {
"whatever": "you want"
}
}
But when I have some allOf, I need to use "unevaluatedProperties": false as explained in the documentation
It works well with simple schemas
{
"$schema": "https://json-schema.org/draft/2019-09/schema#",
"type": "object",
"additionalProperties": false,
"properties": {
"rootppty": {
"type": "string"
},
"data": {
"unevaluatedProperties": false,
"allOf": [{
"type": "object",
"title": "IndividualProperties",
"properties": {
"Nestedppty": {
"type": "string"
}
}
}
]
},
"ExtensionProperties": {
"type": "object"
}
}
}
This data fails the validation as expected (on rootppty2 and Nestedppty2)
{
"rootppty": "ok",
"rootppty2": "fail",
"data": {
"Nestedppty": "ok",
"Nestedppty2": "fail"
},
"ExtensionProperties": {
"whatever": "you want"
}
}
But when I am adding array in the allOf part I am facing issues
This schema does not fail validation on additional fields in the array
{
"$schema": "https://json-schema.org/draft/2019-09/schema#",
"type": "object",
"additionalProperties": false,
"properties": {
"rootppty": {
"type": "string"
},
"data": {
"unevaluatedProperties": false,
"allOf": [{
"type": "object",
"title": "IndividualProperties",
"properties": {
"Nestedppty": {
"type": "string"
},
"Nestedarray": {
"type": "array",
"items": {
"unevaluatedProperties": false,
"type": "object",
"properties": {
"additionalProperties": false,
"nestedarrayInternalpty": {
"type": "string"
}
}
}
}
}
}
]
},
"ExtensionProperties": {
"type": "object"
}
}
}
for example this data should fail validation on nestedarrayInternalpty2
{
"rootppty": "ok",
"data": {
"Nestedppty": "ok",
"Nestedarray": [
{"nestedarrayInternalpty": "ok"},
{"nestedarrayInternalpty2": "should fail"}
]
},
"ExtensionProperties": {
"whatever": "you want"
}
}
but it fails also on Nestedppty, which should be ok
Am I doing something wrong or is there an issue when several "unevaluatedProperties": false are nested ?
- 主要语言
- Python
- 星标
- 5k
- 派生
- 741
- 平均合并
- 4 天 17 小时
- 30 天内合并 PR
- 6
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
python-jsonschema/jsonschema 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 72/100
python-jsonschema/jsonschema#1610 · 1 条评论 ·
维护者通常 6 天内回复
-
难度 2/5 1-3 小时 新手友好度 65/100
python-jsonschema/jsonschema#1588 · 2 条评论 ·
维护者通常 6 天内回复
-
Iterator error contexts lose parent links and absolute paths可能重新可做 @DawnofGenX 于 59 天前认领,目前没有进行中的 PR。 未关闭
难度 2/5 1-3 小时 新手友好度 76/100
python-jsonschema/jsonschema#1584 · 3 条评论 ·
维护者通常 6 天内回复
-
regex format checker crashes with RecursionError on deeply nested patterns可能已有人在做 @DawnofGenX 于 59 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 78/100
python-jsonschema/jsonschema#1538 · 1 条评论 ·
维护者通常 6 天内回复
-
is_duration raises an uncaught decimal.Overflow on a duration with a large exponent可能重新可做 关联的 PR 已关闭且未合并。 未关闭Needs Test Upstream
难度 2/5 1-3 小时 新手友好度 78/100
python-jsonschema/jsonschema#1511 · 1 条评论 ·
维护者通常 6 天内回复
查看 python-jsonschema/jsonschema 的全部 Issue
相似的 Issue
-
难度 1/5 1-3 小时 新手友好度 78/100
web-push-libs/pywebpush#216 · 1 条评论 ·
-
难度 2/5 1-3 小时 新手友好度 72/100
AgriciDaniel/claude-seo#572 ·
维护者通常 5 天内回复
-
area:print-dispatch
难度 2/5 1-3 小时 新手友好度 92/100
维护者通常 1 天内回复
-
area: docs domain: technical-writing good first issue type: documentation
难度 2/5 1-3 小时 新手友好度 80/100
Deepak3699/Ai_Mentor#919 ·
维护者通常 2 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复