Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Idea: warn on unsupported keywords (e.g. "const" in draft-04 schemas)

未关闭
#778 1 条评论 1 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
38/100
Issue 类型
功能
描述清晰度
基本清楚
活跃度
停滞
技术栈
python

调研方向

从 validate 示例和 DraftXValidator 实现开始。检查每个 draft 如何处理 schema 关键字,然后为列出的较新或已重命名关键字定义警告行为,同时保留对未知 format 值的现有处理方式;在受影响的 draft 验证器中验证这些警告。

由索引模型根据 Issue 内容生成。

描述

Dialects v2 Enhancement

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, and const (added in draft06)
  • <= draft06, warn on if, then, and else (added in draft07)
  • In draft07, the media keyword was replaced with contentMediaType and contentEncoding, 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

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

python-jsonschema/jsonschema 的其他 Issue

查看 python-jsonschema/jsonschema 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。