微信小程序页面迁移校验之前 P5任务处理之前
This commit is contained in:
12
scripts/ops/_export_openapi.py
Normal file
12
scripts/ops/_export_openapi.py
Normal file
@@ -0,0 +1,12 @@
|
||||
"""从运行中的 FastAPI app 导出 OpenAPI spec 到 docs/contracts/openapi/backend-api.json"""
|
||||
import json
|
||||
import pathlib
|
||||
import sys
|
||||
|
||||
sys.path.insert(0, str(pathlib.Path(__file__).resolve().parents[2] / "apps" / "backend"))
|
||||
from app.main import app
|
||||
|
||||
spec = app.openapi()
|
||||
out = pathlib.Path(r"C:\NeoZQYY\docs\contracts\openapi\backend-api.json")
|
||||
out.write_text(json.dumps(spec, ensure_ascii=False, indent=2), encoding="utf-8")
|
||||
print(f"Done: {len(spec['paths'])} paths, {len(spec['components']['schemas'])} schemas")
|
||||
Reference in New Issue
Block a user