Skip to content
This repository has been archived by the owner on Nov 4, 2024. It is now read-only.

Commit

Permalink
feat: replace rest_framework_swagger with drf_yasg (#3654)
Browse files Browse the repository at this point in the history
Co-authored-by: GonzaloRomero <gonzalo.romero@edunext.co>
  • Loading branch information
iamsobanjaved and NeOneSoft committed Mar 1, 2022
1 parent f874127 commit c459ad7
Show file tree
Hide file tree
Showing 7 changed files with 122 additions and 77 deletions.
2 changes: 1 addition & 1 deletion ecommerce/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@
'crispy_forms',
'solo',
'social_django',
'rest_framework_swagger',
'drf_yasg',
'rest_framework_datatables',
'django_sites_extensions',
# edx-drf-extensions
Expand Down
16 changes: 14 additions & 2 deletions ecommerce/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@
from django.views.defaults import page_not_found, server_error
from django.views.generic import TemplateView
from django.views.i18n import JavaScriptCatalog
from rest_framework_swagger.views import get_swagger_view
from drf_yasg import openapi
from drf_yasg.views import get_schema_view
from rest_framework import permissions

from ecommerce.core import views as core_views
from ecommerce.core.url_utils import get_lms_dashboard_url
Expand Down Expand Up @@ -52,11 +54,21 @@ def handler403(_, exception): # pylint: disable=unused-argument
ApplePayMerchantDomainAssociationView.as_view(), name='apple_pay_domain_association'),
]

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

