Canonicalise `oneOf` sub-schemas to exclude shared types
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 35/100
Direzione di ricerca
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.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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.
- Lingua principale
- Python
- Stelle
- 281
- Fork
- 35
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
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/hypothesis-jsonschema
-
Missing test files in Pypi releaseForse già presa @blouirts123 l’ha presa 49 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 35/100
-
Shouldn't PKG-INFO Homepage point to https://github.com/python-jsonschema/hypothesis-jsonschema ?Aperta
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 58/100
python-jsonschema/hypothesis-jsonschema#114 · 1 commento ·
-
Push release tags to github?Aperta
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 55/100
python-jsonschema/hypothesis-jsonschema#113 · 1 reazione ·
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 30/100
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 15/100
python-jsonschema/hypothesis-jsonschema#104 · 3 reazioni ·
Tutte le issue di python-jsonschema/hypothesis-jsonschema
Issue simili
-
Difficoltà 1/5 1-3 ore Idoneità per principianti 78/100
web-push-libs/pywebpush#216 · 1 commento ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
AgriciDaniel/claude-seo#572 ·
I maintainer di solito rispondono entro 5 giorni
-
area:print-dispatch
Difficoltà 2/5 1-3 ore Idoneità per principianti 92/100
I maintainer di solito rispondono entro 1 giorno
-
area: docs domain: technical-writing good first issue type: documentation
Difficoltà 2/5 1-3 ore Idoneità per principianti 80/100
Deepak3699/Ai_Mentor#919 ·
I maintainer di solito rispondono entro 2 giorni
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno