Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: replace rest_framework_swagger with drf_yasg #1502

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion credentials/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
"django_sites_extensions",
# TODO Set in EXTRA_APPS via configuration
"edx_credentials_themes",
"rest_framework_swagger",
"drf_yasg",
"hijack",
"xss_utils",
]
Expand Down
16 changes: 14 additions & 2 deletions credentials/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@
from django.urls import re_path
from django.utils.translation import gettext_lazy as _
from django.views.defaults import page_not_found
from rest_framework_swagger.views import get_swagger_view
from drf_yasg.views import get_schema_view
from drf_yasg import openapi
from rest_framework import permissions

from credentials.apps.core import views as core_views
from credentials.apps.records.views import ProgramListingView
Expand All @@ -34,11 +36,21 @@
admin.site.site_header = _("Credentials Administration")
admin.site.site_title = admin.site.site_header

schema_view = get_schema_view(
openapi.Info(
title="Credentials API",
default_version='v1',
description="Credentials API docs",
),
public=False,
permission_classes=[permissions.AllowAny],
)

urlpatterns = oauth2_urlpatterns + [
re_path(r"^admin/", admin.site.urls),
re_path(r"^api/", include(("credentials.apps.api.urls", "api"), namespace="api")),
re_path(r"^api-auth/", include((oauth2_urlpatterns, "rest_framework"), namespace="rest_framework")),
re_path(r"^api-docs/", get_swagger_view(title="Credentials API"), name="api_docs"),
re_path(r"^api-docs/$", schema_view.with_ui('swagger', cache_timeout=0), name="api_docs"),
re_path(r"^auto_auth/$", core_views.AutoAuth.as_view(), name="auto_auth"),
re_path(r"^credentials/", include(("credentials.apps.credentials.urls", "credentials"), namespace="credentials")),
re_path(r"^health/$", core_views.health, name="health"),
Expand Down
Loading