Validators shortcuts fix

This commit is contained in:
Artur Maciag 2020-02-18 11:57:15 +00:00
parent 912f0afc7a
commit 3ca531a485
2 changed files with 9 additions and 6 deletions

View file

@ -55,7 +55,7 @@ Now you can use it to validate requests
.. code-block:: python
from openapi_core.shortcuts import RequestValidator
from openapi_core.validation.request.validators import RequestValidator
validator = RequestValidator(spec)
result = validator.validate(request)
@ -90,7 +90,7 @@ You can also validate responses
.. code-block:: python
from openapi_core.shortcuts import ResponseValidator
from openapi_core.validation.response.validators import ResponseValidator
validator = ResponseValidator(spec)
result = validator.validate(request, response)
@ -188,7 +188,7 @@ For Django 2.2 you can use DjangoOpenAPIRequest a Django request factory:
.. code-block:: python
from openapi_core.shortcuts import RequestValidator
from openapi_core.validation.request.validators import RequestValidator
from openapi_core.contrib.django import DjangoOpenAPIRequest
openapi_request = DjangoOpenAPIRequest(django_request)
@ -199,7 +199,7 @@ You can use DjangoOpenAPIResponse as a Django response factory:
.. code-block:: python
from openapi_core.shortcuts import ResponseValidator
from openapi_core.validation.response.validators import ResponseValidator
from openapi_core.contrib.django import DjangoOpenAPIResponse
openapi_response = DjangoOpenAPIResponse(django_response)
@ -268,7 +268,7 @@ You can use FlaskOpenAPIRequest a Flask/Werkzeug request factory:
.. code-block:: python
from openapi_core.shortcuts import RequestValidator
from openapi_core.validation.request.validators import RequestValidator
from openapi_core.contrib.flask import FlaskOpenAPIRequest
openapi_request = FlaskOpenAPIRequest(flask_request)
@ -279,7 +279,7 @@ You can use FlaskOpenAPIResponse as a Flask/Werkzeug response factory:
.. code-block:: python
from openapi_core.shortcuts import ResponseValidator
from openapi_core.validation.response.validators import ResponseValidator
from openapi_core.contrib.flask import FlaskOpenAPIResponse
openapi_response = FlaskOpenAPIResponse(flask_response)

View file

@ -5,10 +5,13 @@ from openapi_core.validation.request.shortcuts import (
spec_validate_body as validate_body,
spec_validate_parameters as validate_parameters,
)
from openapi_core.validation.request.validators import RequestValidator
from openapi_core.validation.response.shortcuts import (
spec_validate_data as validate_data
)
from openapi_core.validation.response.validators import ResponseValidator
__all__ = [
'create_spec', 'validate_body', 'validate_parameters', 'validate_data',
'RequestValidator', 'ResponseValidator',
]