#!/usr/bin/env python3 """Regenerate the OpenAPI baseline. Run this ONLY when you have intentionally made an additive API change and want the contract test to pick up the new baseline. Removing or renaming anything is a breaking change and requires updating every consumer in the same change set. Usage: python tests/contracts/regenerate_baseline.py """ from __future__ import annotations import json import sys from pathlib import Path THIS_DIR = Path(__file__).parent REPO_ROOT = THIS_DIR.parent.parent # backend-compliance/ sys.path.insert(0, str(REPO_ROOT)) from main import app # type: ignore[import-not-found] # noqa: E402 out = THIS_DIR / "openapi.baseline.json" out.write_text(json.dumps(app.openapi(), indent=2, sort_keys=True) + "\n") print(f"wrote {out}")