Add drf-spectacular for OpenAPI schema generation

Closes #2fddd5d0-1138-4a6e-96b7-5879035f033f

drf-spectacular provides OpenAPI 3.0 schema generation for all 52
registered ViewSet endpoints under api/v1/. This is a prerequisite for
auto-generating the Kotlin networking layer.

Changes:
- Add drf-spectacular dependency (0.27.x)
- Register in INSTALLED_APPS and configure DEFAULT_SCHEMA_CLASS
- Add /api/schema/ (OpenAPI YAML) and /api/docs/ (Swagger UI) routes
- Add SPECTACULAR_SETTINGS with enum name overrides to suppress warnings

Schema generates cleanly with 4 non-blocking warnings (1 unique:
TagListSerializerField defaulting to string) and 14 unique skipped
errors (all non-ViewSet APIViews like webhooks that lack serializers).
This commit is contained in:
2026-07-23 20:01:04 -04:00
parent 050fce7ffc
commit cd9961662e
5 changed files with 56 additions and 8 deletions

28
poetry.lock generated
View File

@ -1657,6 +1657,30 @@ files = [
[package.dependencies]
django = ">=4.2"
[[package]]
name = "drf-spectacular"
version = "0.27.2"
description = "Sane and flexible OpenAPI 3 schema generation for Django REST framework"
optional = false
python-versions = ">=3.7"
groups = ["main"]
files = [
{file = "drf-spectacular-0.27.2.tar.gz", hash = "sha256:a199492f2163c4101055075ebdbb037d59c6e0030692fc83a1a8c0fc65929981"},
{file = "drf_spectacular-0.27.2-py3-none-any.whl", hash = "sha256:b1c04bf8b2fbbeaf6f59414b4ea448c8787aba4d32f76055c3b13335cf7ec37b"},
]
[package.dependencies]
Django = ">=2.2"
djangorestframework = ">=3.10.3"
inflection = ">=0.3.1"
jsonschema = ">=2.6.0"
PyYAML = ">=5.1"
uritemplate = ">=2.0.0"
[package.extras]
offline = ["drf-spectacular-sidecar"]
sidecar = ["drf-spectacular-sidecar"]
[[package]]
name = "dulwich"
version = "0.24.1"
@ -4915,7 +4939,7 @@ version = "6.0.3"
description = "YAML parser and emitter for Python"
optional = false
python-versions = ">=3.8"
groups = ["test"]
groups = ["main", "test"]
files = [
{file = "PyYAML-6.0.3-cp38-cp38-macosx_10_13_x86_64.whl", hash = "sha256:c2514fceb77bc5e7a2f7adfaa1feb2fb311607c9cb518dbc378688ec73d8292f"},
{file = "PyYAML-6.0.3-cp38-cp38-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:9c57bb8c96f6d1808c030b1687b9b5fb476abaa47f0db9c0101f5e9f394e97f4"},
@ -6872,4 +6896,4 @@ cffi = ["cffi (>=1.17,<2.0) ; platform_python_implementation != \"PyPy\" and pyt
[metadata]
lock-version = "2.1"
python-versions = ">=3.11,<3.15"
content-hash = "fe85397f7562cd1b81cdf7ab6c82ccab64d760310264e95944de9219731c9ee6"
content-hash = "a40297d1cdc081a926b8189bd1e284a5eb83462e218dc8d17b56dd9679baeea4"