nori_asyncapi/codegen/gleam_handlers
Gleam handler-stub generator for AsyncAPI.
Emits one handler-stub function per receive operation, grouped by channel.
receive operations (messages arriving from the client) become handle_*
stubs. send operations are the server’s outgoing messages — encode those
with the send_* functions in the generated server module, not here — so
they contribute nothing to this file. Payload types are referenced by name;
generate them with nori’s Gleam type generator from the same schemas.
Values
pub fn generate(
spec: ir.AsyncCodegenIR,
types_module: String,
) -> String
Generate a .gleam handler-stub module from the IR.
types_module is the import path of the companion types module produced by
generate_gleam_types (e.g. "generated/types"); named payload types are
referenced through its types alias.
pub fn has_handlers(spec: ir.AsyncCodegenIR) -> Bool
Whether this spec produces any handler stubs. False for a send-only spec,
in which case handlers.gleam would be an empty module and should not be
written at all (an empty module warns on gleam build).