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

Replace rest_framework_swagger with drf_yasg #3654

Merged
merged 1 commit into from
Feb 22, 2022
Merged
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 ecommerce/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@
'crispy_forms',
'solo',
'social_django',
'rest_framework_swagger',
'drf_yasg',
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@aht007 I have already added drf-yasg to INSTALLED_APPS here. This list (DJANGO_APPS) is the part of INSTALLED_APPS

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh Okay. I mistook this file for base.in

'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
29 changes: 18 additions & 11 deletions requirements/base.txt
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,11 @@ configparser==5.2.0
coreapi==2.3.3
# via
# -r requirements/base.in
# django-rest-swagger
# openapi-codec
# drf-yasg
coreschema==0.0.4
# via coreapi
# via
# coreapi
# drf-yasg
coverage==6.2
# via cybersource-rest-client-python
crypto==1.4.1
Expand Down Expand Up @@ -108,6 +109,7 @@ django==2.2.26
# django-treebeard
# djangorestframework
# drf-jwt
# drf-yasg
# edx-auth-backends
# edx-django-release-util
# edx-django-sites-extensions
Expand Down Expand Up @@ -151,8 +153,6 @@ django-oscar==2.2
# -r requirements/base.in
django-phonenumber-field==5.0.0
# 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==2.0.0
Expand All @@ -174,11 +174,11 @@ djangorestframework==3.13.1
# 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 @@ -189,6 +189,8 @@ drf-extensions==0.7.1
# via -r requirements/base.in
drf-jwt==1.19.2
# 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 @@ -244,6 +246,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.1
Expand Down Expand Up @@ -304,11 +308,10 @@ oauthlib==3.1.1
# via
# requests-oauthlib
# social-auth-core
openapi-codec==1.3.2
# via django-rest-swagger
packaging==21.3
# via
# bleach
# drf-yasg
# redis
paramiko==2.9.2
# via cybersource-rest-client-python
Expand Down Expand Up @@ -448,6 +451,10 @@ rjsmin==1.2.0
# via django-compressor
rsa==4.8
# via cybersource-rest-client-python
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
Expand All @@ -458,8 +465,6 @@ shellescape==3.8.1
# via
# crypto
# cybersource-rest-client-python
simplejson==3.17.6
# via django-rest-swagger
six==1.16.0
# via
# analytics-python
Expand Down Expand Up @@ -523,7 +528,9 @@ unicodecsv==0.14.1
# -r requirements/base.in
# djangorestframework-csv
uritemplate==4.1.1
# via coreapi
# via
# coreapi
# drf-yasg
urllib3==1.26.8
# via
# -c requirements/pins.txt
Expand Down
33 changes: 20 additions & 13 deletions requirements/dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -100,12 +100,12 @@ configparser==5.2.0
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
# drf-yasg
coverage[toml]==6.2
# via
# -r requirements/test.txt
Expand Down Expand Up @@ -170,6 +170,7 @@ django==2.2.26
# django-treebeard
# djangorestframework
# drf-jwt
# drf-yasg
# edx-auth-backends
# edx-django-release-util
# edx-django-sites-extensions
Expand Down Expand Up @@ -225,8 +226,6 @@ django-phonenumber-field==5.0.0
# 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==2.0.0
Expand Down Expand Up @@ -256,11 +255,11 @@ djangorestframework==3.13.1
# 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 @@ -277,6 +276,8 @@ drf-jwt==1.19.2
# 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.1
Expand Down Expand Up @@ -366,6 +367,10 @@ importlib-metadata==4.10.0
# via
# -r requirements/test.txt
# pytest-randomly
inflection==0.5.1
# via
# -r requirements/test.txt
# drf-yasg
iniconfig==1.1.1
# via
# -r requirements/test.txt
Expand Down Expand Up @@ -473,15 +478,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.3
# via
# -r requirements/docs.txt
# -r requirements/test.txt
# bleach
# drf-yasg
# pytest
# redis
# sphinx
Expand Down Expand Up @@ -765,6 +767,14 @@ rsa==4.8
# via
# -r requirements/test.txt
# cybersource-rest-client-python
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
Expand All @@ -785,10 +795,6 @@ shellescape==3.8.1
# -r requirements/test.txt
# crypto
# cybersource-rest-client-python
simplejson==3.17.6
# via
# -r requirements/test.txt
# django-rest-swagger
six==1.16.0
# via
# -r requirements/docs.txt
Expand Down Expand Up @@ -945,6 +951,7 @@ uritemplate==4.1.1
# via
# -r requirements/test.txt
# coreapi
# drf-yasg
urllib3==1.26.8
# via
# -r requirements/docs.txt
Expand Down
29 changes: 18 additions & 11 deletions requirements/production.txt
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,11 @@ configparser==5.2.0
coreapi==2.3.3
# via
# -r requirements/base.in
# django-rest-swagger
# openapi-codec
# drf-yasg
coreschema==0.0.4
# via coreapi
# via
# coreapi
# drf-yasg
coverage==6.2
# via cybersource-rest-client-python
crypto==1.4.1
Expand Down Expand Up @@ -111,6 +112,7 @@ django==2.2.26
# django-treebeard
# djangorestframework
# drf-jwt
# drf-yasg
# edx-auth-backends
# edx-django-release-util
# edx-django-sites-extensions
Expand Down Expand Up @@ -154,8 +156,6 @@ django-oscar==2.2
# -r requirements/base.in
django-phonenumber-field==5.0.0
# via django-oscar
django-rest-swagger==2.2.0
# via -r requirements/base.in
django-ses==2.3.1
# via -r requirements/production.in
django-simple-history==3.0.0
Expand All @@ -179,11 +179,11 @@ djangorestframework==3.13.1
# 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 @@ -194,6 +194,8 @@ drf-extensions==0.7.1
# via -r requirements/base.in
drf-jwt==1.19.2
# 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 @@ -253,6 +255,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.1
Expand Down Expand Up @@ -316,11 +320,10 @@ oauthlib==3.1.1
# via
# requests-oauthlib
# social-auth-core
openapi-codec==1.3.2
# via django-rest-swagger
packaging==21.3
# via
# bleach
# drf-yasg
# redis
paramiko==2.9.2
# via cybersource-rest-client-python
Expand Down Expand Up @@ -466,6 +469,10 @@ rjsmin==1.2.0
# via django-compressor
rsa==4.8
# via cybersource-rest-client-python
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
Expand All @@ -476,8 +483,6 @@ shellescape==3.8.1
# via
# crypto
# cybersource-rest-client-python
simplejson==3.17.6
# via django-rest-swagger
six==1.16.0
# via
# analytics-python
Expand Down Expand Up @@ -542,7 +547,9 @@ unicodecsv==0.14.1
# -r requirements/base.in
# djangorestframework-csv
uritemplate==4.1.1
# via coreapi
# via
# coreapi
# drf-yasg
urllib3==1.26.8
# via
# -c requirements/pins.txt
Expand Down
Loading