Skip to content
Snippets Groups Projects
Commit 59854804 authored by Ned Batchelder's avatar Ned Batchelder
Browse files

Add drf-yasg

* Install drf-yasg

* Add drf-yasg settings and urls

* Pin drf to make drf-yasg work

* Adjust config-models version to be compatible

* Remove django-rest-swagger (the old way)
parent 765559c7
No related branches found
No related tags found
No related merge requests found
......@@ -2147,6 +2147,8 @@ INSTALLED_APPS = [
# User API
'rest_framework',
'drf_yasg',
'openedx.core.djangoapps.user_api',
# Shopping cart
......
......@@ -8,7 +8,6 @@ from django.conf.urls.static import static
from django.contrib.admin import autodiscover as django_autodiscover
from django.utils.translation import ugettext_lazy as _
from django.views.generic.base import RedirectView
from rest_framework_swagger.views import get_swagger_view
from branding import views as branding_views
from config_models.views import ConfigurationModelCurrentAPIView
......@@ -42,6 +41,7 @@ from openedx.core.djangoapps.programs.models import ProgramsApiConfig
from openedx.core.djangoapps.self_paced.models import SelfPacedConfiguration
from openedx.core.djangoapps.site_configuration import helpers as configuration_helpers
from openedx.core.djangoapps.verified_track_content import views as verified_track_content_views
from openedx.core.openapi import schema_view
from openedx.features.enterprise_support.api import enterprise_enabled
from ratelimitbackend import admin
from static_template_view import views as static_template_view_views
......@@ -964,7 +964,9 @@ if settings.BRANCH_IO_KEY:
if settings.FEATURES.get('ENABLE_API_DOCS'):
urlpatterns += [
url(r'^api-docs/$', get_swagger_view(title='LMS API')),
url(r'^swagger(?P<format>\.json|\.yaml)$', schema_view.without_ui(cache_timeout=0), name='schema-json'),
url(r'^swagger/$', schema_view.with_ui('swagger', cache_timeout=0), name='schema-swagger-ui'),
url(r'^api-docs/$', schema_view.with_ui('swagger', cache_timeout=0)),
]
# edx-drf-extensions csrf app
......
"""
Open API support.
"""
from rest_framework import permissions
from drf_yasg.views import get_schema_view
from drf_yasg import openapi
schema_view = get_schema_view(
openapi.Info(
title="Snippets API",
default_version='v1',
description="Test description",
terms_of_service="https://www.google.com/policies/terms/",
contact=openapi.Contact(email="contact@snippets.local"),
license=openapi.License(name="BSD License"),
),
public=True,
permission_classes=(permissions.AllowAny,),
)
......@@ -37,7 +37,7 @@ celery==3.1.25 # Asynchronous task execution library
defusedxml
Django==1.11.21 # Web application framework
django-babel-underscore # underscore template extractor for django-babel (internationalization utilities)
django-config-models>=0.2.2 # Configuration models for Django allowing config management with auditing
django-config-models>=1.0.0 # Configuration models for Django allowing config management with auditing
django-cors-headers==2.1.0 # Used to allow to configure CORS headers for cross-domain requests
django-countries==4.6.1 # Country data for Django forms and model fields
django-crum # Middleware that stores the current request and user in thread local storage
......@@ -54,7 +54,6 @@ django-pyfs
django-ratelimit
django-ratelimit-backend==1.1.1
django-require
django-rest-swagger # API documentation
django-sekizai
django-ses==0.8.4
django-simple-history
......@@ -64,7 +63,9 @@ django-storages==1.4.1
django-user-tasks
django-waffle==0.12.0
django-webpack-loader # Used to wire webpack bundles into the django asset pipeline
djangorestframework==3.7.7
djangorestframework-jwt
drf-yasg # Replacement for django-rest-swagger
edx-ace==0.1.10
edx-analytics-data-api-client
edx-ccx-keys
......
......@@ -66,9 +66,6 @@ git+https://github.com/edx/MongoDBProxy.git@25b99097615bda06bd7cdfe5669ed80dc2a7
# This can go away when we update auth to not use django-rest-framework-oauth
git+https://github.com/edx/django-oauth-plus.git@01ec2a161dfc3465f9d35b9211ae790177418316#egg=django-oauth-plus==2.2.9.edx-1
# Why a DRF fork? See: https://openedx.atlassian.net/browse/PLAT-1581
git+https://github.com/edx/django-rest-framework.git@1ceda7c086fddffd1c440cc86856441bbf0bd9cb#egg=djangorestframework==3.6.3
# Why a drf-oauth fork? To add Django 1.11 compatibility to the abandoned repo.
# This dependency will be removed by this work: https://openedx.atlassian.net/browse/PLAT-1660
git+https://github.com/edx/django-rest-framework-oauth.git@0a43e8525f1e3048efe4bc70c03de308a277197c#egg=djangorestframework-oauth==1.1.1
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment