Add: api schema app

add for generating OpenAPI schema and documentation
This commit is contained in:
Aroy-Art 2025-02-08 18:10:28 +01:00
parent dd4aa0aebc
commit bab45566c8
Signed by: Aroy
GPG key ID: 583642324A1D2070
3 changed files with 28 additions and 0 deletions

View file

View file

@ -0,0 +1,6 @@
from django.apps import AppConfig
class ApiConfig(AppConfig):
default_auto_field = "django.db.models.BigAutoField"
name = "api.schema"

View 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",
),
]