Start Core Hub FastAPI replacement foundation
This commit is contained in:
parent
75963233b6
commit
1e87adbcbb
37 changed files with 3292 additions and 30 deletions
23
scripts/export_openapi.py
Normal file
23
scripts/export_openapi.py
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
import json
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[1]
|
||||
sys.path.insert(0, str(ROOT / "src"))
|
||||
|
||||
from core_hub.app import create_app # noqa: E402
|
||||
|
||||
|
||||
def main() -> int:
|
||||
target = Path(sys.argv[1]) if len(sys.argv) > 1 else None
|
||||
payload = json.dumps(create_app().openapi(), indent=2, sort_keys=True) + "\n"
|
||||
if target:
|
||||
target.parent.mkdir(parents=True, exist_ok=True)
|
||||
target.write_text(payload, encoding="utf-8")
|
||||
else:
|
||||
sys.stdout.write(payload)
|
||||
return 0
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
raise SystemExit(main())
|
||||
Loading…
Add table
Add a link
Reference in a new issue