Files
MobilityOps-Public/scripts/generate-openapi.py
T

16 lines
362 B
Python

#!/usr/bin/env python3
"""Regenerate the deterministic checked-in FastAPI OpenAPI contract."""
from pathlib import Path
import yaml
from app.main import app
target = Path(__file__).resolve().parents[1] / "contracts/openapi.yaml"
target.write_text(
yaml.safe_dump(app.openapi(), sort_keys=False, allow_unicode=True),
encoding="utf-8",
)
print(target)