Idea: warn on unsupported keywords (e.g. "const" in draft-04 schemas)
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 38/100
- Issue 类型
- 功能
- 描述清晰度
- 基本清楚
- 活跃度
- 停滞
- 技术栈
- python
调研方向
从 validate 示例和 DraftXValidator 实现开始。检查每个 draft 如何处理 schema 关键字,然后为列出的较新或已重命名关键字定义警告行为,同时保留对未知 format 值的现有处理方式;在受影响的 draft 验证器中验证这些警告。
由索引模型根据 Issue 内容生成。
描述
I just spent a few minutes digging into a test failure which boiled down to the following:
from jsonschema import validate
schema = {
"$schema": "http://json-schema.org/draft-04/schema#",
"const": None,
}
validate("literally anything validates", schema)
which is of course because the const keyword was added in draft-06! Since I've seen analogous problems several times now, I wonder if we should make the earlier DraftXValidators emit a warning when they see a keyword which was added in a later draft. That would be:
- <= draft04, warn on
propertyNames,contains, andconst(added in draft06) - <= draft06, warn on
if,then, andelse(added in draft07) - In draft07, the
mediakeyword was replaced withcontentMediaTypeandcontentEncoding, so warnings on both sides could help - <= draft07... there are lots
I've ignored the string format values, because they explictly permit ignoring unknown values and it's reasonable to think that users might have backported a check - whereas the too-new keywords are almost certainly a programmer error.
- 主要语言
- Python
- 星标
- 5k
- 派生
- 671
- 平均合并
- 1 天 1 小时
- 30 天内合并 PR
- 10
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
python-jsonschema/jsonschema 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 78/100
python-jsonschema/jsonschema#1538 ·
-
Needs Test Upstream
难度 2/5 1-3 小时 新手友好度 78/100
python-jsonschema/jsonschema#1511 · 1 条评论 ·
-
难度 3/5 1-2 天 新手友好度 68/100
python-jsonschema/jsonschema#1558 · 2 条评论 ·
-
难度 4/5 3-5 天 新手友好度 45/100
python-jsonschema/jsonschema#1547 ·
-
难度 4/5 3-5 天 新手友好度 45/100
python-jsonschema/jsonschema#1536 · 1 条评论 ·
查看 python-jsonschema/jsonschema 的全部 Issue
相似的 Issue
-
agent-ready documentation needs-triage
难度 1/5 1-3 小时 新手友好度 88/100
-
documentation
难度 1/5 1 小时以内 新手友好度 91/100
-
workflow-status page template still says reusable workflows are "triggered only by workflow_call:" 未关闭
难度 1/5 1 小时以内 新手友好度 92/100
-
instance instance add
难度 1/5 1 小时以内 新手友好度 72/100
searxng/searx-instances#939 · 1 条评论 ·
-
area-deployment area-integrations triage:bot-seen
难度 2/5 半天 新手友好度 86/100