Skip to content

Commit

Permalink
feat: human readable asyncapi.yaml files
Browse files Browse the repository at this point in the history
  • Loading branch information
Souvikns committed Nov 16, 2023
1 parent 168acc1 commit 5e2ea7e
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 37 deletions.
2 changes: 1 addition & 1 deletion examples/crypto-websockets/client/asyncapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ channels:
price:
address: '/price'
messages:
index.message:
indexGraph:
$ref: '#/components/messages/indexGraph'
bindings:
ws:
Expand Down
8 changes: 4 additions & 4 deletions examples/crypto-websockets/server/asyncapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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:
Expand Down
20 changes: 9 additions & 11 deletions examples/dummy/asyncapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -43,33 +41,33 @@ 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
retain: true
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:
Expand Down
22 changes: 11 additions & 11 deletions examples/shrek-websockets/asyncapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
20 changes: 10 additions & 10 deletions examples/social-network/websocket-server/asyncapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,39 +13,39 @@ 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'
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:
Expand Down

0 comments on commit 5e2ea7e

Please sign in to comment.