Mojentic.Realtime.Schemas (Mojentic v1.5.0)

Copy Markdown View Source

Schema catalogue for OpenAI Realtime API server events.

Documents the required fields for each known event type. The parse_server_event/1 function normalises missing-type payloads and passes all recognised and unknown events through verbatim — the live path in Session pattern-matches event types directly, so no hard validation is needed here.

Callers that need to validate a payload in tests can use valid?/1 to check that required fields are present.

Schema snapshot: OpenAI Realtime API beta circa 2026-05.

Summary

Functions

List the event types this module recognises.

Normalise a raw server-event map: ensures a "type" key is present.

Returns true when a recognised event's required fields are all present.

Functions

known_types()

List the event types this module recognises.

parse_server_event(raw)

Normalise a raw server-event map: ensures a "type" key is present.

  • Maps without a "type" key are tagged %{"type" => "unknown"}.
  • All other maps are returned verbatim — unknown event types from provider drift pass through so callers can still consume them.

valid?(raw)

Returns true when a recognised event's required fields are all present.

Unknown event types (not in the schema catalogue) always return true so callers don't need to guard against future provider additions.