nori_asyncapi/document
AsyncAPI 3.x document model.
Root object of an AsyncAPI spec. Mirrors the parts of the 3.1.0 spec the
generators need: info, servers, channels, operations, components. Message
payloads are kept as raw Dynamic — they are plain JSON Schema and get
handed to nori.parse_schema at IR-build time so the schema engine stays
single-sourced in nori.
Types
Operation action — direction from the application’s point of view.
pub type Action {
Send
Receive
}
Constructors
-
Send -
Receive
Channel object — a named address messages flow over.
pub type Channel {
Channel(
address: option.Option(String),
title: option.Option(String),
summary: option.Option(String),
description: option.Option(String),
messages: dict.Dict(String, MessageOrRef),
parameters: dict.Dict(String, Parameter),
servers: List(String),
)
}
Constructors
-
Channel( address: option.Option(String), title: option.Option(String), summary: option.Option(String), description: option.Option(String), messages: dict.Dict(String, MessageOrRef), parameters: dict.Dict(String, Parameter), servers: List(String), )Arguments
- messages
-
Named messages available on this channel. Value is a message OR a ref.
- parameters
-
Channel-level parameters (address templating, e.g.
{id}). - servers
-
$refstrings of servers this channel is restricted to.
Reusable components. Only the buckets the generators consume are modelled; the rest of the spec’s component buckets are ignored for now.
pub type Components {
Components(
messages: dict.Dict(String, Message),
schemas: dict.Dict(String, dynamic.Dynamic),
channels: dict.Dict(String, Channel),
parameters: dict.Dict(String, Parameter),
)
}
Constructors
The root AsyncAPI object.
pub type Document {
Document(
asyncapi: String,
id: option.Option(String),
info: Info,
default_content_type: option.Option(String),
servers: dict.Dict(String, Server),
channels: dict.Dict(String, Channel),
operations: dict.Dict(String, Operation),
components: Components,
)
}
Constructors
-
Document( asyncapi: String, id: option.Option(String), info: Info, default_content_type: option.Option(String), servers: dict.Dict(String, Server), channels: dict.Dict(String, Channel), operations: dict.Dict(String, Operation), components: Components, )
Info object — API metadata.
pub type Info {
Info(
title: String,
version: String,
description: option.Option(String),
)
}
Constructors
-
Info( title: String, version: String, description: option.Option(String), )
Message object. payload is raw JSON Schema (Dynamic) resolved later.
pub type Message {
Message(
name: option.Option(String),
title: option.Option(String),
summary: option.Option(String),
description: option.Option(String),
content_type: option.Option(String),
payload: option.Option(dynamic.Dynamic),
headers: option.Option(dynamic.Dynamic),
)
}
Constructors
-
Message( name: option.Option(String), title: option.Option(String), summary: option.Option(String), description: option.Option(String), content_type: option.Option(String), payload: option.Option(dynamic.Dynamic), headers: option.Option(dynamic.Dynamic), )
Operation object — an action (send/receive) bound to a channel.
pub type Operation {
Operation(
action: Action,
channel_ref: String,
title: option.Option(String),
summary: option.Option(String),
description: option.Option(String),
message_refs: List(String),
)
}
Constructors
-
Operation( action: Action, channel_ref: String, title: option.Option(String), summary: option.Option(String), description: option.Option(String), message_refs: List(String), )Arguments
- channel_ref
-
$refto the channel this operation acts on. - message_refs
-
$refstrings of the messages this operation carries.
Parameter object — a channel address variable.
pub type Parameter {
Parameter(
description: option.Option(String),
enum_values: List(String),
default: option.Option(String),
location: option.Option(String),
)
}
Constructors
-
Parameter( description: option.Option(String), enum_values: List(String), default: option.Option(String), location: option.Option(String), )
Server object. protocol drives which transport a generator emits.
pub type Server {
Server(
host: String,
protocol: String,
pathname: option.Option(String),
description: option.Option(String),
)
}
Constructors
-
Server( host: String, protocol: String, pathname: option.Option(String), description: option.Option(String), )
Values
pub fn action_from_string(s: String) -> Action
Parse an action string. Unknown values default to Receive (server pushes
nothing) so a malformed spec fails safe rather than emitting a sender.