Add: api schema app
add for generating OpenAPI schema and documentation
This commit is contained in:
parent
dd4aa0aebc
commit
bab45566c8
3 changed files with 28 additions and 0 deletions
0
backend/api/schema/__init__.py
Normal file
0
backend/api/schema/__init__.py
Normal file
6
backend/api/schema/apps.py
Normal file
6
backend/api/schema/apps.py
Normal file
|
@ -0,0 +1,6 @@
|
|||
from django.apps import AppConfig
|
||||
|
||||
|
||||
class ApiConfig(AppConfig):
|
||||
default_auto_field = "django.db.models.BigAutoField"
|
||||
name = "api.schema"
|
22
backend/api/schema/urls.py
Normal file
22
backend/api/schema/urls.py
Normal file
|
@ -0,0 +1,22 @@
|
|||
from django.urls import path
|
||||
|
||||
from drf_spectacular.views import (
|
||||
SpectacularAPIView,
|
||||
SpectacularRedocView,
|
||||
SpectacularSwaggerView,
|
||||
)
|
||||
|
||||
urlpatterns = [
|
||||
path("", SpectacularAPIView.as_view(), name="schema"),
|
||||
# Optional UI:
|
||||
path(
|
||||
"swagger-ui/",
|
||||
SpectacularSwaggerView.as_view(url_name="schema"),
|
||||
name="swagger-ui",
|
||||
),
|
||||
path(
|
||||
"redoc/",
|
||||
SpectacularRedocView.as_view(url_name="schema"),
|
||||
name="redoc",
|
||||
),
|
||||
]
|
Loading…
Add table
Reference in a new issue