Using required and allOf together
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 35/100
Línea de trabajo
Reproduce the schema using the request-validation path shown in openapi_core/validation/request/validators.py. Then trace validation through openapi_core/unmarshalling/schemas/unmarshallers.py and openapi_schema_validator/_validators.py, focusing on the required handling inside allOf. Done means the valid schema validates without the shown KeyError and still reports missing required properties correctly.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Hello,
We are using openapi-core to validate Django Requests.
When I use this syntax:
SaveRequest:
allOf:
- $ref: "#/definitions/Dog"
- required:
- breed
- name
I'm getting this error:
...
File "/Users/felix/Library/Caches/pypoetry/virtualenvs/button3d-iF01JEUe-py3.8/lib/python3.8/site-packages/openapi_core/validation/request/validators.py", line 204, in _get_body
body = self._unmarshal(media_type, casted)
File "/Users/felix/Library/Caches/pypoetry/virtualenvs/button3d-iF01JEUe-py3.8/lib/python3.8/site-packages/openapi_core/validation/request/validators.py", line 255, in _unmarshal
return super(RequestValidator, self)._unmarshal(
File "/Users/felix/Library/Caches/pypoetry/virtualenvs/button3d-iF01JEUe-py3.8/lib/python3.8/site-packages/openapi_core/validation/validators.py", line 66, in _unmarshal
return unmarshaller(value)
File "/Users/felix/Library/Caches/pypoetry/virtualenvs/button3d-iF01JEUe-py3.8/lib/python3.8/site-packages/openapi_core/unmarshalling/schemas/unmarshallers.py", line 49, in __call__
self.validate(value)
File "/Users/felix/Library/Caches/pypoetry/virtualenvs/button3d-iF01JEUe-py3.8/lib/python3.8/site-packages/openapi_core/unmarshalling/schemas/unmarshallers.py", line 61, in validate
errors = tuple(errors_iter)
File "/Users/felix/Library/Caches/pypoetry/virtualenvs/button3d-iF01JEUe-py3.8/lib/python3.8/site-packages/jsonschema/validators.py", line 328, in iter_errors
for error in errors:
File "/Users/felix/Library/Caches/pypoetry/virtualenvs/button3d-iF01JEUe-py3.8/lib/python3.8/site-packages/jsonschema/_validators.py", line 315, in allOf
for error in validator.descend(instance, subschema, schema_path=index):
File "/Users/felix/Library/Caches/pypoetry/virtualenvs/button3d-iF01JEUe-py3.8/lib/python3.8/site-packages/jsonschema/validators.py", line 344, in descend
for error in self.iter_errors(instance, schema):
File "/Users/felix/Library/Caches/pypoetry/virtualenvs/button3d-iF01JEUe-py3.8/lib/python3.8/site-packages/jsonschema/validators.py", line 328, in iter_errors
for error in errors:
File "/Users/felix/Library/Caches/pypoetry/virtualenvs/button3d-iF01JEUe-py3.8/lib/python3.8/site-packages/openapi_schema_validator/_validators.py", line 43, in required
prop_schema = schema['properties'][property]
According to this thread, it is a valid schema though:
https://github.com/OAI/OpenAPI-Specification/issues/1608
Also related issue:
https://github.com/p1c2u/openapi-core/issues/77
- Lenguaje dominante
- Python
- Estrellas
- 368
- Forks
- 140
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de python-openapi/openapi-core
-
kind/bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
python-openapi/openapi-core#1188 · 2 comentarios ·
-
kind/bug
Dificultad 3/5 1-2 días Aptitud para principiantes 68/100
python-openapi/openapi-core#1225 · 2 comentarios ·
-
kind/bug
Dificultad 3/5 1-2 días Aptitud para principiantes 76/100
python-openapi/openapi-core#1212 ·
-
[Bug]: Query parameter validation fails to match empty string when listed as a valid enum value Abiertokind/bug
Dificultad 3/5 1-2 días Aptitud para principiantes 68/100
python-openapi/openapi-core#1210 ·
-
kind/bug kind/bug/confirmed
Dificultad 3/5 1-2 días Aptitud para principiantes 58/100
python-openapi/openapi-core#1180 · 3 comentarios ·
Todos los issues de python-openapi/openapi-core
Issues similares
-
documentation help wanted
Dificultad 2/5 1-3 horas Aptitud para principiantes 90/100
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 90/100
simonw/sqlite-utils#872 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100