Allow "required" list to have undefined properties
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 35/100
- Tipo di issue
- Bug
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Ferma
- Stack tecnologico
- openapi, python
- Ambito
- api, testing-qa
Direzione di ricerca
Start in openapi_spec_validator/validators.py around the require_properties argument and the linked validation block, then read tests/integration/test_validators.py around the existing case. Check the relevant OpenAPI and JSON Schema behavior before deciding the expected result; done means the validator and integration tests consistently accept or reject the undefined required properties case.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
I think requiring property names listed in required to be defined in properties is too strict. I also couldn't find this requirement in the JSON Schema or OpenAPI specs. JSON Schema validators and the Swagger Editor are fine with property names listed in required that are not defined in properties.
It makes sense to list required properties without defining them in properties when using allOf where one sub-schema requires some properties but does not specify them while another sub-schema only provides the specifications of the properties (possibly even without stating which ones are required and which ones aren't). This is especially useful when referencing and merging schema definitions or when expressing discriminated unions with some properties that are common to all union members.
I suggest to remove the following code block
and the require_properties argument:
I have seen the test case
but it also seems to be valid to express this schema like this:
{
'Credit': {
'type': 'object',
'properties': {
'clientId': {'type': 'string'},
}
},
'CreditCreate': {
'type': 'object',
'required': ['clientId'],
'allOf': [
{
'$ref': '#/components/schemas/Credit'
},
# possibly more schemas to merge ...
]
}
}
Or did I miss this rule somewhere in the spec?
- Lingua principale
- Python
- Stelle
- 409
- Fork
- 73
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Guida per i contributori
Apri 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-openapi/openapi-spec-validator
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 55/100
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 55/100
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 30/100
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 42/100
python-openapi/openapi-spec-validator#400 · 1 commento ·
-
kind/bug/confirmed
Difficoltà 5/5 Più di una settimana Idoneità per principianti 25/100
python-openapi/openapi-spec-validator#373 · 1 commento ·
Tutte le issue di python-openapi/openapi-spec-validator
Issue simili
-
货币战争手改优先级配置缺少列表元素类型校验(P3) Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
syfoud/Simulated_Scepter#172 ·
-
A cancelled tests run makes the coverage comment workflow fail and reports it as a red check on main Apertaarea: ci bug perceived difficulty: 3
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
Nitjsefnie-Harness-Commons/daedalus#921 · 1 commento ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 86/100
EleutherAI/lm-evaluation-harness#4207 ·
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 92/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
ClickHouse/clickhouse-connect#1057 ·