ploop/scripts/export_openapi.py

20 lines
519 B
Python

"""Export the FastAPI transport contract without configuring a database or server."""
from __future__ import annotations
import json
from pathlib import Path
from ploop.api.app import create_app
def main() -> None:
repository_root = Path(__file__).resolve().parents[1]
output_path = repository_root / "backend" / "openapi.json"
document = json.dumps(create_app().openapi(), indent=2, sort_keys=True) + "\n"
output_path.write_text(document, encoding="utf-8")
if __name__ == "__main__":
main()