package async
Type Members
-
class
LiftChannelOperationsToTopLevel extends TransformationStep
Lift each 2.x channel-nested publish/subscribe operation into a 3.0 top-level operation, with messages moved onto the channel.
Lift each 2.x channel-nested publish/subscribe operation into a 3.0 top-level operation, with messages moved onto the channel.
The 3.0 model places operations under AsyncApiModel.Operations (not under each EndPoint), uses an
actionfield instead of the YAML key (publish/subscribe), stores messages on EndPointModel.Messages, and references them from each operation via OperationModel.OperationMessages.For each channel-level operation we:
- flip
Method("publish"/"subscribe") toAction("send"/"receive"); - link OperationModel.Channel to the owning EndPoint;
- move messages from
Operation.Request/Operation.Responsesinto the channel'sMessagesfield and onto the operation'sOperationMessagesso the 3.0 emitter references them via#/channels/<id>/messages/<name>; - clear the 2.x-only fields on the operation (
Method,Request,Responses).
The collected operations are written to AsyncApiModel.Operations and EndPointModel.Operations is cleared on each channel.
- flip
-
class
SplitServerUrlIntoHostAndPathname extends TransformationStep
Split each Server's 2.x
urlinto the 3.0host+pathnamepair.Split each Server's 2.x
urlinto the 3.0host+pathnamepair.AsyncAPI 2.x stores the broker URL on a single field; the 3.0 spec splits it into the host portion (DNS or IP plus optional port) and the pathname portion. The 3.0 server emitter emits
host/pathnamewhen present and falls back tourlotherwise, so populating both fields here makes the converted document validate as 3.0.Heuristic: drop the optional
<scheme>://prefix, then split on the first/.kafka.example.com:9092/{env}→ host=kafka.example.com:9092, pathname=/{env}amqp://broker/vhost→ host=broker, pathname=/vhosthost-only.example.com→ host=host-only.example.com, pathname unset