Skip to content
This repository has been archived by the owner on Mar 14, 2024. It is now read-only.

hokan-inc/drf_open_api_validator

Repository files navigation

DRF Open API Validator

Usage

Install django-open-api-validator with pip.

$ pip install drf-open-api-validator

Add django application drf_open_api_validator to INSTALLED_APPS in settings.py.

INSTALLED_APPS = [
    ...
    'drf_open_api_validator',
    ...
]

Add RequestValidatorMiddleware and ResponseValidatorMiddleware to MIDDLEWARE in settings.py.

MIDDLEWARE = [
    ...
    'drf_open_api_validator.middleware.DjangoOpenAPIRequestValidationMiddleware,
    ...
]

Configuration

settings.py value Type Default
OPENAPI_SPEC openapi_core.spec.paths.SpecPath False
OPENAPI_STRICT_PATH boolean False
OPENAPI_STRICT_REQUEST_SCHEMA boolean False
OPENAPI_STRICT_RESPONSE_SCHEMA boolean False

Testing

pytest

$ pytest

multi version

$ tox

Release

  • Bump version. Edit setup.cfg file.
  • Generate distribution files. python -m build.
  • Check distribution files. twine check dist/*.
    • You need to make sure there are no "errors" displayed on the console.
  • Upload distribution files. twine upload dist/*.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages