Feature request: allow a reference registry to have a fixed base_uri when the schema does not set `"$id"`
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 45/100
- Tipo di issue
- Funzionalità
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Tranquilla
- Stack tecnologico
- python
- Ambito
- backend-api-design
Direzione di ricerca
Inizia tracciando Validator._resolver e reference_registry.resolver(base_uri=...), quindi esamina come Resource.id() e le interfacce di riferimento gestiscono gli schemi senza "$id". Confronta il comportamento descritto in check-jsonschema#640 e identifica i confini dell’API pubblica che richiederebbero una copertura. Il lavoro è completato quando è possibile impostare un URI di base esplicito senza mutare gli schemi di input né fare affidamento su attributi privati.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
I'm working on fixing python-jsonschema/check-jsonschema#640 , which is a bit of weirdness to do with local schemas and multiple relative $ref values.
Right now, check-jsonschema is doing some path joining logic to combine the file URI for the input schema with the $ref paths it sees, and it ends up playing out incorrectly when combined with referencing's inner resolver object. Second order ref retrieval does some path joining, which then joins improperly with the explicit base URI.
I found that the issue can be resolved by replacing the Validator._resolver with one that has a non-"" base URL:
if validator._resolver._base_uri == "" and retrieval_uri is not None:
validator._resolver = reference_registry.resolver(base_uri=retrieval_uri)
(where retrieval_uri is, in this case, the local file URI)
I don't see an obvious public-API way of doing this. The above is a workaround, and I'll probably do a version of it with some safeguard around potential jsonschema and referencing changes. I rejected my other options as being worse workarounds:
- modifying the input schema to set
"$id"-- although this has the right effect, it strikes me as incorrect (I'm not able to substantiate that with some case in which there's a bad outcome, but it's silently tweaking the user's data to make things work; feels weird IMO) - subclassing
Resourcefromreferencingto overrideid()... based onjsonschema's interfaces, I strongly suspect that this is not intended usage
What would work best is to have some public API way of explicitly setting the base URI for resolution. It probably needs support in referencing, but it also potentially needs to be exposed in jsonschema.
- Lingua principale
- Python
- Stelle
- 5k
- Fork
- 694
- Merge medio
- 1g 20h
- PR unite (30g)
- 6
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di python-jsonschema/jsonschema
-
Iterator error contexts lose parent links and absolute pathsForse già presa @DawnofGenX l’ha presa 6 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
python-jsonschema/jsonschema#1584 · 3 commenti ·
-
regex format checker crashes with RecursionError on deeply nested patternsForse già presa @DawnofGenX l’ha presa 6 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
python-jsonschema/jsonschema#1538 · 1 commento ·
-
is_duration raises an uncaught decimal.Overflow on a duration with a large exponentForse di nuovo libera Una pull request per questa issue è stata chiusa senza essere unita. ApertaNeeds Test Upstream
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
python-jsonschema/jsonschema#1511 · 1 commento ·
-
regex format checker crashes with ValueError on conflicting inline flagsForse già presa Una pull request collegata a questa issue è aperta o già unita. Aperta
Difficoltà 3/5 1-2 giorni Idoneità per principianti 68/100
python-jsonschema/jsonschema#1558 · 2 commenti ·
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 45/100
python-jsonschema/jsonschema#1536 · 1 commento ·
Tutte le issue di python-jsonschema/jsonschema
Issue simili
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 83/100
PedestrianDynamics/pyFDS-Evac#766 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 1/5 1-3 ore Idoneità per principianti 91/100
alchaincyf/nuwa-skill#86 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
I maintainer di solito rispondono entro 2 giorni
-
Docs Needs Triage
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 88/100
pandas-dev/pandas#71055 ·
I maintainer di solito rispondono entro 1 giorno
-
[Bug]: graphify reads files that git's global ignore file hidesForse già presa @smngvlkz l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
Graphify-Labs/graphify#4335 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno