mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-08-02 11:30:12 +03:00
Note dependency on uritemplate.
This commit is contained in:
parent
4c173193d6
commit
416ca3fcca
|
@ -511,6 +511,8 @@ class OpenAPIAutoSchema(ViewInspector):
|
|||
"""
|
||||
Return a list of parameters from templated path variables.
|
||||
"""
|
||||
assert uritemplate, '`uritemplate` must be installed for OpenAPI schema support.'
|
||||
|
||||
model = getattr(getattr(self.view, 'queryset', None), 'model', None)
|
||||
parameters = []
|
||||
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
import unittest
|
||||
|
||||
from django.conf.urls import url
|
||||
from django.test import RequestFactory, TestCase, override_settings
|
||||
|
||||
from rest_framework.compat import uritemplate
|
||||
from rest_framework.request import Request
|
||||
from rest_framework.schemas.generators import OpenAPISchemaGenerator
|
||||
from rest_framework.schemas.inspectors import OpenAPIAutoSchema
|
||||
|
@ -20,6 +23,7 @@ def create_view(view_cls, method, request):
|
|||
return view
|
||||
|
||||
|
||||
@unittest.skipUnless(uritemplate, 'uritemplate is not installed')
|
||||
class TestOperationIntrospection(TestCase):
|
||||
|
||||
def test_path_without_parameters(self):
|
||||
|
@ -61,6 +65,7 @@ class TestOperationIntrospection(TestCase):
|
|||
}
|
||||
|
||||
|
||||
@unittest.skipUnless(uritemplate, 'uritemplate is not installed')
|
||||
@override_settings(REST_FRAMEWORK={'DEFAULT_SCHEMA_CLASS': 'rest_framework.schemas.inspectors.OpenAPIAutoSchema'})
|
||||
class TestGenerator(TestCase):
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user