From 20870f53b6c56575e83b3b1dbfcbe03c63da4d08 Mon Sep 17 00:00:00 2001
From: Jan David Mol <mol@astron.nl>
Date: Wed, 5 Dec 2018 17:14:56 +0000
Subject: [PATCH] Task LSMR-102: Added a few comments

---
 .gitattributes                                      | 2 +-
 SAS/LSMR/doc/LSMR.md                                | 9 ++++++---
 SAS/LSMR/docker/{README => README.md}               | 0
 SAS/LSMR/src/CMakeLists.txt                         | 2 ++
 SAS/LSMR/src/lsmr/lsmrapp/viewsets/lofar_viewset.py | 3 +++
 SAS/LSMR/src/lsmr/urls.py                           | 9 +++++----
 6 files changed, 17 insertions(+), 8 deletions(-)
 rename SAS/LSMR/docker/{README => README.md} (100%)

diff --git a/.gitattributes b/.gitattributes
index b9956297867..1d5310b0d98 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -4239,7 +4239,7 @@ SAS/LSMR/bin/lsmr_testdatabase -text
 SAS/LSMR/bin/lsmr_testldap -text
 SAS/LSMR/doc/LSMR.md -text
 SAS/LSMR/doc/package.dox -text
-SAS/LSMR/docker/README -text
+SAS/LSMR/docker/README.md -text
 SAS/LSMR/docker/lsmr-postgres/Dockerfile -text
 SAS/LSMR/docker/lsmr-postgres/init.sql -text
 SAS/LSMR/docker/lsmr/Dockerfile -text
diff --git a/SAS/LSMR/doc/LSMR.md b/SAS/LSMR/doc/LSMR.md
index 907432d367d..d41cdb56415 100644
--- a/SAS/LSMR/doc/LSMR.md
+++ b/SAS/LSMR/doc/LSMR.md
@@ -37,6 +37,7 @@ meetings with stakeholders.* TODO
 
 
 ### Testing
+
 TODO tests are missing 
 - *How do you run unit tests?* TODO
 - *How do you run integration tests?* TODO
@@ -45,8 +46,10 @@ TODO tests are missing
 ### Build & Deploy
 
 There is cmake integration for development work and testing. 
-For production deplyoment, the production database has to be configured in settings.py.
-This should be best served through Nginx or Apache, so you want to collect static files and reference the wsgi.py.  
+For production deployment, the production database has to be configured in settings.py.
+This should be best served through Nginx or Apache, so you want to collect static files and reference the wsgi.py.
+
+A docker environment is setup in ../docker, see ../docker/README.md
 
 - - -
 ## OPERATIONS
@@ -93,4 +96,4 @@ TODO
 
 ### Operations Documentation
 
-*e.g. Please refer to URL X for Operations Documentation*
\ No newline at end of file
+*e.g. Please refer to URL X for Operations Documentation*
diff --git a/SAS/LSMR/docker/README b/SAS/LSMR/docker/README.md
similarity index 100%
rename from SAS/LSMR/docker/README
rename to SAS/LSMR/docker/README.md
diff --git a/SAS/LSMR/src/CMakeLists.txt b/SAS/LSMR/src/CMakeLists.txt
index 8d07040bff3..d5c88c6a6af 100644
--- a/SAS/LSMR/src/CMakeLists.txt
+++ b/SAS/LSMR/src/CMakeLists.txt
@@ -14,6 +14,8 @@ 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"
+
+# modules for swagger API export
 find_python_module(drf_yasg REQUIRED)           # pip install drf-yasg
 find_python_module(flex REQUIRED)               # pip install flex
 find_python_module(swagger_spec_validator REQUIRED) # pip install swagger-spec-validator
diff --git a/SAS/LSMR/src/lsmr/lsmrapp/viewsets/lofar_viewset.py b/SAS/LSMR/src/lsmr/lsmrapp/viewsets/lofar_viewset.py
index bba2500c202..d8b0c02c499 100644
--- a/SAS/LSMR/src/lsmr/lsmrapp/viewsets/lofar_viewset.py
+++ b/SAS/LSMR/src/lsmr/lsmrapp/viewsets/lofar_viewset.py
@@ -1,5 +1,8 @@
 """
 A viewset extended with annotation and other common generic behaviours.
+
+Adds the following functionality:
+- Swagger API annotation
 """
 
 from rest_framework import viewsets
diff --git a/SAS/LSMR/src/lsmr/urls.py b/SAS/LSMR/src/lsmr/urls.py
index 97f8f63c071..06738031658 100644
--- a/SAS/LSMR/src/lsmr/urls.py
+++ b/SAS/LSMR/src/lsmr/urls.py
@@ -28,7 +28,8 @@ from drf_yasg import openapi
 # Django style patterns
 #
 
-schema_view = get_schema_view(
+# schema for Swagger API
+swagger_schema_view = get_schema_view(
    openapi.Info(
       title="LOFAR Internal API",
       default_version='v1',
@@ -45,9 +46,9 @@ schema_view = get_schema_view(
 urlpatterns = [
     path('admin/', admin.site.urls),
     path('docs/', include_docs_urls(title='LSMR API')),
-    re_path(r'^swagger(?P<format>\.json|\.yaml)$', schema_view.without_ui(cache_timeout=0), name='schema-json'),
-    path('swagger/', schema_view.with_ui('swagger', cache_timeout=0), name='schema-swagger-ui'),
-    path('redoc/', schema_view.with_ui('redoc', cache_timeout=0), name='schema-redoc'),
+    re_path(r'^swagger(?P<format>\.json|\.yaml)$', swagger_schema_view.without_ui(cache_timeout=0), name='schema-json'),
+    path('swagger/', swagger_schema_view.with_ui('swagger', cache_timeout=0), name='schema-swagger-ui'),
+    path('redoc/', swagger_schema_view.with_ui('redoc', cache_timeout=0), name='schema-redoc'),
 ]
 
 
-- 
GitLab