Commit 724d8078 by Clinton Blackburn

WIP: Replace Swagger with coreapi

Documentation is now rendered using coreapi rather than Swagger. This aligns with the behavior of our other IDAs which also use coreapi.
parent 855ef03a
...@@ -17,8 +17,6 @@ from course_discovery.apps.course_metadata.models import CourseRun ...@@ -17,8 +17,6 @@ from course_discovery.apps.course_metadata.models import CourseRun
# pylint: disable=no-member # pylint: disable=no-member
class CatalogViewSet(viewsets.ModelViewSet): class CatalogViewSet(viewsets.ModelViewSet):
""" Catalog resource. """
filter_backends = (filters.PermissionsFilter,) filter_backends = (filters.PermissionsFilter,)
lookup_field = 'id' lookup_field = 'id'
permission_classes = (DRYPermissions,) permission_classes = (DRYPermissions,)
...@@ -31,7 +29,6 @@ class CatalogViewSet(viewsets.ModelViewSet): ...@@ -31,7 +29,6 @@ class CatalogViewSet(viewsets.ModelViewSet):
@transaction.atomic @transaction.atomic
def create(self, request, *args, **kwargs): def create(self, request, *args, **kwargs):
""" Create a new catalog. """
data = request.data.copy() data = request.data.copy()
usernames = request.data.get('viewers', ()) usernames = request.data.get('viewers', ())
...@@ -54,6 +51,7 @@ class CatalogViewSet(viewsets.ModelViewSet): ...@@ -54,6 +51,7 @@ class CatalogViewSet(viewsets.ModelViewSet):
""" Destroy a catalog. """ """ Destroy a catalog. """
return super(CatalogViewSet, self).destroy(request, *args, **kwargs) return super(CatalogViewSet, self).destroy(request, *args, **kwargs)
# TODO Determine how to expose this filter in docs
def list(self, request, *args, **kwargs): def list(self, request, *args, **kwargs):
""" Retrieve a list of all catalogs. """ Retrieve a list of all catalogs.
--- ---
...@@ -103,6 +101,7 @@ class CatalogViewSet(viewsets.ModelViewSet): ...@@ -103,6 +101,7 @@ class CatalogViewSet(viewsets.ModelViewSet):
serializer = serializers.CatalogCourseSerializer(page, many=True, context={'request': request}) serializer = serializers.CatalogCourseSerializer(page, many=True, context={'request': request})
return self.get_paginated_response(serializer.data) return self.get_paginated_response(serializer.data)
# TODO Determine how to expose this filter in docs
@detail_route() @detail_route()
def contains(self, request, id=None): # pylint: disable=redefined-builtin,unused-argument def contains(self, request, id=None): # pylint: disable=redefined-builtin,unused-argument
""" """
......
...@@ -376,10 +376,6 @@ JWT_AUTH = { ...@@ -376,10 +376,6 @@ JWT_AUTH = {
'JWT_VERIFY_AUDIENCE': False, 'JWT_VERIFY_AUDIENCE': False,
} }
SWAGGER_SETTINGS = {
'DOC_EXPANSION': 'list',
}
# Elasticsearch uses index settings to specify available analyzers. # Elasticsearch uses index settings to specify available analyzers.
# We are adding the lowercase analyzer and tweaking the ngram analyzers here, # We are adding the lowercase analyzer and tweaking the ngram analyzers here,
# so we need to use these settings rather than the index defaults. # so we need to use these settings rather than the index defaults.
......
...@@ -22,8 +22,8 @@ from django.conf.urls.static import static ...@@ -22,8 +22,8 @@ from django.conf.urls.static import static
from django.contrib import admin from django.contrib import admin
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
from django.views.i18n import javascript_catalog from django.views.i18n import javascript_catalog
from rest_framework.documentation import include_docs_urls
from course_discovery.apps.api.views import SwaggerSchemaView
from course_discovery.apps.core import views as core_views from course_discovery.apps.core import views as core_views
from course_discovery.apps.course_metadata.views import QueryPreviewView from course_discovery.apps.course_metadata.views import QueryPreviewView
...@@ -38,7 +38,7 @@ urlpatterns = auth_urlpatterns + [ ...@@ -38,7 +38,7 @@ urlpatterns = auth_urlpatterns + [
url(r'^api/', include('course_discovery.apps.api.urls', namespace='api')), url(r'^api/', include('course_discovery.apps.api.urls', namespace='api')),
# Use the same auth views for all logins, including those originating from the browseable API. # Use the same auth views for all logins, including those originating from the browseable API.
url(r'^api-auth/', include(auth_urlpatterns, namespace='rest_framework')), url(r'^api-auth/', include(auth_urlpatterns, namespace='rest_framework')),
url(r'^api-docs/', SwaggerSchemaView.as_view(), name='api_docs'), url(r'^api-docs/', include_docs_urls(title='Discovery API'), name='api_docs'),
url(r'^auto_auth/$', core_views.AutoAuth.as_view(), name='auto_auth'), url(r'^auto_auth/$', core_views.AutoAuth.as_view(), name='auto_auth'),
url(r'^health/$', core_views.health, name='health'), url(r'^health/$', core_views.health, name='health'),
url('^$', QueryPreviewView.as_view()), url('^$', QueryPreviewView.as_view()),
......
beautifulsoup4==4.5.1 beautifulsoup4==4.5.1
boto==2.42.0 boto==2.42.0
coreapi==2.3.3
cryptography==1.7.1 cryptography==1.7.1
django==1.11.3 django==1.11.3
django-autocomplete-light==3.1.8 django-autocomplete-light==3.1.8
...@@ -23,14 +24,13 @@ django-taggit-autosuggest==0.3.0 ...@@ -23,14 +24,13 @@ django-taggit-autosuggest==0.3.0
django-taggit-serializer==0.1.5 django-taggit-serializer==0.1.5
django-waffle==0.11.1 django-waffle==0.11.1
django-webpack-loader==0.5.0 django-webpack-loader==0.5.0
djangorestframework==3.6.3 djangorestframework==3.7.1
djangorestframework-csv==1.4.1 djangorestframework-csv==1.4.1
djangorestframework-jwt==1.8.0 djangorestframework-jwt==1.8.0
djangorestframework-xml==1.3.0 djangorestframework-xml==1.3.0
django-rest-swagger==2.1.2
drf-extensions==0.3.1 drf-extensions==0.3.1
drf-haystack==1.6.1 drf-haystack==1.6.1
dry-rest-permissions==0.1.6 dry-rest-permissions==0.1.9
edx-auth-backends==1.1.2 edx-auth-backends==1.1.2
edx-ccx-keys==0.2.0 edx-ccx-keys==0.2.0
edx-django-release-util==0.3.1 edx-django-release-util==0.3.1
...@@ -41,9 +41,10 @@ edx-rest-api-client==1.6.0 ...@@ -41,9 +41,10 @@ edx-rest-api-client==1.6.0
elasticsearch>=1.0.0,<2.0.0 elasticsearch>=1.0.0,<2.0.0
html2text==2016.9.19 html2text==2016.9.19
jsonfield==1.0.3 jsonfield==1.0.3
markdown==2.6.6 markdown==2.6.9
pillow==3.4.2 pillow==3.4.2
pycountry==1.20 pycountry==1.20
Pygments==2.2.0
python-dateutil==2.5.3 python-dateutil==2.5.3
pytz==2016.6.1 pytz==2016.6.1
# Pinning `requests` at 2.9.1 because the latest version of the package causes test failures with mocked requests # Pinning `requests` at 2.9.1 because the latest version of the package causes test failures with mocked requests
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment