"""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}")