Document the API in Swagger with tags, parameters and examples

- Add OpenAPI tags for the seven API groups and a full description
  (auth, error envelope, pagination, idempotency) in SPECTACULAR_SETTINGS
- Annotate every endpoint with @extend_schema: summary, description,
  query parameters, request/response examples and error responses
- Add shared schema helpers in apps/common/schema.py: ErrorEnvelope,
  error_responses(), pagination and catalog filter parameters
- Document JWT login and token refresh that simplejwt ships without docs
- Add ReDoc at /api/redoc/ next to Swagger UI at /api/docs/
- Add export_api_docs management command rendering the schema into a
  standalone HTML reference (no CDN) and commit docs/api-reference.html
- Describe the documentation entry points in docs/architecture.md

Schema validates cleanly: 41 operations, 0 warnings.
This commit is contained in:
apuc committed 2026-11-22 22:06:21 +03:00
1 parent 756f40353b
commit f6c61ff8da
14 files changed
+2038 -9

No files matched your search

+11 -4
View File
@@ -1,8 +1,15 @@
from django.urls import include, path
from rest_framework.routers import DefaultRouter
from rest_framework_simplejwt.views import TokenObtainPairView, TokenRefreshView
from .views import AddressViewSet, MeView, OtpRequestView, OtpVerifyView, PasswordSetView
from .views import (
AddressViewSet,
MeView,
OtpRequestView,
OtpVerifyView,
PasswordSetView,
PhoneTokenObtainView,
PhoneTokenRefreshView,
)
router = DefaultRouter()
router.register("addresses", AddressViewSet, basename="address")
@@ -10,8 +17,8 @@ router.register("addresses", AddressViewSet, basename="address")
urlpatterns = [
path("otp/request/", OtpRequestView.as_view(), name="otp-request"),
path("otp/verify/", OtpVerifyView.as_view(), name="otp-verify"),
path("token/", TokenObtainPairView.as_view(), name="token-obtain"),
path("token/refresh/", TokenRefreshView.as_view(), name="token-refresh"),
path("token/", PhoneTokenObtainView.as_view(), name="token-obtain"),
path("token/refresh/", PhoneTokenRefreshView.as_view(), name="token-refresh"),
path("me/", MeView.as_view(), name="me"),
path("password/", PasswordSetView.as_view(), name="password-set"),
path("", include(router.urls)),