-
-
Notifications
You must be signed in to change notification settings - Fork 184
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(backend): generate OpenAPI v3 swagger docs #5259
base: main
Are you sure you want to change the base?
Changes from all commits
99f58f8
406302e
b9e6409
be3c033
eec41c2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,15 +8,29 @@ | |
from django.views.generic.base import RedirectView | ||
from rest_framework import status | ||
from rest_framework.exceptions import server_error | ||
from drf_spectacular.views import ( | ||
SpectacularAPIView, | ||
SpectacularRedocView, | ||
SpectacularSwaggerView, | ||
) | ||
|
||
from kpi.utils.urls import is_request_for_html | ||
|
||
admin.autodiscover() | ||
admin.site.login = staff_member_required( | ||
admin.site.login, login_url=settings.LOGIN_URL | ||
) | ||
admin.site.login = staff_member_required(admin.site.login, login_url=settings.LOGIN_URL) | ||
|
||
urlpatterns = [ | ||
path('api/schema/', SpectacularAPIView.as_view(), name='schema'), | ||
path( | ||
'api/schema/swagger/', | ||
SpectacularSwaggerView.as_view(url_name='schema'), | ||
name='swagger-ui', | ||
), | ||
path( | ||
'api/schema/redoc/', | ||
SpectacularRedocView.as_view(url_name='schema'), | ||
name='redoc', | ||
), | ||
Comment on lines
+23
to
+33
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I just copied the example from docs for a quick PoC. Questions:
|
||
# https://github.com/stochastic-technologies/django-loginas | ||
re_path(r'^admin/', include('loginas.urls')), | ||
# Disable admin login form | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,7 +24,7 @@ class AssetJsonRenderer(renderers.JSONRenderer): | |
|
||
class MediaFileRenderer(renderers.BaseRenderer): | ||
media_type = '*/*' | ||
format = None | ||
format = 'TODO' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
charset = None | ||
render_style = 'binary' | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
drf_spectacular
requiresformat
to be a string, otherwise it crashes. What would the right format here?