Commit bb68022c authored by Kenzo-Hugo Hillion's avatar Kenzo-Hugo Hillion
Browse files

Improve docs for metagenedb API

parent f7d75ca9
Pipeline #28103 failed with stages
in 3 minutes and 3 seconds
......@@ -66,6 +66,6 @@ api_router.register(r'statistics', views.StatisticsViewSet, basename='statistics
urlpatterns = [
url(r'v1/', include((api_router.urls, 'v1'))),
path('admin/', include(('metagenedb.api.catalog.admin_urls', 'admin'))),
path('celery-test/', celery_test_view, name='celery-test'),
path('celery-task-test/', test_task_view, name='celery-task-test')
# path('celery-test/', celery_test_view, name='celery-test'),
# path('celery-task-test/', test_task_view, name='celery-task-test'),
]
import logging
from drf_yasg.utils import swagger_auto_schema
from drf_yasg.openapi import Response
from rest_framework import permissions
from rest_framework.response import Response
# from rest_framework.response import Response
from rest_framework.status import HTTP_500_INTERNAL_SERVER_ERROR
from rest_framework.views import APIView
from rest_framework_jwt.authentication import JSONWebTokenAuthentication
......@@ -37,12 +39,36 @@ class ComputeCountsAPI(ComputeStatisticsAPI):
compute_class = ComputeCounts
success_message = "Counts on gene annotation successfully computed"
@swagger_auto_schema(
operation_description="Compute counts for the different annotations of the genes",
operation_summary="API to compute counts of annotations.",
tags=['admin-commands'],
)
def get(self, *args, **kwargs):
return super().get(*args, **kwargs)
class ComputeTaxonomyRepartitionAPI(ComputeStatisticsAPI):
compute_class = ComputeTaxonomyRepartition
success_message = "Different taxonomy repartition successfully computed"
@swagger_auto_schema(
operation_description="Compute repartition of taxonomy among genes",
operation_summary="API to compute repartition of taxonomy.",
tags=['admin-commands'],
)
def get(self, *args, **kwargs):
return super().get(*args, **kwargs)
class ComputeGeneLengthAPI(ComputeStatisticsAPI):
compute_class = ComputeGeneLength
success_message = "Gene length for different windows size successfully computed"
@swagger_auto_schema(
operation_description="Compute gene length distribution",
operation_summary="API to compute gene length distribution.",
tags=['admin-commands'],
)
def get(self, *args, **kwargs):
return super().get(*args, **kwargs)
......@@ -8,7 +8,7 @@ from metagenedb.apps.catalog.serializers import StatisticsSerializer
class StatisticsViewSet(viewsets.ViewSet):
"""
A simple ViewSet for listing or retrieving statistics.
API View that list or retrieve pre-computed statistics from the catalog.
"""
lookup_field = 'stats_id'
......
from django.urls import include, path
from django.conf.urls import url
from drf_yasg import openapi
from drf_yasg.views import get_schema_view
from rest_framework import permissions
schema_view = get_schema_view(
openapi.Info(
title="Metagenedb API",
default_version='v1',
description="API documentation for metagenedb",
contact=openapi.Contact(email="kehillio@pasteur.fr"),
license=openapi.License(name="License not defined"),
),
public=False,
permission_classes=(permissions.AllowAny,),
)
urlpatterns = [
path('auth/', include(('metagenedb.api.accounts.urls', 'auth'))),
path('catalog/', include(('metagenedb.api.catalog.urls', 'catalog')))
path('catalog/', include(('metagenedb.api.catalog.urls', 'catalog'))),
url(r'swagger(?P<format>\.json|\.yaml)$', schema_view.without_ui(cache_timeout=0), name='schema-json'),
url(r'swagger/$', schema_view.with_ui('swagger', cache_timeout=0), name='schema-swagger-ui'),
url(r'redoc/$', schema_view.with_ui('redoc', cache_timeout=0), name='schema-redoc'),
]
......@@ -16,29 +16,10 @@ Including another URLconf
from django.contrib import admin
from django.urls import include, path
from django.conf.urls import url
from rest_framework import permissions
from drf_yasg.views import get_schema_view
from drf_yasg import openapi
schema_view = get_schema_view(
openapi.Info(
title="Metagenedb API",
default_version='v1',
description="API documentation for metagenedb",
contact=openapi.Contact(email="kehillio@pasteur.fr"),
license=openapi.License(name="License not defined"),
),
public=True,
permission_classes=(permissions.AllowAny,),
)
urlpatterns = [
path('api/', include(('metagenedb.api.urls', 'api'))),
path('admin/', admin.site.urls),
url(r'^swagger(?P<format>\.json|\.yaml)$', schema_view.without_ui(cache_timeout=0), name='schema-json'),
url(r'^swagger/$', schema_view.with_ui('swagger', cache_timeout=0), name='schema-swagger-ui'),
url(r'^redoc/$', schema_view.with_ui('redoc', cache_timeout=0), name='schema-redoc'),
url(r'^ht/', include('health_check.urls')),
]
......@@ -35,7 +35,7 @@ spec:
backend:
serviceName: backend
servicePort: 8000
- path: /bioapi/
- path: /bioapi
backend:
serviceName: bioapi
servicePort: 80
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment