patchwise-agent-studio / coworker /api /openapi_dump.py
EnergyVenom's picture
Astra: security review, left-on-pod ledger, chosen scenarios all run, GL navigation and Create Order popup on 26D, health check (ed9256cd4029)
348eedc verified
Raw History Blame Contribute Delete
769 Bytes
"""Print the API's OpenAPI JSON (used by web/scripts/gen-api.mjs and the drift test). Uses a throwaway FPT_HOME."""
from __future__ import annotations
import json
import sys
def openapi_json() -> str:
from ..tests.fakes import temp_settings
from .app import create_app
from ..graph.services import build_services
import logging
before = logging.root.manager.disable # restored after: a caller in the same process (the test run) keeps its logs
logging.disable(logging.CRITICAL)
try:
app = create_app(build_services(temp_settings()), background=False)
return json.dumps(app.openapi(), indent=1, sort_keys=True)
finally:
logging.disable(before)
if __name__ == "__main__":
sys.stdout.write(openapi_json())