Skip to content

Commit 0c54083

Browse files
author
Sanjay Boddu
authored
Merge pull request #137 from Ensembl/feature/swagger
Fix swagger documentation
2 parents ad0bd91 + 02a59f5 commit 0c54083

File tree

6 files changed

+25
-5
lines changed

6 files changed

+25
-5
lines changed

.gitignore

+6-1
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,9 @@ pip-delete-this-directory.txt
3232
.coverage
3333
.cache
3434
nosetests.xml
35-
coverage.xml
35+
coverage.xml
36+
37+
.idea
38+
39+
# Static files directory
40+
apache

gifts_rest/settings/base.py

+10-1
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,10 @@
185185
# Static files (CSS, JavaScript, Images)
186186
# https://docs.djangoproject.com/en/2.0/howto/static-files/
187187

188-
STATIC_URL = '/static/'
188+
STATIC_URL = '/gifts/api-static/'
189+
190+
STATIC_ROOT = os.path.join(BASE_DIR, "static/apache")
191+
189192

190193
# TaRK base URL
191194
TARK_SERVER = "http://tark.ensembl.org"
@@ -205,3 +208,9 @@
205208
CELERY_ACCEPT_CONTENT = ['application/json']
206209
CELERY_TASK_SERIALIZER = 'json'
207210
CELERY_RESULT_SERIALIZER = 'json'
211+
212+
SWAGGER_SETTINGS = {
213+
"USE_SESSION_AUTH": False,
214+
"SECURITY_DEFINITIONS": {},
215+
"DOC_EXPANSION": None
216+
}

gifts_rest/urls.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
from . import settings
4040

4141

42-
schema_view = get_swagger_view(title='GIFTs API Documentation')
42+
schema_view = get_swagger_view(title='GIFTs API Documentation', url='/' if settings.env.DEV_ENV else '/gifts/api/')
4343

4444

4545
if settings.env.DEV_ENV:

requirements.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ djangorestframework==3.7.7
66
django-cors-headers==2.4.0
77
django-filter==1.1.0
88
django-postgres-extra==1.21a8
9-
django-rest-swagger==2.2.0
9+
django-rest-swagger==2.1.2
1010
idna==2.7
1111
Markdown==2.6.11
1212
psycopg2-binary==2.7.4

restui/views/alignments.py

+4
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
from rest_framework.views import APIView
2424
from rest_framework.response import Response
2525
from rest_framework import status
26+
from rest_framework.permissions import IsAuthenticated
2627

2728

2829
import coreapi
@@ -40,6 +41,7 @@ class AlignmentRunCreate(generics.CreateAPIView):
4041
"""
4142
Store an AlignmentRun
4243
"""
44+
permission_classes = (IsAuthenticated,)
4345

4446
serializer_class = AlignmentRunSerializer
4547

@@ -58,6 +60,8 @@ class AlignmentCreate(APIView):
5860
Insert an Alignment
5961
"""
6062

63+
permission_classes = (IsAuthenticated,)
64+
6165
def post(self, request):
6266

6367
try:

restui/views/ensembl.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,8 @@ class EnspUCigarCreate(generics.CreateAPIView):
120120
Insert an alignment
121121
"""
122122

123+
permission_classes = (IsAuthenticated,)
124+
123125
serializer_class = EnspUCigarSerializer
124126

125127

@@ -185,7 +187,7 @@ class EnspUCigarFetchUpdateByAlignment(generics.RetrieveUpdateAPIView):
185187
"""
186188
Fetch/Update cigar/mdz by alignment id
187189
"""
188-
190+
permission_classes = (IsAuthenticated,)
189191
serializer_class = EnspUCigarSerializer
190192
schema = ManualSchema(description="Fetch/Update cigar/mdz by alignment id",
191193
fields=[

0 commit comments

Comments
 (0)