- 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.
42 lines
1.4 KiB
Python
42 lines
1.4 KiB
Python
"""URL configuration for the HOMM backend."""
|
|
from django.conf import settings
|
|
from django.conf.urls.static import static
|
|
from django.contrib import admin
|
|
from django.urls import include, path
|
|
from drf_spectacular.views import (
|
|
SpectacularAPIView,
|
|
SpectacularRedocView,
|
|
SpectacularSwaggerView,
|
|
)
|
|
|
|
admin.site.site_header = "HOMM — управление магазином"
|
|
admin.site.site_title = "HOMM Admin"
|
|
admin.site.index_title = "Панель управления"
|
|
admin.site.index_template = "admin/homm_index.html"
|
|
|
|
urlpatterns = [
|
|
path("admin/", admin.site.urls),
|
|
path("api/v1/", include("apps.common.urls")),
|
|
path("api/v1/auth/", include("apps.accounts.urls")),
|
|
path("api/v1/catalog/", include("apps.catalog.urls")),
|
|
path("api/v1/orders/", include("apps.orders.urls")),
|
|
path("api/v1/loyalty/", include("apps.loyalty.urls")),
|
|
path("api/v1/content/", include("apps.content.urls")),
|
|
path("api/v1/payments/", include("apps.payments.urls")),
|
|
path("api/v1/integration/1c/", include("apps.integration.urls")),
|
|
path("api/schema/", SpectacularAPIView.as_view(), name="schema"),
|
|
path(
|
|
"api/docs/",
|
|
SpectacularSwaggerView.as_view(url_name="schema"),
|
|
name="swagger-ui",
|
|
),
|
|
path(
|
|
"api/redoc/",
|
|
SpectacularRedocView.as_view(url_name="schema"),
|
|
name="redoc",
|
|
),
|
|
]
|
|
|
|
if settings.DEBUG:
|
|
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
|