From 4996ad044ee2792861e7e2d61a3154da8afa85df Mon Sep 17 00:00:00 2001 From: Jan David Mol <mol@astron.nl> Date: Mon, 3 Dec 2018 21:10:04 +0000 Subject: [PATCH] Task LSMR-102: Added swagger export support --- SAS/LSMR/docker/lsmr/Dockerfile | 2 +- SAS/LSMR/src/CMakeLists.txt | 1 + SAS/LSMR/src/lsmr/settings.py | 3 ++- SAS/LSMR/src/lsmr/urls.py | 6 +++--- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/SAS/LSMR/docker/lsmr/Dockerfile b/SAS/LSMR/docker/lsmr/Dockerfile index 77a2c497453..370020f277a 100644 --- a/SAS/LSMR/docker/lsmr/Dockerfile +++ b/SAS/LSMR/docker/lsmr/Dockerfile @@ -13,7 +13,7 @@ RUN apt-get -y install make cmake g++ subversion python3 git # LOFAR build dependencies RUN apt-get -y install liblog4cplus-dev python3-dev libldap2-dev libsasl2-dev -RUN apt-get -y install python3-pip && pip3 install django djangorestframework django-filter django-auth-ldap coreapi python-ldap-test django-jsonforms django-json-widget "git+git://github.com/nnseva/django-jsoneditor.git" psycopg2 markdown ldap3 +RUN apt-get -y install python3-pip && pip3 install django djangorestframework django-filter django-auth-ldap coreapi python-ldap-test django-jsonforms django-json-widget "git+git://github.com/nnseva/django-jsoneditor.git" psycopg2 markdown ldap3 django-rest-swagger # Install LOFAR packages RUN mkdir /src && \ diff --git a/SAS/LSMR/src/CMakeLists.txt b/SAS/LSMR/src/CMakeLists.txt index 47ceed97437..65319f57a54 100644 --- a/SAS/LSMR/src/CMakeLists.txt +++ b/SAS/LSMR/src/CMakeLists.txt @@ -14,6 +14,7 @@ find_python_module(django_filters REQUIRED) # pip install django-filter find_python_module(django_auth_ldap REQUIRED) # sudo apt-get install python3-django-python3-ldap python3-django-auth-ldap find_python_module(coreapi REQUIRED) # sudo apt-get install python3-coreapi #find_python_module(jsoneditor REQUIRED) # pip install "git+git://github.com/nnseva/django-jsoneditor.git" +find_python_module(rest_framework_swagger REQUIRED) # pip install django-rest-swagger set(_py_files manage.py diff --git a/SAS/LSMR/src/lsmr/settings.py b/SAS/LSMR/src/lsmr/settings.py index 1c28456a3e7..f63743dfa78 100644 --- a/SAS/LSMR/src/lsmr/settings.py +++ b/SAS/LSMR/src/lsmr/settings.py @@ -52,7 +52,8 @@ INSTALLED_APPS = [ 'rest_framework', 'django_jsonforms', 'django_json_widget', - 'jsoneditor' + 'jsoneditor', + 'rest_framework_swagger', ] MIDDLEWARE = [ diff --git a/SAS/LSMR/src/lsmr/urls.py b/SAS/LSMR/src/lsmr/urls.py index 455b949ae31..274394f6996 100644 --- a/SAS/LSMR/src/lsmr/urls.py +++ b/SAS/LSMR/src/lsmr/urls.py @@ -21,16 +21,16 @@ from django.views.generic.base import TemplateView from rest_framework import routers from .lsmrapp import viewsets, models, serializers from rest_framework.documentation import include_docs_urls - +from rest_framework_swagger.views import get_swagger_view # # Django style patterns # - urlpatterns = [ path('admin/', admin.site.urls), - path('docs/', include_docs_urls(title='LSMR API')) + path('docs/', include_docs_urls(title='LSMR API')), + path('openapi/', get_swagger_view(title='Swagger API')), ] -- GitLab