Mis-canonicalisation of `const` in draft04 schemas (not a keyword until draft06)

オープン
#76 コメント 2 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
30/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
python
領域
backend, testing

調査の方向性

Start by reading the schema canonicalisation code and its tests to find how draft-specific keywords are handled; the issue does not name their paths. Reproduce the example with a draft-04 schema and check how const is processed. Done means canonicalisation follows draft-04 semantics and the result matches the stated enum: [None] expectation.

索引モデルが issue の本文から書いたものです。

説明

The const keyword was added in draft-06, and therefore has no effect whatsoever in draft-04 schemas. While authors probably intended to constrain the value somewhat, we still have to follow the spec!

{
    "$schema": "http://json-schema.org/draft-04/schema#",
    "oneOf": [{"type": "boolean"}, {"const": None}],
    "type": ["boolean", "null"],
}
# Should canonicalise 
#    {"const": None} -> {}
#    "oneOf": [{"type": "boolean"}, {}] -> "not": {"type": "boolean"}
# and ultimately to
{"enum": [None]}

See also https://github.com/Julian/jsonschema/issues/778; longer term this is another argument for my do-it-right schema processing redesign...

主要言語
Python
スター
281
フォーク
35
PR マージ指標
30日以内にマージされた PR はありません

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

python-jsonschema/hypothesis-jsonschema のほかの issue

python-jsonschema/hypothesis-jsonschema の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。