Skip to content

Commit

Permalink
chore: update drf spectacular settings and add json view
Browse files Browse the repository at this point in the history
changed drf spectacular swagger ui and added spectacular json api view along with yaml view
  • Loading branch information
moonlitgrace committed Dec 10, 2024
1 parent 06a7045 commit 319a9b7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
4 changes: 3 additions & 1 deletion backend/config/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,9 @@
SPECTACULAR_SETTINGS = {
'TITLE': 'QuibbleAPI',
'DESCRIPTION': openapi_description,
'VERSION': '1.0.0',
'VERSION': '0.0.1',
'SERVE_INCLUDE_SCHEMA': False,
# 'SCHEMA_PATH_PREFIX': r'/api',
# sidecar config
'SWAGGER_UI_DIST': 'SIDECAR',
'SWAGGER_UI_FAVICON_HREF': 'SIDECAR',
Expand All @@ -104,6 +105,7 @@
'deepLinking': True,
'persistAuthorization': True,
'defaultModelsExpandDepth': -1,
'displayOperationId': True,
},
# integrate with drf-standardized-errors
# https://drf-standardized-errors.readthedocs.io/en/latest/openapi.html
Expand Down
7 changes: 6 additions & 1 deletion backend/config/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@
from django.conf.urls.static import static
from django.contrib import admin
from django.urls import include, path
from drf_spectacular.views import SpectacularAPIView, SpectacularSwaggerView
from drf_spectacular.views import (
SpectacularAPIView,
SpectacularJSONAPIView,
SpectacularSwaggerView,
)

# modify adminsite
admin.site.site_header = 'Quibble Administration'
Expand All @@ -25,6 +29,7 @@
),
# openapi
path('api/v1/schema/', SpectacularAPIView.as_view(api_version='v1'), name='schema'),
path('api/v1/schema.json', SpectacularJSONAPIView.as_view(), name='schema-json'),
]

# only add swagger ui for development
Expand Down

0 comments on commit 319a9b7

Please sign in to comment.