diff --git a/bro_hub/settings.py b/bro_hub/settings.py index 32da55f..5a86822 100644 --- a/bro_hub/settings.py +++ b/bro_hub/settings.py @@ -40,6 +40,7 @@ "django.contrib.messages", "django.contrib.staticfiles", "rest_framework", + "drf_yasg", "django_filters", "rest_framework_simplejwt", "encrypted_model_fields", diff --git a/bro_hub/urls.py b/bro_hub/urls.py index a31edfb..3b3ac14 100644 --- a/bro_hub/urls.py +++ b/bro_hub/urls.py @@ -17,6 +17,9 @@ from django.contrib import admin from django.urls import include, path +from drf_yasg import openapi +from drf_yasg.views import get_schema_view +from rest_framework import permissions from rest_framework_simplejwt.views import ( TokenObtainPairView, TokenRefreshView, @@ -24,8 +27,27 @@ from api import views +schema_view = get_schema_view( + openapi.Info( + title="BROHub API", + default_version="v1", + description="Simplify the data management of the BRO", + terms_of_service="", + contact=openapi.Contact(email="servicedesk@nelen-schuurmans.nl"), + license=openapi.License(name="BSD License"), + ), + public=True, + permission_classes=(permissions.AllowAny,), +) + urlpatterns = [ path("admin/", admin.site.urls), + 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"), path("api/", include(("api.urls", "api"), namespace="api")), path("api/token/", TokenObtainPairView.as_view(), name="token_obtain_pair"), path("api/token/refresh/", TokenRefreshView.as_view(), name="token_refresh"), diff --git a/requirements.txt b/requirements.txt index d208dda..0b70743 100644 --- a/requirements.txt +++ b/requirements.txt @@ -4,6 +4,7 @@ django == 5.0.1 psycopg2-binary djangorestframework +drf-yasg celery redis flower