Packages

package async

Type Members

  1. 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 action field 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") to Action ("send"/"receive");
    • link OperationModel.Channel to the owning EndPoint;
    • move messages from Operation.Request/Operation.Responses into the channel's Messages field and onto the operation's OperationMessages so 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.

  2. class SplitServerUrlIntoHostAndPathname extends TransformationStep

    Split each Server's 2.x url into the 3.0 host + pathname pair.

    Split each Server's 2.x url into the 3.0 host + pathname pair.

    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 / pathname when present and falls back to url otherwise, 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=/vhost
    • host-only.example.com → host=host-only.example.com, pathname unset

Ungrouped