Skip to content

Commit

Permalink
Merge pull request #137 from Ensembl/feature/swagger
Browse files Browse the repository at this point in the history
Fix swagger documentation
  • Loading branch information
Sanjay Boddu authored Feb 27, 2023
2 parents ad0bd91 + 02a59f5 commit 0c54083
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 5 deletions.
7 changes: 6 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,9 @@ pip-delete-this-directory.txt
.coverage
.cache
nosetests.xml
coverage.xml
coverage.xml

.idea

# Static files directory
apache
11 changes: 10 additions & 1 deletion gifts_rest/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,10 @@
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/2.0/howto/static-files/

STATIC_URL = '/static/'
STATIC_URL = '/gifts/api-static/'

STATIC_ROOT = os.path.join(BASE_DIR, "static/apache")


# TaRK base URL
TARK_SERVER = "http://tark.ensembl.org"
Expand All @@ -205,3 +208,9 @@
CELERY_ACCEPT_CONTENT = ['application/json']
CELERY_TASK_SERIALIZER = 'json'
CELERY_RESULT_SERIALIZER = 'json'

SWAGGER_SETTINGS = {
"USE_SESSION_AUTH": False,
"SECURITY_DEFINITIONS": {},
"DOC_EXPANSION": None
}
2 changes: 1 addition & 1 deletion gifts_rest/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
from . import settings


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


if settings.env.DEV_ENV:
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ djangorestframework==3.7.7
django-cors-headers==2.4.0
django-filter==1.1.0
django-postgres-extra==1.21a8
django-rest-swagger==2.2.0
django-rest-swagger==2.1.2
idna==2.7
Markdown==2.6.11
psycopg2-binary==2.7.4
Expand Down
4 changes: 4 additions & 0 deletions restui/views/alignments.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
from rest_framework.views import APIView
from rest_framework.response import Response
from rest_framework import status
from rest_framework.permissions import IsAuthenticated


import coreapi
Expand All @@ -40,6 +41,7 @@ class AlignmentRunCreate(generics.CreateAPIView):
"""
Store an AlignmentRun
"""
permission_classes = (IsAuthenticated,)

serializer_class = AlignmentRunSerializer

Expand All @@ -58,6 +60,8 @@ class AlignmentCreate(APIView):
Insert an Alignment
"""

permission_classes = (IsAuthenticated,)

def post(self, request):

try:
Expand Down
4 changes: 3 additions & 1 deletion restui/views/ensembl.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,8 @@ class EnspUCigarCreate(generics.CreateAPIView):
Insert an alignment
"""

permission_classes = (IsAuthenticated,)

serializer_class = EnspUCigarSerializer


Expand Down Expand Up @@ -185,7 +187,7 @@ class EnspUCigarFetchUpdateByAlignment(generics.RetrieveUpdateAPIView):
"""
Fetch/Update cigar/mdz by alignment id
"""

permission_classes = (IsAuthenticated,)
serializer_class = EnspUCigarSerializer
schema = ManualSchema(description="Fetch/Update cigar/mdz by alignment id",
fields=[
Expand Down

0 comments on commit 0c54083

Please sign in to comment.