fix: swagger docs ref_name conflicts (#36189)
* fix: swagger docs ref_name conflicts * fix: swagger auto doc errors * chore: bumps openedx-learning==0.18.2 --------- Co-authored-by: Jillian Vogel <jill@opencraft.com>
This commit is contained in:
@@ -23,6 +23,7 @@ class CourseRunViewSet(viewsets.GenericViewSet): # lint-amnesty, pylint: disabl
|
||||
lookup_value_regex = settings.COURSE_KEY_REGEX
|
||||
permission_classes = (permissions.IsAdminUser,)
|
||||
serializer_class = CourseRunSerializer
|
||||
queryset = []
|
||||
|
||||
def get_object(self):
|
||||
lookup_url_kwarg = self.lookup_url_kwarg or self.lookup_field
|
||||
|
||||
@@ -106,7 +106,7 @@ class CourseImportView(CourseImportExportViewMixin, GenericAPIView):
|
||||
# TODO: ARCH-91
|
||||
# This view is excluded from Swagger doc generation because it
|
||||
# does not specify a serializer class.
|
||||
exclude_from_schema = True
|
||||
swagger_schema = None
|
||||
|
||||
@course_author_access_required
|
||||
def post(self, request, course_key):
|
||||
|
||||
@@ -77,6 +77,11 @@ class CourseQualityView(DeveloperErrorViewMixin, GenericAPIView):
|
||||
* mode
|
||||
|
||||
"""
|
||||
# TODO: ARCH-91
|
||||
# This view is excluded from Swagger doc generation because it
|
||||
# does not specify a serializer class.
|
||||
swagger_schema = None
|
||||
|
||||
@course_author_access_required
|
||||
def get(self, request, course_key):
|
||||
"""
|
||||
|
||||
@@ -65,6 +65,11 @@ class CourseValidationView(DeveloperErrorViewMixin, GenericAPIView):
|
||||
* has_proctoring_escalation_email - whether the course has a proctoring escalation email
|
||||
|
||||
"""
|
||||
# TODO: ARCH-91
|
||||
# This view is excluded from Swagger doc generation because it
|
||||
# does not specify a serializer class.
|
||||
swagger_schema = None
|
||||
|
||||
@course_author_access_required
|
||||
def get(self, request, course_key):
|
||||
"""
|
||||
|
||||
@@ -14,7 +14,13 @@ class GradersSerializer(serializers.Serializer):
|
||||
weight = serializers.IntegerField()
|
||||
id = serializers.IntegerField()
|
||||
|
||||
class Meta:
|
||||
ref_name = "authoring_grading.Graders.v0"
|
||||
|
||||
|
||||
class CourseGradingModelSerializer(serializers.Serializer):
|
||||
""" Serializer for course grading model data """
|
||||
graders = GradersSerializer(many=True, allow_null=True, allow_empty=True)
|
||||
|
||||
class Meta:
|
||||
ref_name = "authoring_grading.CourseGrading.v0"
|
||||
|
||||
@@ -63,7 +63,7 @@ urlpatterns = [
|
||||
authoring_videos.VideoEncodingsDownloadView.as_view(), name='cms_api_videos_encodings'
|
||||
),
|
||||
re_path(
|
||||
fr'grading/{settings.COURSE_ID_PATTERN}',
|
||||
fr'grading/{settings.COURSE_ID_PATTERN}$',
|
||||
AuthoringGradingView.as_view(), name='cms_api_update_grading'
|
||||
),
|
||||
path(
|
||||
|
||||
@@ -128,6 +128,11 @@ class VideoEncodingsDownloadView(DeveloperErrorViewMixin, RetrieveAPIView):
|
||||
course_key: required argument, needed to authorize course authors and identify relevant videos.
|
||||
"""
|
||||
|
||||
# TODO: ARCH-91
|
||||
# This view is excluded from Swagger doc generation because it
|
||||
# does not specify a serializer class.
|
||||
swagger_schema = None
|
||||
|
||||
def dispatch(self, request, *args, **kwargs):
|
||||
# TODO: probably want to refactor this to a decorator.
|
||||
"""
|
||||
@@ -151,6 +156,11 @@ class VideoFeaturesView(DeveloperErrorViewMixin, RetrieveAPIView):
|
||||
public rest API endpoint providing a list of enabled video features.
|
||||
"""
|
||||
|
||||
# TODO: ARCH-91
|
||||
# This view is excluded from Swagger doc generation because it
|
||||
# does not specify a serializer class.
|
||||
swagger_schema = None
|
||||
|
||||
def dispatch(self, request, *args, **kwargs):
|
||||
# TODO: probably want to refactor this to a decorator.
|
||||
"""
|
||||
|
||||
@@ -168,7 +168,7 @@ urlpatterns = oauth2_urlpatterns + [
|
||||
contentstore_views.textbooks_detail_handler, name='textbooks_detail_handler'),
|
||||
re_path(fr'^videos/{settings.COURSE_KEY_PATTERN}(?:/(?P<edx_video_id>[-\w]+))?$',
|
||||
contentstore_views.videos_handler, name='videos_handler'),
|
||||
re_path(fr'^generate_video_upload_link/{settings.COURSE_KEY_PATTERN}',
|
||||
re_path(fr'^generate_video_upload_link/{settings.COURSE_KEY_PATTERN}$',
|
||||
contentstore_views.generate_video_upload_link_handler, name='generate_video_upload_link'),
|
||||
re_path(fr'^video_images/{settings.COURSE_KEY_PATTERN}(?:/(?P<edx_video_id>[-\w]+))?$',
|
||||
contentstore_views.video_images_handler, name='video_images_handler'),
|
||||
|
||||
@@ -81,6 +81,7 @@ from django.utils.translation import gettext as _
|
||||
from django.views.decorators.clickjacking import xframe_options_exempt
|
||||
from django.views.decorators.csrf import csrf_exempt
|
||||
from django.views.generic.base import TemplateResponseMixin, View
|
||||
from drf_yasg.utils import swagger_auto_schema
|
||||
from pylti1p3.contrib.django import DjangoCacheDataStorage, DjangoDbToolConf, DjangoMessageLaunch, DjangoOIDCLogin
|
||||
from pylti1p3.exception import LtiException, OIDCException
|
||||
|
||||
@@ -201,8 +202,10 @@ class LibraryRootView(GenericAPIView):
|
||||
"""
|
||||
Views to list, search for, and create content libraries.
|
||||
"""
|
||||
serializer_class = ContentLibraryMetadataSerializer
|
||||
|
||||
@apidocs.schema(
|
||||
responses={200: ContentLibraryMetadataSerializer(many=True)},
|
||||
parameters=[
|
||||
*LibraryApiPaginationDocs.apidoc_params,
|
||||
apidocs.query_parameter(
|
||||
@@ -530,7 +533,13 @@ class LibraryPasteClipboardView(GenericAPIView):
|
||||
"""
|
||||
Paste content of clipboard into Library.
|
||||
"""
|
||||
serializer_class = LibraryXBlockMetadataSerializer
|
||||
|
||||
@convert_exceptions
|
||||
@swagger_auto_schema(
|
||||
request_body=LibraryPasteClipboardSerializer,
|
||||
responses={200: LibraryXBlockMetadataSerializer}
|
||||
)
|
||||
def post(self, request, lib_key_str):
|
||||
"""
|
||||
Import the contents of the user's clipboard and paste them into the Library
|
||||
@@ -558,6 +567,7 @@ class LibraryBlocksView(GenericAPIView):
|
||||
"""
|
||||
Views to work with XBlocks in a specific content library.
|
||||
"""
|
||||
serializer_class = LibraryXBlockMetadataSerializer
|
||||
|
||||
@apidocs.schema(
|
||||
parameters=[
|
||||
@@ -595,6 +605,10 @@ class LibraryBlocksView(GenericAPIView):
|
||||
return self.get_paginated_response(serializer.data)
|
||||
|
||||
@convert_exceptions
|
||||
@swagger_auto_schema(
|
||||
request_body=LibraryXBlockCreationSerializer,
|
||||
responses={200: LibraryXBlockMetadataSerializer}
|
||||
)
|
||||
def post(self, request, lib_key_str):
|
||||
"""
|
||||
Add a new XBlock to this content library
|
||||
@@ -870,6 +884,9 @@ class LibraryImportTaskViewSet(GenericViewSet):
|
||||
Import blocks from Courseware through modulestore.
|
||||
"""
|
||||
|
||||
queryset = [] # type: ignore[assignment]
|
||||
serializer_class = ContentLibraryBlockImportTaskSerializer
|
||||
|
||||
@convert_exceptions
|
||||
def list(self, request, lib_key_str):
|
||||
"""
|
||||
@@ -889,6 +906,10 @@ class LibraryImportTaskViewSet(GenericViewSet):
|
||||
)
|
||||
|
||||
@convert_exceptions
|
||||
@swagger_auto_schema(
|
||||
request_body=ContentLibraryBlockImportTaskCreateSerializer,
|
||||
responses={200: ContentLibraryBlockImportTaskSerializer}
|
||||
)
|
||||
def create(self, request, lib_key_str):
|
||||
"""
|
||||
Create and queue an import tasks for this library.
|
||||
|
||||
@@ -131,7 +131,7 @@ optimizely-sdk<5.0
|
||||
# Date: 2023-09-18
|
||||
# pinning this version to avoid updates while the library is being developed
|
||||
# Issue for unpinning: https://github.com/openedx/edx-platform/issues/35269
|
||||
openedx-learning==0.18.1
|
||||
openedx-learning==0.18.2
|
||||
|
||||
# Date: 2023-11-29
|
||||
# Open AI version 1.0.0 dropped support for openai.ChatCompletion which is currently in use in enterprise.
|
||||
|
||||
@@ -827,7 +827,7 @@ openedx-filters==1.12.0
|
||||
# ora2
|
||||
openedx-forum==0.1.6
|
||||
# via -r requirements/edx/kernel.in
|
||||
openedx-learning==0.18.1
|
||||
openedx-learning==0.18.2
|
||||
# via
|
||||
# -c requirements/edx/../constraints.txt
|
||||
# -r requirements/edx/kernel.in
|
||||
|
||||
@@ -1381,7 +1381,7 @@ openedx-forum==0.1.6
|
||||
# via
|
||||
# -r requirements/edx/doc.txt
|
||||
# -r requirements/edx/testing.txt
|
||||
openedx-learning==0.18.1
|
||||
openedx-learning==0.18.2
|
||||
# via
|
||||
# -c requirements/edx/../constraints.txt
|
||||
# -r requirements/edx/doc.txt
|
||||
|
||||
@@ -1000,7 +1000,7 @@ openedx-filters==1.12.0
|
||||
# ora2
|
||||
openedx-forum==0.1.6
|
||||
# via -r requirements/edx/base.txt
|
||||
openedx-learning==0.18.1
|
||||
openedx-learning==0.18.2
|
||||
# via
|
||||
# -c requirements/edx/../constraints.txt
|
||||
# -r requirements/edx/base.txt
|
||||
|
||||
@@ -1048,7 +1048,7 @@ openedx-filters==1.12.0
|
||||
# ora2
|
||||
openedx-forum==0.1.6
|
||||
# via -r requirements/edx/base.txt
|
||||
openedx-learning==0.18.1
|
||||
openedx-learning==0.18.2
|
||||
# via
|
||||
# -c requirements/edx/../constraints.txt
|
||||
# -r requirements/edx/base.txt
|
||||
|
||||
Reference in New Issue
Block a user