synthea_webservice/webservice/apps/api/urls.py

46 lines
1.5 KiB
Python
Raw Normal View History

2020-11-13 15:31:14 +01:00
from django.urls import path, re_path, include
from rest_framework import permissions, routers
from drf_yasg2.views import get_schema_view
from drf_yasg2 import openapi
from . import views
2020-11-17 11:40:11 +01:00
from apps.synthea.api.views import SyntheaViewSet
from apps.synthea.api.serializers import SyntheaSerializer ,SyntheaModelsSerializer
2020-11-13 15:31:14 +01:00
schema_view = get_schema_view(
openapi.Info(
2020-11-16 16:30:41 +01:00
title="Synthea WebService API",
2020-11-17 11:40:11 +01:00
default_version='',
2020-11-16 16:30:41 +01:00
description="Info about Synthea WebServer API",
2020-11-13 15:31:14 +01:00
terms_of_service="https://www.rug.nl",
2020-11-17 11:40:11 +01:00
contact=openapi.Contact(email="cit@rug.nl"),
2020-11-13 15:31:14 +01:00
license=openapi.License(name="MIT License"),
),
public=True,
permission_classes=(permissions.AllowAny,),
)
2020-11-17 11:40:11 +01:00
generate_post = SyntheaViewSet.as_view({
'post': 'create'
})
2020-11-13 15:31:14 +01:00
# Main namespace for the API urls
app_name = 'api'
urlpatterns = [
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'),
# Extra /api/info path for checking if the Hawk authentication is working.
# Also this will give the full url to the OpenAPI documentation
path('info/', views.Info.as_view(), name='info'),
2020-11-16 16:30:41 +01:00
path('states/', views.States.as_view(), name='states'),
path('modules/', views.Modules.as_view(), name='modules'),
2020-11-17 11:40:11 +01:00
path('generate/', generate_post, name='generate'),
2020-11-13 15:31:14 +01:00
]