module Schema
Schema-driven validation for Matrix events using the official matrix-org/matrix-spec YAML schemas and the json_schemer gem.
Schemas are loaded lazily from data/matrix-spec/event-schemas/schema/ and cached
for the process lifetime. This ensures validation is always up-to-date with the
spec -- just re-run bin/fetch-matrix-schemas to pull the latest.
Look up a schema by event type
Async::Matrix::Schema["m.room.message"] # => JSONSchemer::Schema
Validate an event hash
Async::Matrix::Schema.valid?(event_hash) # => true/false Async::Matrix::Schema.validate(event_hash) # => [errors]
List all known event types
Async::Matrix::Schema.event_types # => ["m.accepted_terms", "m.call.answer", ...]