Canonicalise `oneOf` sub-schemas to exclude shared types
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 35/100
調査の方向性
Start with the not sub-schema handling and the referenced test case in tests/test_from_schema.py; the corpus example is in tests/corpus-suite-schemas.json. Compare canonicalising oneOf branches to include type: object with lowering oneOf to anyOf using not. Done means the supplied case generates values without excessive filtering and the tests catch plausible semantic mistakes.
索引モデルが issue の本文から書いたものです。
説明
Consider the schema {"oneOf": [{"required": ["foo"]}, {"required": ["bar"]}]}
What values could match this? Because the two sub-schemas only constrain objects, all values of any other type will be valid against both sub-schemas... and therefore invalid against the oneOf schema.
This tends to result in a lot of filtering, so we have a workaround in our tests for this test case.
Obviously it would be nicer to support such schemas properly, by canonicalising them to include type: object (i.e. exclude other types) and therefore translate them to a Hypothesis strategy which doesn't have to filter out so much.
The semantics are a bit too tricky for me to tag this good first issue, though the tests will catch any plausible mistakes you could make. We have some prior art in the handling of "not" sub-schemas, which might provide a good starting point; you might even move shared logic to a new helper function.
Alternatively, 'lowering' oneOf: [a, b, c] to anyOf: [{**a, not: {anyOf: [b, c]}}, ...] would automatically share any improvements to not-logic, which would be nice. Just a question of balancing that against the less elegant canonical form.
- 主要言語
- Python
- スター
- 281
- フォーク
- 35
- PR マージ指標
- 30日以内にマージされた PR はありません
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
python-jsonschema/hypothesis-jsonschema のほかの issue
-
Missing test files in Pypi release対応中かも @blouirts123 が 49 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 35/100
-
Shouldn't PKG-INFO Homepage point to https://github.com/python-jsonschema/hypothesis-jsonschema ?オープン
難易度 1/5 1時間未満 初心者へのやさしさ 58/100
python-jsonschema/hypothesis-jsonschema#114 · コメント 1 件 ·
-
難易度 1/5 1時間未満 初心者へのやさしさ 55/100
python-jsonschema/hypothesis-jsonschema#113 · リアクション 1 件 ·
-
難易度 5/5 1週間以上 初心者へのやさしさ 30/100
-
難易度 5/5 1週間以上 初心者へのやさしさ 15/100
python-jsonschema/hypothesis-jsonschema#104 · リアクション 3 件 ·
python-jsonschema/hypothesis-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 日以内に返信