Class AsyncApiDocumentBuilder

Namespace
Kuestenlogik.Bowire.AsyncApi
Assembly
Kuestenlogik.Bowire.AsyncApi.dll

Inverse of Kuestenlogik.Bowire.AsyncApi.AsyncApiDocumentLoader: emits an AsyncAPI 3.0 document (YAML by default, JSON optional) from a Bowire discovery result. Pair this with a workbench-side "Export AsyncAPI" action or the bowire export asyncapi CLI to capture the topology of a running MQTT / NATS / Kafka / WebSocket / AMQP target as a schema artifact teams can check into their docs repo and feed back into Bowire as a discovery source.

public static class AsyncApiDocumentBuilder
Inheritance
AsyncApiDocumentBuilder
Inherited Members

Remarks

Pure transformation — no IO, no wire-plugin lookup. Takes a server URL plus a list of BowireServiceInfo records the caller already discovered through whichever plugin owns that URL. The exporter then groups, maps, and serialises:

  • servers[default] — host + protocol parsed from the URL (mqtt / nats / kafka / ws / wss / amqp / amqp1 / http / https).
  • channels[<safeId>] — one per Bowire method deduplicated by address; address = the method name (which is the topic / subject / endpoint path on every messaging plugin).
  • operations[<safeId>] — one per method: publish / produce-style → send; subscribe / consume-style → receive. Method-shape ServerStreaming is the secondary tie- breaker for protocols whose verb doesn't show up in the method's FullName.
  • components.messages[<safeId>] — one per unique BowireMessageInfo referenced by any method's input or output; payload is a synthesised JSON Schema built from the message's BowireFieldInfo list.

The bindings emitted on a channel match the binding-resolver keys Phase A/B/C ships (mqtt / mqtt5 / kafka / ws / amqp / amqp1 / nats / http) so a round-trip — export → re-load → discover — lands the same channels back, just with the bindings as data on the document instead of inferred from the plugin's URL scheme.

Methods

Build(string, IReadOnlyList<BowireServiceInfo>, BowireRecording?, AsyncApiExportOptions?)

Build an AsyncAPI 3.0 document from a discovery result.

public static string Build(string serverUrl, IReadOnlyList<BowireServiceInfo> services, BowireRecording? recording = null, AsyncApiExportOptions? options = null)

Parameters

serverUrl string

The URL the discovery was performed against.

services IReadOnlyList<BowireServiceInfo>

Services returned by the wire plugin's DiscoverAsync.

recording BowireRecording

Optional recording — when supplied, every operation gets an x-bowire-coverage extension reporting how many steps the recording carries for that channel address. Sibling of the REST exporter's coverage path (matched there by (HttpVerb, HttpPath); here by channel address because messaging steps don't carry HTTP identifiers).

options AsyncApiExportOptions

Optional output knobs (format, info-title, info-version). When null, defaults to YAML output, title = host name, version = "1.0.0".

Returns

string