From b9db30f88a213583e3e02c105866beaef6149384 Mon Sep 17 00:00:00 2001 From: Marcus Christie Date: Thu, 2 Nov 2017 12:52:33 -0400 Subject: [PATCH] Issue #109: Add django-rest-swagger --- django-cloudlaunch/cloudlaunch/urls.py | 6 ++++++ django-cloudlaunch/cloudlaunchserver/settings.py | 3 ++- requirements.txt | 1 + 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/django-cloudlaunch/cloudlaunch/urls.py b/django-cloudlaunch/cloudlaunch/urls.py index 7afeaf13..ddddadee 100644 --- a/django-cloudlaunch/cloudlaunch/urls.py +++ b/django-cloudlaunch/cloudlaunch/urls.py @@ -16,6 +16,7 @@ """ from django.conf.urls import include from django.conf.urls import url +from rest_framework_swagger.views import get_swagger_view from . import views @@ -45,6 +46,9 @@ infrastructure_regex_pattern = r'api/v1/infrastructure/' auth_regex_pattern = r'api/v1/auth/' public_services_regex_pattern = r'api/v1/public_services/' + +schema_view = get_swagger_view(title='CloudLaunch API') + urlpatterns = [ url(r'api/v1/', include(router.urls)), url(r'api/v1/', include(deployments_router.urls)), @@ -63,4 +67,6 @@ url(r'accounts/', include('allauth.urls')), # Public services url(public_services_regex_pattern, include('public_appliances.urls')), + # OpenAPI schema view + url(r'api/v1/schema/$', schema_view), ] diff --git a/django-cloudlaunch/cloudlaunchserver/settings.py b/django-cloudlaunch/cloudlaunchserver/settings.py index f0f10aeb..dccf1285 100644 --- a/django-cloudlaunch/cloudlaunchserver/settings.py +++ b/django-cloudlaunch/cloudlaunchserver/settings.py @@ -102,7 +102,8 @@ 'django_celery_results', 'django_celery_beat', 'django_countries', - 'django_filters' + 'django_filters', + 'rest_framework_swagger', ] MIDDLEWARE_CLASSES = [ diff --git a/requirements.txt b/requirements.txt index 029aa322..baecbd40 100644 --- a/requirements.txt +++ b/requirements.txt @@ -11,6 +11,7 @@ djangorestframework==3.6.4 django-rest-auth==0.9.1 # login support for DRF through restful endpoints django-allauth>=0.24.1 # pluggable social auth for django login drf-nested-routers>=0.11.1 # Provides nested routing for DRF +django-rest-swagger==2.1.2 # Provides OpenAPI/Swagger schema generation # Cloudbridge git+git://github.com/gvlproject/cloudbridge