"""Write docs/coach_input.schema.json and docs/coach_note.schema.json from the pydantic models.""" import json from pathlib import Path from ai_coach.schemas import CoachInput, CoachNote DOCS = Path(__file__).resolve().parents[1] / "docs" def render(model) -> str: return json.dumps(model.model_json_schema(), indent=2, sort_keys=True) + "\n" if __name__ == "__main__": DOCS.mkdir(exist_ok=True) (DOCS / "coach_input.schema.json").write_text(render(CoachInput), encoding="utf-8") (DOCS / "coach_note.schema.json").write_text(render(CoachNote), encoding="utf-8") print("schemas written")