ETS-backed registry mapping topic names to their schema modules.
Schemas self-register via @after_compile hooks when you use PhoenixMicro.Schema.
You can also register programmatically:
PhoenixMicro.Schema.Registry.register(MyApp.Events.PaymentCreated)The registry stores multiple versions per topic so you can query the history:
PhoenixMicro.Schema.Registry.versions("payments.created")
# => [{1, MyApp.Events.PaymentCreatedV1}, {2, MyApp.Events.PaymentCreated}]
Summary
Functions
Returns all registered schema modules (deduplicated).
Returns a specification to start this module under a supervisor.
Removes all entries (useful in tests).
Returns the latest-version schema module for a topic.
Returns {:error, :not_found} if no schema is registered.
Registers a schema module under its declared topic and version. Safe to call multiple times (idempotent).
Returns all registered {version, module} pairs for a topic, oldest first.
Functions
@spec all() :: [module()]
Returns all registered schema modules (deduplicated).
Returns a specification to start this module under a supervisor.
See Supervisor.
@spec clear() :: :ok
Removes all entries (useful in tests).
Returns the latest-version schema module for a topic.
Returns {:error, :not_found} if no schema is registered.
@spec register(module()) :: :ok
Registers a schema module under its declared topic and version. Safe to call multiple times (idempotent).
@spec start_link(keyword()) :: GenServer.on_start()
@spec versions(String.t()) :: [{pos_integer(), module()}]
Returns all registered {version, module} pairs for a topic, oldest first.