Support validation of Response without providing Request
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 5/5
- Tiempo estimado
- Más de una semana
- Aptitud para principiantes
- 25/100
- Tipo de issue
- Nueva funcionalidad
- Claridad
- Bastante claro
- Estado de actividad
- Estancado
- Stack tecnológico
- python
- Área
- api, backend-api-design
Línea de trabajo
Start with ResponseValidator in openapi_core.validation.response.validators and read the response-validation examples, then compare the validator code with the refactoring mentioned on the master branch. The work is complete when the documented validation flow can handle a response without the caller supplying a request, with its operation and method requirements defined and tested.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Hi,
I was planning on using the (Django REST Framework) Response validation in some unit tests. These unit tests are performing different actions on the REST API and validate the result. I would like to validate the response against the schema as well.
The problem is, all the django unit tests are based on having a self.client that is called to performing actions using response = self.client.post()..., response = self.client.get(...), etc.
So I don't have access to the request that was sent, so I can't use the pattern provided in the examples:
from openapi_core.validation.response.validators import ResponseValidator
validator = ResponseValidator(spec)
result = validator.validate(request, response)
# raise errors if response invalid
result.raise_for_errors()
# get list of errors
errors = result.errors
I went through the validator code and from what I can see now the request object is mainly used to determine which operation & method was executed. I also see there's some refactoring going on on the master branch.
Is there any way to validate the response, without providing the request object?
I tried to make a "mock" request object, but I don't know enough about the (Django) request internals yet to know what attributes and values to set.
I am also interested to know how others are using the validation. Are you using it server site as some (Django) middleware that checks requests/responses?
- 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
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
use-agent-os/agent-os#3314 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
BasedHardware/omi#15662 · 1 comentario ·
-
documentation help wanted
Dificultad 2/5 1-3 horas Aptitud para principiantes 90/100
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
AiursoftWeb/AnduinOS-2#19 ·