16 lines
520 B
Python
16 lines
520 B
Python
"""Generate the independent peripheral sample contract without opening a DB."""
|
|
import json
|
|
import sys
|
|
from pathlib import Path
|
|
|
|
ROOT = Path(__file__).resolve().parents[1]
|
|
sys.path.insert(0, str(ROOT))
|
|
|
|
from samples.peripheral.api import app
|
|
|
|
|
|
if __name__ == "__main__":
|
|
target = ROOT / "contracts/peripheral-sample.openapi.json"
|
|
target.write_text(json.dumps(app.openapi(), ensure_ascii=False, indent=2, sort_keys=True) + "\n", encoding="utf-8")
|
|
print(f"Exported {len(app.openapi()['paths'])} sample paths")
|