generated from coulomb/repo-seed
Phase 0 contracts (event envelope, ActivityDefinition, idempotency doc, naming conventions) and Phase 1 Temporal cluster setup (docker-compose.dev.yml, Temporal dynamic config) are complete. Includes Pydantic models, JSON schemas, wiki architecture docs, and ADR-001 workplan files for both workstreams. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
36 lines
850 B
Python
36 lines
850 B
Python
#!/usr/bin/env python3
|
|
"""
|
|
Export JSON Schemas for the core domain models.
|
|
|
|
Usage:
|
|
python scripts/export_schemas.py
|
|
|
|
Output:
|
|
schemas/event-envelope.json
|
|
schemas/activity-definition.json
|
|
|
|
Run this whenever models.py changes.
|
|
"""
|
|
|
|
import json
|
|
from pathlib import Path
|
|
|
|
from activity_core.models import ActivityDefinition, EventEnvelope
|
|
|
|
SCHEMAS_DIR = Path(__file__).parent.parent / "schemas"
|
|
SCHEMAS_DIR.mkdir(exist_ok=True)
|
|
|
|
|
|
def export(model, filename: str) -> None:
|
|
schema = model.model_json_schema()
|
|
path = SCHEMAS_DIR / filename
|
|
path.write_text(json.dumps(schema, indent=2))
|
|
print(f" wrote {path.relative_to(Path.cwd())}")
|
|
|
|
|
|
if __name__ == "__main__":
|
|
print("Exporting JSON schemas...")
|
|
export(EventEnvelope, "event-envelope.json")
|
|
export(ActivityDefinition, "activity-definition.json")
|
|
print("Done.")
|