nori_asyncapi/ir

Language-agnostic codegen IR for AsyncAPI.

The async counterpart to nori’s CodegenIR. Payload/header shapes reuse nori’s TypeDef / TypeRef verbatim, so a message payload and a REST response body share one type model and one downstream emitter vocabulary.

Types

Direction from the application’s point of view.

pub type Action {
  Send
  Receive
}

Constructors

  • Send
  • Receive

Everything a generator needs to emit channel / message code.

pub type AsyncCodegenIR {
  AsyncCodegenIR(
    title: String,
    version: String,
    default_content_type: option.Option(String),
    servers: List(ServerIR),
    types: List(ir.TypeDef),
    channels: List(ChannelIR),
  )
}

Constructors

  • AsyncCodegenIR(
      title: String,
      version: String,
      default_content_type: option.Option(String),
      servers: List(ServerIR),
      types: List(ir.TypeDef),
      channels: List(ChannelIR),
    )

    Arguments

    types

    Named payload/header types, reusing nori’s IR type model.

A channel with the operations that act on it.

pub type ChannelIR {
  ChannelIR(
    name: String,
    address: String,
    description: option.Option(String),
    parameters: List(ChannelParam),
    operations: List(OperationIR),
  )
}

Constructors

A channel address variable, e.g. the {id} in lobby/{id}/chat.

pub type ChannelParam {
  ChannelParam(
    name: String,
    description: option.Option(String),
    enum_values: List(String),
  )
}

Constructors

  • ChannelParam(
      name: String,
      description: option.Option(String),
      enum_values: List(String),
    )

A message: a name plus a reference into types for its payload.

pub type MessageIR {
  MessageIR(
    name: String,
    content_type: option.Option(String),
    payload: ir.TypeRef,
    description: option.Option(String),
  )
}

Constructors

  • MessageIR(
      name: String,
      content_type: option.Option(String),
      payload: ir.TypeRef,
      description: option.Option(String),
    )

    Arguments

    payload

    Reference into AsyncCodegenIR.types, or an inline primitive/array.

An operation: a direction plus the messages it carries.

pub type OperationIR {
  OperationIR(
    operation_id: String,
    action: Action,
    description: option.Option(String),
    messages: List(MessageIR),
  )
}

Constructors

Transports a generator knows how to emit. Anything else lands in Other.

pub type Protocol {
  Ws
  Wss
  Sse
  Http
  Https
  Kafka
  Nats
  Mqtt
  Amqp
  Other(String)
}

Constructors

  • Ws
  • Wss
  • Sse
  • Http
  • Https
  • Kafka
  • Nats
  • Mqtt
  • Amqp
  • Other(String)

A server with its resolved transport protocol.

pub type ServerIR {
  ServerIR(
    name: String,
    host: String,
    pathname: option.Option(String),
    protocol: Protocol,
  )
}

Constructors

Search Document