From 5e2ea7e5c187b32bcfc30e6adb82e1fbef156f79 Mon Sep 17 00:00:00 2001 From: souvik Date: Thu, 16 Nov 2023 14:47:34 +0530 Subject: [PATCH] feat: human readable asyncapi.yaml files --- .../crypto-websockets/client/asyncapi.yaml | 2 +- .../crypto-websockets/server/asyncapi.yaml | 8 +++---- examples/dummy/asyncapi.yaml | 20 ++++++++--------- examples/shrek-websockets/asyncapi.yaml | 22 +++++++++---------- ...ubChatMessage.js => receiveChatMessage.js} | 0 .../websocket-server/asyncapi.yaml | 20 ++++++++--------- 6 files changed, 35 insertions(+), 37 deletions(-) rename examples/shrek-websockets/functions/{pubChatMessage.js => receiveChatMessage.js} (100%) diff --git a/examples/crypto-websockets/client/asyncapi.yaml b/examples/crypto-websockets/client/asyncapi.yaml index 8eca69bee..ee89d5958 100644 --- a/examples/crypto-websockets/client/asyncapi.yaml +++ b/examples/crypto-websockets/client/asyncapi.yaml @@ -18,7 +18,7 @@ channels: price: address: '/price' messages: - index.message: + indexGraph: $ref: '#/components/messages/indexGraph' bindings: ws: diff --git a/examples/crypto-websockets/server/asyncapi.yaml b/examples/crypto-websockets/server/asyncapi.yaml index 5a7c59130..5e06ae0ec 100644 --- a/examples/crypto-websockets/server/asyncapi.yaml +++ b/examples/crypto-websockets/server/asyncapi.yaml @@ -18,10 +18,10 @@ servers: host: 'localhost:4000' protocol: ws channels: - /price: + price: address: /price messages: - subscribe.message: + indexGraph: $ref: '#/components/messages/indexGraph' bindings: ws: @@ -32,10 +32,10 @@ channels: token: type: string operations: - /price.subscribe: + getPrice: action: send channel: - $ref: '#/channels/~1price' + $ref: '#/channels/price' messages: - $ref: '#/components/messages/indexGraph' components: diff --git a/examples/dummy/asyncapi.yaml b/examples/dummy/asyncapi.yaml index dc70a068a..bd309d4d3 100644 --- a/examples/dummy/asyncapi.yaml +++ b/examples/dummy/asyncapi.yaml @@ -20,12 +20,10 @@ servers: pathname: /ws protocol: ws channels: - user/signedup: + userSignedup: address: user/signedup messages: - onUserSignedUp.message: - $ref: '#/components/messages/UserSignedUp' - subscribe.message: + UserSignedUp: $ref: '#/components/messages/UserSignedUp' bindings: ws: @@ -43,16 +41,16 @@ channels: my-custom-header: type: string const: custom value - server/announce: + serverAnnounce: address: server/announce messages: - subscribe.message: + ServerAnnounce: $ref: '#/components/messages/ServerAnnounce' operations: onUserSignedUp: action: receive channel: - $ref: '#/channels/user~1signedup' + $ref: '#/channels/userSignedup' bindings: mqtt: qos: 2 @@ -60,16 +58,16 @@ operations: bindingVersion: 0.2.0 messages: - $ref: '#/components/messages/UserSignedUp' - user/signedup.subscribe: + onUserSignedUpReply: action: send channel: - $ref: '#/channels/user~1signedup' + $ref: '#/channels/userSignedup' messages: - $ref: '#/components/messages/UserSignedUp' - server/announce.subscribe: + announceUserSignedUp: action: send channel: - $ref: '#/channels/server~1announce' + $ref: '#/channels/serverAnnounce' messages: - $ref: '#/components/messages/ServerAnnounce' components: diff --git a/examples/shrek-websockets/asyncapi.yaml b/examples/shrek-websockets/asyncapi.yaml index 9fcaf449c..10130abd7 100644 --- a/examples/shrek-websockets/asyncapi.yaml +++ b/examples/shrek-websockets/asyncapi.yaml @@ -17,37 +17,37 @@ servers: host: localhost protocol: ws channels: - /chat: + chat: address: /chat messages: - pubChatMessage.message: + receiveChatMessage: $ref: '#/components/messages/chatMessage' - subChatMessage.message: + sendChatMessage: $ref: '#/components/messages/chatMessage' - /travel/status: + travelStatus: address: /travel/status messages: - subTravelInfo.message: + subTravelInfo: $ref: '#/components/messages/travelInfo' operations: - pubChatMessage: + recieveChatMessage: action: receive channel: - $ref: '#/channels/~1chat' + $ref: '#/channels/chat' summary: Client can send chat messages. messages: - $ref: '#/components/messages/chatMessage' - subChatMessage: + sendChatMessage: action: send channel: - $ref: '#/channels/~1chat' + $ref: '#/channels/chat' summary: Client can receive chat messages. messages: - $ref: '#/components/messages/chatMessage' - subTravelInfo: + sendTravelInfo: action: send channel: - $ref: '#/channels/~1travel~1status' + $ref: '#/channels/travelStatus' summary: Client can receive travel info status. messages: - $ref: '#/components/messages/travelInfo' diff --git a/examples/shrek-websockets/functions/pubChatMessage.js b/examples/shrek-websockets/functions/receiveChatMessage.js similarity index 100% rename from examples/shrek-websockets/functions/pubChatMessage.js rename to examples/shrek-websockets/functions/receiveChatMessage.js diff --git a/examples/social-network/websocket-server/asyncapi.yaml b/examples/social-network/websocket-server/asyncapi.yaml index 1e75f6a94..cf0b21ab8 100644 --- a/examples/social-network/websocket-server/asyncapi.yaml +++ b/examples/social-network/websocket-server/asyncapi.yaml @@ -13,19 +13,19 @@ servers: mqtt: clientId: the-social-network channels: - /: + index: address: / messages: - onLikeDislike.message: + likeOrDislike: $ref: '#/components/messages/likeOrDislike' - subscribe.message: + likeCountUpdated: $ref: '#/components/messages/likeCountUpdated' servers: - $ref: '#/servers/websockets' - post/liked: + postLiked: address: post/liked messages: - subscribe.message: + notifyPostLiked: $ref: '#/components/messages/notifyPostLiked' servers: - $ref: '#/servers/mosquitto' @@ -33,19 +33,19 @@ operations: onLikeDislike: action: receive channel: - $ref: '#/channels/~1' + $ref: '#/channels/index' messages: - $ref: '#/components/messages/likeOrDislike' - /.subscribe: + onLikeCounted: action: send channel: - $ref: '#/channels/~1' + $ref: '#/channels/index' messages: - $ref: '#/components/messages/likeCountUpdated' - post/liked.subscribe: + notifyPostLiked: action: send channel: - $ref: '#/channels/post~1liked' + $ref: '#/channels/postLiked' messages: - $ref: '#/components/messages/notifyPostLiked' components: