Files
WYGIWYH/app/apps/api/tests/test_schema.py
T
Herculino Trotta a432fae632 fix(api): clear the API docs schema warnings
Describe the API token authentication, name the colliding transaction
type enums, and use nullable instead of an OpenAPI 3.1 null type. A test
keeps the schema free of warnings.
2026-11-14 02:12:16 -03:00

12 lines
453 B
Python

import tempfile
from django.core.management import call_command
from django.test import SimpleTestCase
class SchemaTests(SimpleTestCase):
def test_schema_is_valid_without_warnings(self):
"""Keeps /api/docs/ complete: drf-spectacular warns when it can't describe something."""
with tempfile.NamedTemporaryFile(suffix=".yml") as schema:
call_command("spectacular", "--validate", "--fail-on-warn", "--file", schema.name)