$dynamicRef doesn't find $dynamicAnchor overrides in root schemas without $id
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 55/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 静か
- 技術スタック
- python
調査の方向性
reproducer 内の Draft202012Validator のセットアップと Registry/Resource の登録から始め、次に $id のないルートスキーマが $ref を通じてどのように解決され、$dynamicRef がどのように自身の anchor を見つけるかを追跡します。iter_errors の失敗を再現し、合成 $id を追加せずにルートの $defs override が尊重されれば issue は完了とします。
索引モデルが issue の本文から書いたものです。
説明
$dynamicRef doesn't find $dynamicAnchor overrides in root schemas without $id
When a root schema has no $id and uses $ref to pull in a template containing $dynamicRef, the $dynamicRef ignores any $dynamicAnchor overrides defined in the root schema's $defs. It falls back to the template's own $dynamicAnchor instead.
Minimal reproducer
from jsonschema import Draft202012Validator
from referencing import Registry, Resource
from referencing.jsonschema import DRAFT202012
template = {
"$id": "https://example.com/PaginatedTemplate",
"$defs": {"itemType": {"$dynamicAnchor": "itemType", "not": {}}},
"type": "object",
"required": ["items"],
"properties": {"items": {"type": "array", "items": {"$dynamicRef": "#itemType"}}}
}
schema = {
"$defs": {"itemType": {"$dynamicAnchor": "itemType", "type": "string"}},
"$ref": "https://example.com/PaginatedTemplate"
}
registry = Registry().with_resource(
"https://example.com/PaginatedTemplate",
Resource.from_contents(template, default_specification=DRAFT202012)
)
# Should pass — "hello" matches the override (type: string)
# Actually fails — $dynamicRef resolves to the template's not: {} instead
v = Draft202012Validator(schema, registry=registry)
assert not list(v.iter_errors({"items": ["hello"]})) # fails
Adding $id to the root schema makes it work:
schema["$id"] = "https://example.com/Bound"
# ... then register and validate — passes
Workaround
Add a synthetic $id to the root schema before creating the validator.
- 主要言語
- Python
- スター
- 5k
- フォーク
- 694
- 平均マージ
- 1日 20時間
- マージ済み PR(30日)
- 6
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
python-jsonschema/jsonschema のほかの issue
-
Iterator error contexts lose parent links and absolute paths再び着手できるかも @DawnofGenX が 7 日前に担当しましたが、オープン中のプルリクエストはありません。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
python-jsonschema/jsonschema#1584 · コメント 3 件 ·
-
regex format checker crashes with RecursionError on deeply nested patterns対応中かも @DawnofGenX が 7 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
python-jsonschema/jsonschema#1538 · コメント 1 件 ·
-
is_duration raises an uncaught decimal.Overflow on a duration with a large exponent再び着手できるかも このイシューのプルリクエストはマージされずにクローズされました。 オープンNeeds Test Upstream
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
python-jsonschema/jsonschema#1511 · コメント 1 件 ·
-
regex format checker crashes with ValueError on conflicting inline flags対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープン
難易度 3/5 1〜2日 初心者へのやさしさ 68/100
python-jsonschema/jsonschema#1558 · コメント 2 件 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 45/100
python-jsonschema/jsonschema#1547 ·
python-jsonschema/jsonschema の issue をすべて見る
似ている issue
-
bug
難易度 1/5 1時間未満 初心者へのやさしさ 88/100
openwisp/openwisp-utils#777 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 63/100
google-research/weatherbenchX#310 ·
メンテナーはふだん 3 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
huggingface/peft#3955 ·
メンテナーはふだん 1 日以内に返信
-
author-page correction
難易度 2/5 1〜3時間 初心者へのやさしさ 60/100
acl-org/acl-anthology#10313 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
AOSSIE-Org/Gitcord-GithubDiscordBot#147 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信