From 6fa3274f198749687d561de61f7c0bd68cfdca5b Mon Sep 17 00:00:00 2001 From: Remy van der Wereld Date: Wed, 4 Sep 2024 12:46:38 +0200 Subject: [PATCH] Fix swagger ui --- app/apps/users/models.py | 2 +- app/config/settings.py | 4 ++++ app/requirements.txt | 1 + 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/app/apps/users/models.py b/app/apps/users/models.py index 9477f21ad..7a9fbab57 100644 --- a/app/apps/users/models.py +++ b/app/apps/users/models.py @@ -43,7 +43,7 @@ class Meta: ) USERNAME_FIELD = "email" - REQUIRED_FIELDS = [] + REQUIRED_FIELDS = ["username"] @property def full_name(self): diff --git a/app/config/settings.py b/app/config/settings.py index c32721989..afede158a 100644 --- a/app/config/settings.py +++ b/app/config/settings.py @@ -52,6 +52,7 @@ "rest_framework", "rest_framework.authtoken", "drf_spectacular", + "drf_spectacular_sidecar", # required for Django collectstatic discovery "django_extensions", "django_filters", "django_celery_beat", @@ -175,6 +176,9 @@ "SCHEMA_PATH_PREFIX": "/api/v[0-9]/", "TITLE": "Zaken Backend Gateway API", "VERSION": "v1", + "SWAGGER_UI_DIST": "SIDECAR", # shorthand to use the sidecar instead + "SWAGGER_UI_FAVICON_HREF": "SIDECAR", + "REDOC_DIST": "SIDECAR", } TAG_NAME = os.getenv("TAG_NAME", "default-release") diff --git a/app/requirements.txt b/app/requirements.txt index b2b4a458d..62a7a29bc 100644 --- a/app/requirements.txt +++ b/app/requirements.txt @@ -35,6 +35,7 @@ django-timezone-field==6.1.0 djangorestframework==3.15.2 djangorestframework-simplejwt==5.3.1 drf-spectacular==0.27.2 +drf-spectacular-sidecar==2024.7.1 drf-writable-nested==0.6.3 spiffworkflow==1.1.0 Faker==8.13.2