$dynamicRef doesn't find $dynamicAnchor overrides in root schemas without $id
Personne n'a encore pris cette issue.
Évaluation
- Difficulté
- 4/5
- Temps estimé
- 3-5 jours
- Accessibilité débutants
- 55/100
- Type d'issue
- Bug
- Clarté
- Clairement spécifiée
- Activité
- Calme
- Stack technique
- python
- Domaine
- backend-api-design
Piste de recherche
Commencez par la configuration de Draft202012Validator et l’enregistrement de Registry/Resource dans le reproducer, puis suivez la manière dont le schéma racine sans $id est résolu via $ref et dont $dynamicRef trouve son anchor. Reproduisez l’échec de iter_errors, et considérez l’issue comme terminée lorsque l’override de $defs de la racine est respecté sans ajouter de $id synthétique.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
$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.
- Langage dominant
- Python
- Étoiles
- 5k
- Forks
- 694
- Merge moyen
- 1 j 20 h
- PR mergées (30 j)
- 6
Préparer son environnement
- Aucun Dockerfile ni fichier Docker Compose
- Aucun modèle de pull request
- Lire le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de python-jsonschema/jsonschema
-
Iterator error contexts lose parent links and absolute pathsPeut-être à nouveau libre @DawnofGenX l’a pris il y a 8 jours, et aucune pull request n’est ouverte. Ouverte
Difficulté 2/5 1-3 heures Accessibilité débutants 76/100
python-jsonschema/jsonschema#1584 · 3 commentaires ·
-
regex format checker crashes with RecursionError on deeply nested patternsPeut-être pris @DawnofGenX l’a pris il y a 8 jours. Ouverte
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
python-jsonschema/jsonschema#1538 · 1 commentaire ·
-
is_duration raises an uncaught decimal.Overflow on a duration with a large exponentPeut-être à nouveau libre Une pull request pour cette issue a été fermée sans être fusionnée. OuverteNeeds Test Upstream
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
python-jsonschema/jsonschema#1511 · 1 commentaire ·
-
regex format checker crashes with ValueError on conflicting inline flagsPeut-être pris Une pull request liée à cette issue est ouverte ou déjà fusionnée. Ouverte
Difficulté 3/5 1-2 jours Accessibilité débutants 68/100
python-jsonschema/jsonschema#1558 · 2 commentaires ·
-
Difficulté 4/5 3-5 jours Accessibilité débutants 45/100
python-jsonschema/jsonschema#1547 ·
Toutes les issues de python-jsonschema/jsonschema
Issues similaires
-
Broken links in the docsOuverte
Difficulté 1/5 Moins d'une heure Accessibilité débutants 78/100
uniswap-python/uniswap-python#487 ·
-
[Bug]: agent_final_response still returns the abandoned branch's answer after navigate moves HEAD backPeut-être pris @enyst l’a pris aujourd’hui. Ouvertebug priority:low ready-for-dev
Difficulté 2/5 1-3 heures Accessibilité débutants 72/100
OpenHands/software-agent-sdk#5822 ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 1/5 Moins d'une heure Accessibilité débutants 72/100
-
area: server enhancement good first issue
Difficulté 2/5 1-3 heures Accessibilité débutants 82/100
scs0209/laya-guard#52 ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 82/100
Les mainteneurs répondent en général sous 2 jours