diff --git a/packages/templates/clients/websocket/test/__fixtures__/asyncapi-slack-client.yml b/packages/templates/clients/websocket/test/__fixtures__/asyncapi-slack-client.yml index 592389cc6b..c1e1e7f9d1 100644 --- a/packages/templates/clients/websocket/test/__fixtures__/asyncapi-slack-client.yml +++ b/packages/templates/clients/websocket/test/__fixtures__/asyncapi-slack-client.yml @@ -108,6 +108,8 @@ components: messages: event: summary: Event message representing different event types + correlationId: + location: $message.payload#/envelope_id payload: $ref: '#/components/schemas/event' examples: @@ -249,6 +251,8 @@ components: app_id: A08NKKBFGBD acknowledge: summary: Acknowledgement response sent to Server + correlationId: + location: $message.payload#/envelope_id payload: $ref: '#/components/schemas/acknowledge' examples: diff --git a/packages/templates/clients/websocket/test/__fixtures__/reply/asyncapi-postman-both-correlation.yml b/packages/templates/clients/websocket/test/__fixtures__/reply/asyncapi-postman-both-correlation.yml new file mode 100644 index 0000000000..46f487e536 --- /dev/null +++ b/packages/templates/clients/websocket/test/__fixtures__/reply/asyncapi-postman-both-correlation.yml @@ -0,0 +1,66 @@ +asyncapi: 3.0.0 + +info: + title: Postman Echo WebSocket Client with Reply (Both Correlation IDs) + version: 1.0.0 + description: > + Test fixture for reply handling with correlation IDs on both incoming and reply messages. + Template should extract correlation ID from incoming, pass to handler, and auto-inject into reply. + +servers: + echoServer: + host: ws.postman-echo.com + pathname: /raw + protocol: wss + +channels: + echo: + description: The main channel where messages are sent and echoed back by the Postman Echo WebSocket server. + address: / + messages: + echoMessage: + $ref: '#/components/messages/echoMessage' + +operations: + sendEchoMessage: + summary: Send a message to the Postman Echo server and receive a reply. + action: send + channel: + $ref: '#/channels/echo' + messages: + - $ref: '#/channels/echo/messages/echoMessage' + reply: + channel: + $ref: '#/channels/echo' + messages: + - $ref: '#/channels/echo/messages/echoMessage' + +components: + messages: + echoMessage: + summary: A message exchanged with the echo server with correlation ID on both request and reply. + correlationId: + location: $message.payload#/requestId + payload: + type: object + properties: + requestId: + type: string + description: Request identifier (auto-injected into reply) + message: + type: string + description: Message to echo back + timestamp: + type: string + description: Request/reply timestamp + examples: + - name: stringWithId + payload: + requestId: req-12345 + message: test + timestamp: '2025-12-23T10:00:00Z' + - name: objectWithId + payload: + requestId: req-67890 + message: test text + timestamp: '2025-12-23T10:00:00Z' diff --git a/packages/templates/clients/websocket/test/__fixtures__/reply/asyncapi-postman-incoming-correlation.yml b/packages/templates/clients/websocket/test/__fixtures__/reply/asyncapi-postman-incoming-correlation.yml new file mode 100644 index 0000000000..0a421b40a8 --- /dev/null +++ b/packages/templates/clients/websocket/test/__fixtures__/reply/asyncapi-postman-incoming-correlation.yml @@ -0,0 +1,66 @@ +asyncapi: 3.0.0 + +info: + title: Postman Echo WebSocket Client with Reply (Incoming Correlation Only) + version: 1.0.0 + description: > + Test fixture for reply handling with correlation ID only on incoming message. + Template should extract correlation ID and pass to handler, but not auto-inject into reply. + +servers: + echoServer: + host: ws.postman-echo.com + pathname: /raw + protocol: wss + +channels: + echo: + description: The main channel where messages are sent and echoed back by the Postman Echo WebSocket server. + address: / + messages: + echoMessage: + $ref: '#/components/messages/echoMessage' + +operations: + sendEchoMessage: + summary: Send a message to the Postman Echo server and receive a reply. + action: send + channel: + $ref: '#/channels/echo' + messages: + - $ref: '#/channels/echo/messages/echoMessage' + reply: + channel: + $ref: '#/channels/echo' + messages: + - $ref: '#/channels/echo/messages/echoMessage' + +components: + messages: + echoMessage: + summary: A message exchanged with the echo server with correlation ID. + correlationId: + location: $message.payload#/requestId + payload: + type: object + properties: + requestId: + type: string + description: Unique request identifier + message: + type: string + description: Message to echo back + timestamp: + type: string + description: Request timestamp + examples: + - name: stringWithId + payload: + requestId: req-12345 + message: test + timestamp: '2025-12-23T10:00:00Z' + - name: objectWithId + payload: + requestId: req-67890 + message: test text + timestamp: '2025-12-23T10:00:00Z' diff --git a/packages/templates/clients/websocket/test/__fixtures__/reply/asyncapi-postman-no-correlation.yml b/packages/templates/clients/websocket/test/__fixtures__/reply/asyncapi-postman-no-correlation.yml new file mode 100644 index 0000000000..552e147511 --- /dev/null +++ b/packages/templates/clients/websocket/test/__fixtures__/reply/asyncapi-postman-no-correlation.yml @@ -0,0 +1,59 @@ +asyncapi: 3.0.0 + +info: + title: Postman Echo WebSocket Client with Reply (No Correlation) + version: 1.0.0 + description: > + Test fixture for reply handling without correlation IDs. + Postman Echo server replies to incoming messages without any correlation tracking. + +servers: + echoServer: + host: ws.postman-echo.com + pathname: /raw + protocol: wss + +channels: + echo: + description: The main channel where messages are sent and echoed back by the Postman Echo WebSocket server. + address: / + messages: + echoMessage: + $ref: '#/components/messages/echoMessage' + +operations: + sendEchoMessage: + summary: Send a message to the Postman Echo server and receive a reply. + action: send + channel: + $ref: '#/channels/echo' + messages: + - $ref: '#/channels/echo/messages/echoMessage' + reply: + channel: + $ref: '#/channels/echo' + messages: + - $ref: '#/channels/echo/messages/echoMessage' + +components: + messages: + echoMessage: + summary: A message exchanged with the echo server. + payload: + type: object + properties: + message: + type: string + description: Message to echo back + timestamp: + type: string + description: Request timestamp + examples: + - name: string + payload: + message: test + timestamp: '2025-12-23T10:00:00Z' + - name: object + payload: + message: test text + timestamp: '2025-12-23T10:00:00Z' diff --git a/packages/templates/clients/websocket/test/__fixtures__/reply/asyncapi-postman-outgoing-correlation.yml b/packages/templates/clients/websocket/test/__fixtures__/reply/asyncapi-postman-outgoing-correlation.yml new file mode 100644 index 0000000000..3222788f7b --- /dev/null +++ b/packages/templates/clients/websocket/test/__fixtures__/reply/asyncapi-postman-outgoing-correlation.yml @@ -0,0 +1,80 @@ +asyncapi: 3.0.0 + +info: + title: Postman Echo WebSocket Client with Reply (Outgoing Correlation Only) + version: 1.0.0 + description: > + Test fixture for reply handling with correlation ID only on reply message. + Template should log a warning that correlation cannot be populated from incoming message. + +servers: + echoServer: + host: ws.postman-echo.com + pathname: /raw + protocol: wss + +channels: + echo: + description: The main channel where messages are sent and echoed back by the Postman Echo WebSocket server. + address: / + messages: + echoRequest: + $ref: '#/components/messages/echoRequest' + echoReply: + $ref: '#/components/messages/echoReply' + +operations: + sendEchoMessage: + summary: Send a message to the Postman Echo server and receive a reply. + action: send + channel: + $ref: '#/channels/echo' + messages: + - $ref: '#/channels/echo/messages/echoRequest' + reply: + channel: + $ref: '#/channels/echo' + messages: + - $ref: '#/channels/echo/messages/echoReply' + +components: + messages: + echoRequest: + summary: Echo request message without correlation ID. + payload: + type: object + properties: + message: + type: string + description: Message to echo back + timestamp: + type: string + description: Request timestamp + examples: + - name: string + payload: + message: test + timestamp: '2025-12-23T10:00:00Z' + + echoReply: + summary: Echo reply message with correlation ID. + correlationId: + location: $message.payload#/responseId + payload: + type: object + properties: + responseId: + type: string + description: Response identifier (cannot be auto-populated) + echo: + type: string + description: Echoed message + processedAt: + type: string + description: Server processing timestamp + examples: + - name: replyWithId + payload: + responseId: resp-67890 + echo: test + processedAt: '2025-12-23T10:00:01Z'