From 7a4c02d25507913cb38aceee1d5d53772d0587a1 Mon Sep 17 00:00:00 2001 From: Marcus Christie Date: Fri, 1 Dec 2017 14:24:06 -0500 Subject: [PATCH] Issue #109: enable coreapi schema --- django-cloudlaunch/cloudlaunch/urls.py | 5 +++++ django-cloudlaunch/cloudlaunch/views.py | 2 ++ requirements.txt | 1 + 3 files changed, 8 insertions(+) diff --git a/django-cloudlaunch/cloudlaunch/urls.py b/django-cloudlaunch/cloudlaunch/urls.py index 7afeaf13..a8a9f3c0 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.schemas import get_schema_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_schema_view(title='CloudLaunch API') + urlpatterns = [ url(r'api/v1/', include(router.urls)), url(r'api/v1/', include(deployments_router.urls)), @@ -63,4 +67,5 @@ url(r'accounts/', include('allauth.urls')), # Public services url(public_services_regex_pattern, include('public_appliances.urls')), + url(r'api/v1/schema/$', schema_view), ] diff --git a/django-cloudlaunch/cloudlaunch/views.py b/django-cloudlaunch/cloudlaunch/views.py index 2660293e..33d15a61 100644 --- a/django-cloudlaunch/cloudlaunch/views.py +++ b/django-cloudlaunch/cloudlaunch/views.py @@ -66,6 +66,8 @@ class CorsProxyView(APIView): """ API endpoint that allows applications to be viewed or edited. """ + exclude_from_schema = True + def get(self, request, format=None): url = self.request.query_params.get('url') response = requests.get(url) diff --git a/requirements.txt b/requirements.txt index 029aa322..2b8100f6 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 +coreapi==2.2.3 # Provides REST API schema # Cloudbridge git+git://github.com/gvlproject/cloudbridge