ploop/scripts/export_openapi.py
2026-08-31 20:19:05 +08:00

20 lines
509 B
Python

"""导出 FastAPI 传输层契约,无需配置数据库或服务器。"""
from __future__ import annotations
import json
from pathlib import Path
from ploop.api.app import create_app
def main() -> None:
repository_root = Path(__file__).resolve().parents[1]
output_path = repository_root / "backend" / "openapi.json"
document = json.dumps(create_app().openapi(), indent=2, sort_keys=True) + "\n"
output_path.write_text(document, encoding="utf-8")
if __name__ == "__main__":
main()