Skip to content

Commit c3e4c1b

Browse files
committed
fixup! fixup! Add django decorator
1 parent 6b45fb0 commit c3e4c1b

File tree

2 files changed

+5
-4
lines changed
  • openapi_core/contrib/django
  • tests/integration/contrib/django/data/v3.0/djangoproject/status

2 files changed

+5
-4
lines changed

openapi_core/contrib/django/decorators.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,12 @@
1313
DjangoOpenAPIValidRequestHandler,
1414
)
1515
from openapi_core.contrib.django.integrations import DjangoIntegration
16+
from openapi_core.contrib.django.providers import get_default_openapi_instance
1617
from openapi_core.contrib.django.requests import DjangoOpenAPIRequest
1718
from openapi_core.contrib.django.responses import DjangoOpenAPIResponse
1819

1920

20-
class DjangoOpenAPIDecorator(DjangoIntegration):
21+
class DjangoOpenAPIViewDecorator(DjangoIntegration):
2122
valid_request_handler_cls = DjangoOpenAPIValidRequestHandler
2223
errors_handler_cls: Type[DjangoOpenAPIErrorsHandler] = (
2324
DjangoOpenAPIErrorsHandler
@@ -50,7 +51,7 @@ def __call__(self, view_func):
5051
Thanks to this method, the class acts as a decorator.
5152
Example usage:
5253
53-
@DjangoOpenAPIDecorator()
54+
@DjangoOpenAPIViewDecorator()
5455
def my_view(request): ...
5556
5657
"""

tests/integration/contrib/django/data/v3.0/djangoproject/status/views.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
from django.http import HttpResponse
44
from jsonschema_path import SchemaPath
55

6-
from openapi_core.contrib.django.decorators import DjangoOpenAPIDecorator
6+
from openapi_core.contrib.django.decorators import DjangoOpenAPIViewDecorator
77

8-
check_minimal_spec = DjangoOpenAPIDecorator.from_spec(
8+
check_minimal_spec = DjangoOpenAPIViewDecorator.from_spec(
99
SchemaPath.from_file_path(
1010
Path("tests/integration/data/v3.0/minimal_with_servers.yaml")
1111
)

0 commit comments

Comments
 (0)