- Reset master to upstream/main (16,697 commits) - Overlay 2,271 local-only files (skills, tools, workspace, configs, apps) - Restore IDENTITY.md and USER.md templates - Build verified, gateway running, Discord working Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
22 lines
570 B
Python
22 lines
570 B
Python
import json
|
|
import os
|
|
from pathlib import Path
|
|
|
|
|
|
def _schema_path() -> Path:
|
|
base = Path(__file__).resolve().parents[1]
|
|
return base / "schemas" / "event.json"
|
|
|
|
|
|
def validate_event(event: dict) -> None:
|
|
if os.environ.get("JAMES_VALIDATE_SCHEMA", "1") != "1":
|
|
return
|
|
|
|
try:
|
|
import jsonschema
|
|
except Exception as exc: # pragma: no cover - runtime guard
|
|
raise RuntimeError(f"jsonschema is required for validation: {exc}")
|
|
|
|
schema = json.loads(_schema_path().read_text())
|
|
jsonschema.validate(instance=event, schema=schema)
|