Files
openclaw/workspace/james/lib/schema.py
Clawd Bot ca9b510922 chore: align with upstream openclaw/openclaw and overlay local additions
- 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>
2026-03-03 07:40:46 +01:00

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)