File size: 681 Bytes
d4d0bc7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
"""Export the FastAPI OpenAPI schema to openapi.json."""
import json
import sys
import os

sys.path.insert(0, os.path.dirname(os.path.dirname(__file__)))
os.environ.setdefault("JWT_SECRET_KEY", "export-script")
os.environ.setdefault("DISABLE_RATE_LIMIT", "1")

from backend.main import app
from backend.changelog import router as changelog_router

# Include the changelog router so it appears in the exported schema
try:
    app.include_router(changelog_router)
except Exception:
    pass  # already included

schema = app.openapi()
output = "openapi.json"
with open(output, "w") as f:
    json.dump(schema, f, indent=2)
print(f"Exported {len(schema['paths'])} paths to {output}")