현재 작업 전체 반영
This commit is contained in:
parent
5560638e54
commit
c0dddab594
85 changed files with 11322 additions and 539 deletions
28
apps/api/scripts/export-openapi.py
Normal file
28
apps/api/scripts/export-openapi.py
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
"""Export the FastAPI OpenAPI schema as deterministic JSON."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import argparse
|
||||
import json
|
||||
from pathlib import Path
|
||||
import sys
|
||||
|
||||
sys.path.insert(0, str(Path(__file__).resolve().parents[1]))
|
||||
from app.main import app
|
||||
|
||||
|
||||
def main() -> None:
|
||||
parser = argparse.ArgumentParser(description="Export Vignette API OpenAPI JSON.")
|
||||
parser.add_argument("output", type=Path, help="Output JSON path")
|
||||
args = parser.parse_args()
|
||||
|
||||
schema = app.openapi()
|
||||
args.output.parent.mkdir(parents=True, exist_ok=True)
|
||||
args.output.write_text(
|
||||
json.dumps(schema, ensure_ascii=False, indent=2, sort_keys=True) + "\n",
|
||||
encoding="utf-8",
|
||||
)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Loading…
Add table
Add a link
Reference in a new issue