urlpatterns = AUTH_URLS + WELL_KNOWN_URLS + [
url(r'^admin/', admin.site.urls),
url(r'^auto_auth/$', core_views.AutoAuth.as_view(), name='auto_auth'),
url(r'^api-auth/', include((AUTH_URLS, 'rest_framework'))),
url(r'^api-docs/', get_swagger_view(title='Ecommerce API'), name='api_docs'),
url(r'^api-docs/$', schema_view.with_ui('swagger', cache_timeout=0), name='api_docs'),
url(r'^bff/', include(('ecommerce.bff.urls', 'bff'))),
url(r'^courses/', include(('ecommerce.courses.urls', 'courses'))),
url(r'^credit/', include(('ecommerce.credit.urls', 'credit'))),
Expand Down
2 changes: 1 addition & 1 deletion requirements/base.in
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ django_extensions
django-filter
django-libsass
django-oscar
django-rest-swagger
django-simple-history
django-solo
django-threadlocals
Expand All @@ -23,6 +22,7 @@ djangorestframework
djangorestframework-csv
djangorestframework-datatables
drf-extensions
drf-yasg
edx-auth-backends
edx-django-release-util
edx-django-utils
Expand Down
42 changes: 25 additions & 17 deletions requirements/base.txt
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,12 @@ configparser==5.0.2
coreapi==2.3.3
# via
# -r requirements/base.in
# django-rest-swagger
# openapi-codec
# drf-yasg
coreschema==0.0.4
# via coreapi
coverage==6.0.1
# via
# coreapi
# drf-yasg
coverage==6.2
# via cybersource-rest-client-python
crypto==1.4.1
# via cybersource-rest-client-python
Expand Down Expand Up @@ -107,6 +108,7 @@ django==2.2.24
# django-treebeard
# djangorestframework
# drf-jwt
# drf-yasg
# edx-auth-backends
# edx-django-release-util
# edx-django-sites-extensions
Expand Down Expand Up @@ -150,8 +152,6 @@ django-oscar==2.0.4
# -r requirements/base.in
django-phonenumber-field==2.0.1
# via django-oscar
django-rest-swagger==2.2.0
# via -r requirements/base.in
django-simple-history==3.0.0
# via -r requirements/base.in
django-solo==1.2.0
Expand All @@ -173,11 +173,11 @@ djangorestframework==3.12.4
# via
# -r requirements/base.in
# django-config-models
# django-rest-swagger
# djangorestframework-csv
# djangorestframework-datatables
# drf-extensions
# drf-jwt
# drf-yasg
# edx-drf-extensions
# rest-condition
djangorestframework-csv==2.1.1
Expand All @@ -188,6 +188,8 @@ drf-extensions==0.7.1
# via -r requirements/base.in
drf-jwt==1.19.1
# via edx-drf-extensions
drf-yasg==1.20.0
# via -r requirements/base.in
edx-auth-backends==3.4.0
# via
# -c requirements/pins.txt
Expand Down Expand Up @@ -243,6 +245,8 @@ idna==2.7
# -c requirements/pins.txt
# cybersource-rest-client-python
# requests
inflection==0.5.1
# via drf-yasg
ipaddress==1.0.23
# via cybersource-rest-client-python
isodate==0.6.0
Expand Down Expand Up @@ -303,10 +307,10 @@ oauthlib==3.1.1
# via
# requests-oauthlib
# social-auth-core
openapi-codec==1.3.2
# via django-rest-swagger
packaging==21.0
# via bleach
packaging==21.3
# via
# bleach
# drf-yasg
paramiko==2.7.2
# via cybersource-rest-client-python
path.py==7.2
Expand Down Expand Up @@ -445,7 +449,11 @@ rjsmin==1.1.0
# via django-compressor
rsa==4.7.2
# via cybersource-rest-client-python
rules==3.0
ruamel.yaml==0.17.21
# via drf-yasg
ruamel.yaml.clib==0.2.6
# via ruamel.yaml
rules==3.1
# via -r requirements/base.in
s3transfer==0.5.0
# via boto3
Expand All @@ -455,8 +463,6 @@ shellescape==3.8.1
# via
# crypto
# cybersource-rest-client-python
simplejson==3.17.5
# via django-rest-swagger
six==1.16.0
# via
# analytics-python
Expand Down Expand Up @@ -521,9 +527,11 @@ unicodecsv==0.14.1
# via
# -r requirements/base.in
# djangorestframework-csv
uritemplate==3.0.1
# via coreapi
urllib3==1.26.7
uritemplate==4.1.1
# via
# coreapi
# drf-yasg
urllib3==1.26.8
# via
# -c requirements/pins.txt
# botocore
Expand Down
43 changes: 25 additions & 18 deletions requirements/dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -101,13 +101,13 @@ configparser==5.0.2
coreapi==2.3.3
# via
# -r requirements/test.txt
# django-rest-swagger
# openapi-codec
# drf-yasg
coreschema==0.0.4
# via
# -r requirements/test.txt
# coreapi
coverage[toml]==6.0.1
# drf-yasg
coverage[toml]==6.2
# via
# -r requirements/test.txt
# cybersource-rest-client-python
Expand Down Expand Up @@ -166,6 +166,7 @@ django==2.2.24
# django-treebeard
# djangorestframework
# drf-jwt
# drf-yasg
# edx-auth-backends
# edx-django-release-util
# edx-django-sites-extensions
Expand Down Expand Up @@ -223,8 +224,6 @@ django-phonenumber-field==2.0.1
# via
# -r requirements/test.txt
# django-oscar
django-rest-swagger==2.2.0
# via -r requirements/test.txt
django-simple-history==3.0.0
# via -r requirements/test.txt
django-solo==1.2.0
Expand Down Expand Up @@ -254,11 +253,11 @@ djangorestframework==3.12.4
# via
# -r requirements/test.txt
# django-config-models
# django-rest-swagger
# djangorestframework-csv
# djangorestframework-datatables
# drf-extensions
# drf-jwt
# drf-yasg
# edx-drf-extensions
# rest-condition
djangorestframework-csv==2.1.1
Expand All @@ -275,6 +274,8 @@ drf-jwt==1.19.1
# via
# -r requirements/test.txt
# edx-drf-extensions
drf-yasg==1.20.0
# via -r requirements/test.txt
edx-auth-backends==3.4.0
# via -r requirements/test.txt
edx-django-release-util==1.1.0
Expand Down Expand Up @@ -364,7 +365,11 @@ importlib-metadata==4.8.1
# via
# -r requirements/test.txt
# pytest-randomly
inflect==5.3.0
inflection==0.5.1
# via
# -r requirements/test.txt
# drf-yasg
iniconfig==1.1.1
# via
# -r requirements/test.txt
# jinja2-pluralize
Expand Down Expand Up @@ -484,15 +489,12 @@ oauthlib==3.1.1
# -r requirements/test.txt
# requests-oauthlib
# social-auth-core
openapi-codec==1.3.2
# via
# -r requirements/test.txt
# django-rest-swagger
packaging==21.0
packaging==21.3
# via
# -r requirements/docs.txt
# -r requirements/test.txt
# bleach
# drf-yasg
# pytest
# sphinx
# tox
Expand Down Expand Up @@ -778,7 +780,15 @@ rsa==4.7.2
# via
# -r requirements/test.txt
# cybersource-rest-client-python
rules==3.0
ruamel.yaml==0.17.21
# via
# -r requirements/test.txt
# drf-yasg
ruamel.yaml.clib==0.2.6
# via
# -r requirements/test.txt
# ruamel.yaml
rules==3.1
# via -r requirements/test.txt
s3transfer==0.5.0
# via
Expand All @@ -798,10 +808,6 @@ shellescape==3.8.1
# -r requirements/test.txt
# crypto
# cybersource-rest-client-python
simplejson==3.17.5
# via
# -r requirements/test.txt
# django-rest-swagger
six==1.16.0
# via
# -r requirements/docs.txt
Expand Down Expand Up @@ -956,7 +962,8 @@ uritemplate==3.0.1
# via
# -r requirements/test.txt
# coreapi
urllib3==1.26.7
# drf-yasg
urllib3==1.26.8
# via
# -r requirements/docs.txt
# -r requirements/test.txt
Expand Down
Loading

0 comments on commit c459ad7

Please sign in to comment.