Skip to content

Commit

Permalink
chore: switch to drf-yasg
Browse files Browse the repository at this point in the history
Move from django-rest-swagger to drf-yasg and edx_api_doc_tools.
  • Loading branch information
ericfab179 committed Oct 21, 2021
1 parent 6e6c108 commit b5e4ff7
Show file tree
Hide file tree
Showing 9 changed files with 194 additions and 88 deletions.
3 changes: 2 additions & 1 deletion designer/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,10 @@
)

THIRD_PARTY_APPS = (
'drf_yasg',
'edx_api_doc_tools',
'release_util',
'rest_framework',
'rest_framework_swagger',
'social_django',
'waffle',
'modelcluster',
Expand Down
14 changes: 12 additions & 2 deletions designer/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@
from django.conf.urls.static import static
from django.contrib import admin
from django.views.generic import RedirectView
from rest_framework_swagger.views import get_swagger_view
from drf_yasg.views import get_schema_view
from edx_api_doc_tools import make_api_info
from rest_framework import permissions
from wagtail.admin import urls as wagtailadmin_urls
from wagtail.documents import urls as wagtaildocs_urls
from wagtail.core import urls as wagtail_urls
Expand All @@ -31,9 +33,17 @@

admin.autodiscover()


api_info = make_api_info(title="designer API", version="v1")
schema_view = get_schema_view(
api_info,
public=False,
permission_classes=(permissions.AllowAny,),
)

urlpatterns = oauth2_urlpatterns + [
url(r'^api/', include('designer.apps.api.urls')),
url(r'^api-docs/', get_swagger_view(title='designer API')),
url(r'^api-docs/$', schema_view.with_ui('swagger', cache_timeout=0), name='schema-swagger-ui'),
# Use the same auth views for all logins, including those originating from the browseable API.
url(r'^api-auth/', include(oauth2_urlpatterns)),
url(r'^auto_auth/$', core_views.AutoAuth.as_view(), name='auto_auth'),
Expand Down
3 changes: 2 additions & 1 deletion requirements/base.in
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@
Django # Web application framework
django-cors-headers
django-extensions
django-rest-swagger
django-storages
django-waffle
djangorestframework
drf-yasg
edx-api-doc-tools
edx-auth-backends
edx-django-release-util
edx-django-utils
Expand Down
39 changes: 27 additions & 12 deletions requirements/base.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ cffi==1.15.0
charset-normalizer==2.0.7
# via requests
coreapi==2.3.3
# via
# django-rest-swagger
# openapi-codec
# via drf-yasg
coreschema==0.0.4
# via coreapi
# via
# coreapi
# drf-yasg
cryptography==35.0.0
# via
# pyjwt
Expand All @@ -43,6 +43,8 @@ django==3.2.8
# django-treebeard
# djangorestframework
# drf-jwt
# drf-yasg
# edx-api-doc-tools
# edx-auth-backends
# edx-django-release-util
# edx-django-utils
Expand All @@ -58,8 +60,6 @@ django-filter==2.4.0
# via wagtail
django-modelcluster==5.2
# via wagtail
django-rest-swagger==2.2.0
# via -r requirements/base.in
django-storages==1.12.2
# via -r requirements/base.in
django-taggit==1.5.1
Expand All @@ -74,14 +74,21 @@ django-waffle==2.2.1
djangorestframework==3.12.4
# via
# -r requirements/base.in
# django-rest-swagger
# drf-jwt
# drf-yasg
# edx-api-doc-tools
# edx-drf-extensions
# wagtail
draftjs-exporter==2.1.7
# via wagtail
drf-jwt==1.19.1
# via edx-drf-extensions
drf-yasg==1.20.0
# via
# -r requirements/base.in
# edx-api-doc-tools
edx-api-doc-tools==1.5.0
# via -r requirements/base.in
edx-auth-backends==4.0.0
# via -r requirements/base.in
edx-django-release-util==1.1.0
Expand Down Expand Up @@ -109,6 +116,8 @@ idna==3.3
# via requests
inflect==5.3.0
# via -r requirements/base.in
inflection==0.5.1
# via drf-yasg
itypes==1.2.0
# via coreapi
jinja2==3.0.2
Expand All @@ -127,10 +136,10 @@ oauthlib==3.1.1
# via
# requests-oauthlib
# social-auth-core
openapi-codec==1.3.2
# via django-rest-swagger
openpyxl==3.0.9
# via tablib
packaging==21.0
# via drf-yasg
pbr==5.6.0
# via stevedore
pillow==8.4.0
Expand All @@ -152,6 +161,8 @@ pyjwt[crypto]==2.3.0
# social-auth-core
pymongo==3.12.1
# via edx-opaque-keys
pyparsing==2.4.7
# via packaging
python-dateutil==2.8.2
# via
# -r requirements/base.in
Expand All @@ -178,10 +189,12 @@ requests==2.26.0
# wagtail
requests-oauthlib==1.3.0
# via social-auth-core
ruamel.yaml==0.17.16
# via drf-yasg
ruamel.yaml.clib==0.2.6
# via ruamel.yaml
semantic-version==2.8.5
# via edx-drf-extensions
simplejson==3.17.5
# via django-rest-swagger
six==1.16.0
# via
# edx-auth-backends
Expand Down Expand Up @@ -215,7 +228,9 @@ tablib[xls,xlsx]==3.0.0
telepath==0.2
# via wagtail
uritemplate==4.1.1
# via coreapi
# via
# coreapi
# drf-yasg
urllib3==1.26.7
# via requests
wagtail==2.13.4
Expand Down
42 changes: 28 additions & 14 deletions requirements/dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,12 @@ codecov==2.1.12
coreapi==2.3.3
# via
# -r requirements/quality.txt
# django-rest-swagger
# openapi-codec
# drf-yasg
coreschema==0.0.4
# via
# -r requirements/quality.txt
# coreapi
# drf-yasg
coverage[toml]==6.0.2
# via
# -r requirements/quality.txt
Expand Down Expand Up @@ -107,6 +107,8 @@ django==3.2.8
# django-treebeard
# djangorestframework
# drf-jwt
# drf-yasg
# edx-api-doc-tools
# edx-auth-backends
# edx-django-release-util
# edx-django-utils
Expand All @@ -133,8 +135,6 @@ django-modelcluster==5.2
# via
# -r requirements/quality.txt
# wagtail
django-rest-swagger==2.2.0
# via -r requirements/quality.txt
django-storages==1.12.2
# via -r requirements/quality.txt
django-taggit==1.5.1
Expand All @@ -153,8 +153,9 @@ django-waffle==2.2.1
djangorestframework==3.12.4
# via
# -r requirements/quality.txt
# django-rest-swagger
# drf-jwt
# drf-yasg
# edx-api-doc-tools
# edx-drf-extensions
# wagtail
draftjs-exporter==2.1.7
Expand All @@ -165,6 +166,12 @@ drf-jwt==1.19.1
# via
# -r requirements/quality.txt
# edx-drf-extensions
drf-yasg==1.20.0
# via
# -r requirements/quality.txt
# edx-api-doc-tools
edx-api-doc-tools==1.5.0
# via -r requirements/quality.txt
edx-auth-backends==4.0.0
# via -r requirements/quality.txt
edx-django-release-util==1.1.0
Expand Down Expand Up @@ -194,7 +201,7 @@ et-xmlfile==1.1.0
# openpyxl
factory-boy==3.2.0
# via -r requirements/quality.txt
faker==9.5.0
faker==9.5.1
# via
# -r requirements/quality.txt
# factory-boy
Expand All @@ -219,6 +226,10 @@ inflect==5.3.0
# via
# -r requirements/quality.txt
# jinja2-pluralize
inflection==0.5.1
# via
# -r requirements/quality.txt
# drf-yasg
iniconfig==1.1.1
# via
# -r requirements/quality.txt
Expand Down Expand Up @@ -269,17 +280,14 @@ oauthlib==3.1.1
# -r requirements/quality.txt
# requests-oauthlib
# social-auth-core
openapi-codec==1.3.2
# via
# -r requirements/quality.txt
# django-rest-swagger
openpyxl==3.0.9
# via
# -r requirements/quality.txt
# tablib
packaging==21.0
# via
# -r requirements/quality.txt
# drf-yasg
# pytest
# tox
path==16.2.0
Expand Down Expand Up @@ -424,14 +432,18 @@ requests-oauthlib==1.3.0
# via
# -r requirements/quality.txt
# social-auth-core
semantic-version==2.8.5
ruamel.yaml==0.17.16
# via
# -r requirements/quality.txt
# edx-drf-extensions
simplejson==3.17.5
# drf-yasg
ruamel.yaml.clib==0.2.6
# via
# -r requirements/quality.txt
# django-rest-swagger
# ruamel.yaml
semantic-version==2.8.5
# via
# -r requirements/quality.txt
# edx-drf-extensions
six==1.16.0
# via
# -r requirements/quality.txt
Expand Down Expand Up @@ -509,11 +521,13 @@ typing-extensions==3.10.0.2
# via
# -r requirements/quality.txt
# astroid
# faker
# pylint
uritemplate==4.1.1
# via
# -r requirements/quality.txt
# coreapi
# drf-yasg
urllib3==1.26.7
# via
# -r requirements/quality.txt
Expand Down
Loading

0 comments on commit b5e4ff7

Please sign in to comment.