Rename swagger_auto_schema decorator
This commit is contained in:
@@ -20,7 +20,7 @@ from openedx.core.djangoapps.certificates.api import certificates_viewable_for_c
|
||||
from openedx.core.djangoapps.content.course_overviews.models import CourseOverview
|
||||
from openedx.core.djangoapps.user_api.accounts.api import visible_fields
|
||||
from openedx.core.lib.api.authentication import OAuth2AuthenticationAllowInactiveUser
|
||||
from openedx.core.openapi import swagger_auto_schema, openapi
|
||||
from openedx.core.openapi import document_api_view, openapi
|
||||
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
@@ -154,7 +154,7 @@ class CertificatesListView(GenericAPIView):
|
||||
|
||||
required_scopes = ['certificates:read']
|
||||
|
||||
@swagger_auto_schema(manual_parameters=[
|
||||
@document_api_view(manual_parameters=[
|
||||
openapi.Parameter(
|
||||
'username',
|
||||
openapi.IN_PATH,
|
||||
|
||||
@@ -26,7 +26,7 @@ from rest_framework_oauth.authentication import OAuth2Authentication
|
||||
from openedx.core.djangoapps.bookmarks.api import BookmarksLimitReachedError
|
||||
from openedx.core.lib.api.permissions import IsUserInUrl
|
||||
from openedx.core.lib.url_utils import unquote_slashes
|
||||
from openedx.core.openapi import swagger_auto_schema, openapi
|
||||
from openedx.core.openapi import document_api_view, openapi
|
||||
from xmodule.modulestore.exceptions import ItemNotFoundError
|
||||
|
||||
from . import DEFAULT_FIELDS, OPTIONAL_FIELDS, api
|
||||
@@ -104,7 +104,7 @@ class BookmarksListView(ListCreateAPIView, BookmarksViewMixin):
|
||||
permission_classes = (permissions.IsAuthenticated,)
|
||||
serializer_class = BookmarkSerializer
|
||||
|
||||
@swagger_auto_schema(
|
||||
@document_api_view(
|
||||
manual_parameters=[
|
||||
openapi.Parameter(
|
||||
'course_id',
|
||||
@@ -204,7 +204,7 @@ class BookmarksListView(ListCreateAPIView, BookmarksViewMixin):
|
||||
|
||||
return page
|
||||
|
||||
@swagger_auto_schema
|
||||
@document_api_view
|
||||
def post(self, request, *unused_args, **unused_kwargs):
|
||||
"""Create a new bookmark for a user.
|
||||
|
||||
@@ -313,7 +313,7 @@ class BookmarksDetailView(APIView, BookmarksViewMixin):
|
||||
log.error(error_message)
|
||||
return self.error_response(error_message, error_status=status.HTTP_404_NOT_FOUND)
|
||||
|
||||
@swagger_auto_schema(
|
||||
@document_api_view(
|
||||
operation_summary="Get a specific bookmark for a user.",
|
||||
operation_description=u"""
|
||||
# Example Requests
|
||||
|
||||
@@ -44,7 +44,7 @@ def dedent(text):
|
||||
return textwrap.dedent(text)
|
||||
|
||||
|
||||
def swagger_auto_schema(*args, **kwargs):
|
||||
def document_api_view(*args, **kwargs):
|
||||
"""
|
||||
Decorator for documenting an OpenAPI endpoint.
|
||||
|
||||
@@ -58,7 +58,7 @@ def swagger_auto_schema(*args, **kwargs):
|
||||
if args:
|
||||
if callable(args[0]):
|
||||
# decorator may be used with no argument
|
||||
return swagger_auto_schema(*args[1:], **kwargs)(args[0])
|
||||
return document_api_view(*args[1:], **kwargs)(args[0])
|
||||
raise ValueError("Unsupported positional arguments")
|
||||
|
||||
for param in kwargs.get('manual_parameters', ()):
|
||||
|
||||
Reference in New Issue
Block a user