From 5b3f0f99fb5dec1c768e43993bd4d1c6ce5d2da1 Mon Sep 17 00:00:00 2001 From: derberg Date: Tue, 10 Oct 2023 13:20:04 +0200 Subject: [PATCH 1/3] docs: update examples to be written by human not converter --- examples/README.md | 12 +- ... => adeo-kafka-request-reply-asyncapi.yml} | 0 examples/{anyof.yml => anyof-asyncapi.yml} | 2 +- ...s.yml => application-headers-asyncapi.yml} | 9 +- ...ion-id.yml => correlation-id-asyncapi.yml} | 16 ++- ...ming.yml => gitter-streaming-asyncapi.yml} | 36 +++--- ...eply-message-filter-in-reply-asyncapi.yml} | 63 ++++++++--- ...uest-reply-multiple-channels-asyncapi.yml} | 42 +++++-- .../{mercure.yml => mercure-asyncapi.yml} | 14 +-- examples/{not.yml => not-asyncapi.yml} | 0 examples/{oneof.yml => oneof-asyncapi.yml} | 0 ...ty.yml => operation-security-asyncapi.yml} | 13 +-- ...rpc-client.yml => rpc-client-asyncapi.yml} | 16 +-- ...rpc-server.yml => rpc-server-asyncapi.yml} | 16 +-- examples/{simple.yml => simple-asyncapi.yml} | 10 +- .../{slack-rtm.yml => slack-rtm-asyncapi.yml} | 104 +++++++++--------- examples/social-media/backend/asyncapi.yaml | 42 +++---- .../comments-service/asyncapi.yaml | 24 ++-- examples/social-media/frontend/asyncapi.yaml | 26 ++--- .../notification-service/asyncapi.yaml | 12 +- .../social-media/public-api/asyncapi.yaml | 12 +- ...ka.yml => streetlights-kafka-asyncapi.yml} | 27 ++--- ...qtt.yml => streetlights-mqtt-asyncapi.yml} | 28 ++--- ...eetlights-operation-security-asyncapi.yml} | 27 ++--- ...mini.yml => websocket-gemini-asyncapi.yml} | 10 +- 25 files changed, 304 insertions(+), 257 deletions(-) rename examples/{adeo-kafka-request-reply.yml => adeo-kafka-request-reply-asyncapi.yml} (100%) rename examples/{anyof.yml => anyof-asyncapi.yml} (96%) rename examples/{application-headers.yml => application-headers-asyncapi.yml} (89%) rename examples/{correlation-id.yml => correlation-id-asyncapi.yml} (93%) rename examples/{gitter-streaming.yml => gitter-streaming-asyncapi.yml} (89%) rename examples/{kraken-websocket-request-reply-message-filter-in-reply.yml => kraken-websocket-request-reply-message-filter-in-reply-asyncapi.yml} (88%) rename examples/{kraken-websocket-request-reply-multiple-channels.yml => kraken-websocket-request-reply-multiple-channels-asyncapi.yml} (92%) rename examples/{mercure.yml => mercure-asyncapi.yml} (79%) rename examples/{not.yml => not-asyncapi.yml} (100%) rename examples/{oneof.yml => oneof-asyncapi.yml} (100%) rename examples/{operation-security.yml => operation-security-asyncapi.yml} (96%) rename examples/{rpc-client.yml => rpc-client-asyncapi.yml} (80%) rename examples/{rpc-server.yml => rpc-server-asyncapi.yml} (81%) rename examples/{simple.yml => simple-asyncapi.yml} (79%) rename examples/{slack-rtm.yml => slack-rtm-asyncapi.yml} (94%) rename examples/{streetlights-kafka.yml => streetlights-kafka-asyncapi.yml} (88%) rename examples/{streetlights-mqtt.yml => streetlights-mqtt-asyncapi.yml} (91%) rename examples/{streetlights-operation-security.yml => streetlights-operation-security-asyncapi.yml} (90%) rename examples/{websocket-gemini.yml => websocket-gemini-asyncapi.yml} (98%) diff --git a/examples/README.md b/examples/README.md index b706d2482..a13a22ee5 100644 --- a/examples/README.md +++ b/examples/README.md @@ -2,4 +2,14 @@ In this directory, you can find some examples of AsyncAPI documents. -**Do you have an example that could be valuable?** Open a pull request to contribute it. \ No newline at end of file +**Do you have an example that could be valuable?** Open a pull request to contribute it. + +## File naming + +You may notice `asyncapi` in the the name of each example. We recommend doing the same with your AsyncAPI document. This way you enable features like documentation display on node hover, auto completion and validation of your AsyncAPI documents in IDEs like VSCode or IntelliJ IDEA. IDEs integrate with [SchemaStore](https://www.schemastore.org/json/) where AsyncAPI specification JSON Schema files are referenced. Some IDEs do it by default, some, like VSCode require you to install additional extensions, like `YAML` extension. + +## Editors + +To edit your AsyncAPI documents, you can use [AsyncAPI Studio](https://studio.asyncapi.com/). + +If you prefer to use your favourite IDE, there are official extensions for [VSCode](https://marketplace.visualstudio.com/items?itemName=asyncapi.asyncapi-preview) and [IntelliJ IDEA](https://plugins.jetbrains.com/plugin/15673-asyncapi) \ No newline at end of file diff --git a/examples/adeo-kafka-request-reply.yml b/examples/adeo-kafka-request-reply-asyncapi.yml similarity index 100% rename from examples/adeo-kafka-request-reply.yml rename to examples/adeo-kafka-request-reply-asyncapi.yml diff --git a/examples/anyof.yml b/examples/anyof-asyncapi.yml similarity index 96% rename from examples/anyof.yml rename to examples/anyof-asyncapi.yml index 97492ed99..519a03ab2 100644 --- a/examples/anyof.yml +++ b/examples/anyof-asyncapi.yml @@ -33,4 +33,4 @@ components: type: object properties: key2: - type: string + type: string \ No newline at end of file diff --git a/examples/application-headers.yml b/examples/application-headers-asyncapi.yml similarity index 89% rename from examples/application-headers.yml rename to examples/application-headers-asyncapi.yml index 2c397f5ed..1c6b10269 100644 --- a/examples/application-headers.yml +++ b/examples/application-headers-asyncapi.yml @@ -20,10 +20,10 @@ servers: - '1883' - '8883' channels: - 'smartylighting/streetlights/1/0/event/{streetlightId}/lighting/measured': + lightingMeasured: address: 'smartylighting/streetlights/1/0/event/{streetlightId}/lighting/measured' messages: - receiveLightMeasurement.message: + lightMeasured: $ref: '#/components/messages/lightMeasured' parameters: streetlightId: @@ -32,8 +32,7 @@ operations: receiveLightMeasurement: action: receive channel: - $ref: >- - #/channels/smartylighting~1streetlights~11~10~1event~1{streetlightId}~1lighting~1measured + $ref: '#/channels/lightingMeasured' summary: >- Inform about environmental lighting conditions of a particular streetlight. @@ -84,4 +83,4 @@ components: type: string parameters: streetlightId: - description: The ID of the streetlight. + description: The ID of the streetlight. \ No newline at end of file diff --git a/examples/correlation-id.yml b/examples/correlation-id-asyncapi.yml similarity index 93% rename from examples/correlation-id.yml rename to examples/correlation-id-asyncapi.yml index 41309194a..5836509b5 100644 --- a/examples/correlation-id.yml +++ b/examples/correlation-id-asyncapi.yml @@ -56,18 +56,18 @@ servers: - 'streetlights:dim' - $ref: '#/components/securitySchemes/openIdConnectWellKnown' channels: - 'smartylighting/streetlights/1/0/event/{streetlightId}/lighting/measured': + lightingMeasured: address: 'smartylighting/streetlights/1/0/event/{streetlightId}/lighting/measured' messages: - receiveLightMeasurement.message: + lightMeasured: $ref: '#/components/messages/lightMeasured' parameters: streetlightId: $ref: '#/components/parameters/streetlightId' - 'smartylighting/streetlights/1/0/action/{streetlightId}/dim': + lightsDim: address: 'smartylighting/streetlights/1/0/action/{streetlightId}/dim' messages: - dimLight.message: + dimLight: $ref: '#/components/messages/dimLight' parameters: streetlightId: @@ -76,8 +76,7 @@ operations: receiveLightMeasurement: action: receive channel: - $ref: >- - #/channels/smartylighting~1streetlights~11~10~1event~1{streetlightId}~1lighting~1measured + $ref: '#/channels/lightingMeasured' summary: >- Inform about environmental lighting conditions of a particular streetlight. @@ -86,8 +85,7 @@ operations: dimLight: action: send channel: - $ref: >- - #/channels/smartylighting~1streetlights~11~10~1action~1{streetlightId}~1dim + $ref: '#/channels/lightsDim' messages: - $ref: '#/components/messages/dimLight' components: @@ -179,4 +177,4 @@ components: 'streetlights:dim': Ability to dim the lights openIdConnectWellKnown: type: openIdConnect - openIdConnectUrl: 'https://authserver.example/.well-known' + openIdConnectUrl: 'https://authserver.example/.well-known' \ No newline at end of file diff --git a/examples/gitter-streaming.yml b/examples/gitter-streaming-asyncapi.yml similarity index 89% rename from examples/gitter-streaming.yml rename to examples/gitter-streaming-asyncapi.yml index cb987bbcb..5a8704f2d 100644 --- a/examples/gitter-streaming.yml +++ b/examples/gitter-streaming-asyncapi.yml @@ -12,12 +12,12 @@ servers: security: - $ref: '#/components/securitySchemes/httpBearerToken' channels: - '/rooms/{roomId}/{resource}': + rooms: address: '/rooms/{roomId}/{resource}' messages: - subscribe.message.0: + chatMessage: $ref: '#/components/messages/chatMessage' - subscribe.message.1: + heartbeat: $ref: '#/components/messages/heartbeat' parameters: roomId: @@ -30,10 +30,10 @@ channels: - events description: The resource to consume. operations: - '/rooms/{roomId}/{resource}.subscribe': + sendRoomInfo: action: send channel: - $ref: '#/channels/~1rooms~1{roomId}~1{resource}' + $ref: '#/channels/rooms' bindings: http: type: response @@ -148,7 +148,15 @@ components: description: Stands for "Gravatar version" and is used for cache busting. bindings: http: - $ref: '#/components/messageBindings/streamingHeaders' + headers: + type: object + properties: + Transfer-Encoding: + type: string + const: chunked + Trailer: + type: string + const: \r\n heartbeat: summary: Its purpose is to keep the connection alive. payload: @@ -159,10 +167,12 @@ components: - "\r\n" bindings: http: - $ref: '#/components/messageBindings/streamingHeaders' - messageBindings: - streamingHeaders: - http: - headers: - Transfer-Encoding: chunked - Trailer: \r\n + headers: + type: object + properties: + Transfer-Encoding: + type: string + const: chunked + Trailer: + type: string + const: \r\n \ No newline at end of file diff --git a/examples/kraken-websocket-request-reply-message-filter-in-reply.yml b/examples/kraken-websocket-request-reply-message-filter-in-reply-asyncapi.yml similarity index 88% rename from examples/kraken-websocket-request-reply-message-filter-in-reply.yml rename to examples/kraken-websocket-request-reply-message-filter-in-reply-asyncapi.yml index 932f02274..7ca161506 100644 --- a/examples/kraken-websocket-request-reply-message-filter-in-reply.yml +++ b/examples/kraken-websocket-request-reply-message-filter-in-reply-asyncapi.yml @@ -36,28 +36,36 @@ channels: $ref: '#/components/messages/subscribe' unsubscribe: $ref: '#/components/messages/unsubscribe' + dummyCurrencyInfo: + $ref: '#/components/messages/dummyCurrencyInfo' operations: - pingPong: - action: send + receivePing: + action: receive channel: $ref: '#/channels/currencyExchange' reply: channel: $ref: '#/channels/currencyExchange' messages: - - $ref: '#/components/messages/ping' - heartbeat: - action: receive + - $ref: '#/components/messages/pong' + messages: + - $ref: '#/components/messages/ping' + sendHeartbeat: + action: send channel: - $ref: '#/channels/currencyExchange' + $ref: '#/channels/currencyExchange' + messages: + - $ref: '#/components/messages/heartbeat' systemStatus: - action: receive - channel: - $ref: '#/channels/currencyExchange' - subscribe: action: send + channel: + $ref: '#/channels/currencyExchange' + messages: + - $ref: '#/components/messages/systemStatus' + receiveSubscribeRequest: + action: receive channel: $ref: '#/channels/currencyExchange' reply: @@ -65,8 +73,11 @@ operations: $ref: '#/channels/currencyExchange' messages: - $ref: '#/components/messages/subscriptionStatus' - unsubscribe: - action: send + - $ref: '#/components/messages/dummyCurrencyInfo' + messages: + - $ref: '#/components/messages/subscribe' + receiveUnsubscribeRequest: + action: receive channel: $ref: '#/channels/currencyExchange' reply: @@ -74,17 +85,37 @@ operations: $ref: '#/channels/currencyExchange' messages: - $ref: '#/components/messages/subscriptionStatus' + messages: + - $ref: '#/components/messages/unsubscribe' components: messages: + dummyCurrencyInfo: + summary: Dummy message with no real life details + description: It is here in this example to showcase that there is an additional message that normally is of a complex structure. It represents actually currency exchange value to show a reply to operation receiveSubscribeRequest with more than one possible message. + payload: + type: object + properties: + event: + type: string + const: currencyInfo + reqid: + $ref: '#/components/schemas/reqid' + data: + type: object + required: + - event + correlationId: + location: '$message.payload#/reqid' + ping: summary: Ping server to determine whether connection is alive description: Client can ping server to determine whether connection is alive, server responds with pong. This is an application level ping as opposed to default ping in websockets standard which is server initiated payload: $ref: '#/components/schemas/ping' correlationId: - location: $message.payload#/reqid + location: '$message.payload#/reqid' pong: summary: Pong is a response to ping message @@ -92,20 +123,20 @@ components: payload: $ref: '#/components/schemas/pong' correlationId: - location: $message.payload#/reqid + location: '$message.payload#/reqid' subscribe: description: Subscribe to a topic on a single or multiple currency pairs. payload: $ref: '#/components/schemas/subscribe' correlationId: - location: $message.payload#/reqid + location: '$message.payload#/reqid' unsubscribe: description: Unsubscribe, can specify a channelID or multiple currency pairs. payload: $ref: '#/components/schemas/unsubscribe' correlationId: - location: $message.payload#/reqid + location: '$message.payload#/reqid' subscriptionStatus: description: Subscription status response to subscribe, unsubscribe or exchange initiated unsubscribe. payload: diff --git a/examples/kraken-websocket-request-reply-multiple-channels.yml b/examples/kraken-websocket-request-reply-multiple-channels-asyncapi.yml similarity index 92% rename from examples/kraken-websocket-request-reply-multiple-channels.yml rename to examples/kraken-websocket-request-reply-multiple-channels-asyncapi.yml index 4bf3bf570..879df21fd 100644 --- a/examples/kraken-websocket-request-reply-multiple-channels.yml +++ b/examples/kraken-websocket-request-reply-multiple-channels-asyncapi.yml @@ -42,57 +42,79 @@ channels: systemStatus: $ref: '#/components/messages/systemStatus' - subscriptionStatus: + currencyInfo: address: / messages: subscriptionStatus: $ref: '#/components/messages/subscriptionStatus' + dummyCurrencyInfo: + $ref: '#/components/messages/dummyCurrencyInfo' + subscribe: address: / messages: subscribe: $ref: '#/components/messages/subscribe' + unsubscribe: address: / messages: unsubscribe: $ref: '#/components/messages/unsubscribe' - operations: - pingPong: - action: send + receivePing: + action: receive channel: $ref: '#/channels/ping' reply: channel: $ref: '#/channels/pong' heartbeat: - action: receive + action: send channel: $ref: '#/channels/heartbeat' systemStatus: - action: receive + action: send channel: $ref: '#/channels/systemStatus' subscribe: - action: send + action: receive channel: $ref: '#/channels/subscribe' reply: channel: - $ref: '#/channels/subscriptionStatus' + $ref: '#/channels/currencyInfo' unsubscribe: - action: send + action: receive channel: $ref: '#/channels/unsubscribe' reply: channel: - $ref: '#/channels/subscriptionStatus' + $ref: '#/channels/currencyInfo' + messages: + - $ref: '#/components/messages/subscriptionStatus' components: messages: + dummyCurrencyInfo: + summary: Dummy message with no real life details + description: It is here in this example to showcase that there is an additional message that normally is of a complex structure. It represents actually currency exchange value to show a reply to operation receiveSubscribeRequest with more than one possible message. + payload: + type: object + properties: + event: + type: string + const: currencyInfo + reqid: + $ref: '#/components/schemas/reqid' + data: + type: object + required: + - event + correlationId: + location: '$message.payload#/reqid' ping: summary: Ping server to determine whether connection is alive description: Client can ping server to determine whether connection is alive, server responds with pong. This is an application level ping as opposed to default ping in websockets standard which is server initiated diff --git a/examples/mercure.yml b/examples/mercure-asyncapi.yml similarity index 79% rename from examples/mercure.yml rename to examples/mercure-asyncapi.yml index 33ec12fd1..098c42275 100644 --- a/examples/mercure.yml +++ b/examples/mercure-asyncapi.yml @@ -10,12 +10,10 @@ servers: pathname: /.well-known/mercure protocol: mercure channels: - 'https://example.com/books/{id}': + books: address: 'https://example.com/books/{id}' messages: - publish.message: - $ref: '#/components/messages/book' - subscribe.message: + book: $ref: '#/components/messages/book' description: >- Every time a resource of type `http://schema.org/Book` is created or @@ -24,16 +22,16 @@ channels: parameters: id: {} operations: - 'https://example.com/books/{id}.publish': + ReceiveBooksInfo: action: receive channel: - $ref: '#/channels/https:~1~1example.com~1books~1{id}' + $ref: '#/channels/books' messages: - $ref: '#/components/messages/book' - 'https://example.com/books/{id}.subscribe': + SendBooksInfo: action: send channel: - $ref: '#/channels/https:~1~1example.com~1books~1{id}' + $ref: '#/channels/books' messages: - $ref: '#/components/messages/book' components: diff --git a/examples/not.yml b/examples/not-asyncapi.yml similarity index 100% rename from examples/not.yml rename to examples/not-asyncapi.yml diff --git a/examples/oneof.yml b/examples/oneof-asyncapi.yml similarity index 100% rename from examples/oneof.yml rename to examples/oneof-asyncapi.yml diff --git a/examples/operation-security.yml b/examples/operation-security-asyncapi.yml similarity index 96% rename from examples/operation-security.yml rename to examples/operation-security-asyncapi.yml index 99d959467..d3d90c054 100644 --- a/examples/operation-security.yml +++ b/examples/operation-security-asyncapi.yml @@ -28,15 +28,8 @@ operations: - 'subscribe:auth_revocations' bindings: http: - type: request method: POST - headers: - type: object - properties: - Content-Type: - type: string - enum: - - application/json + messages: - $ref: '#/components/messages/message' components: @@ -48,6 +41,10 @@ components: X-SIGNATURE: description: ECC message signature type: string + Content-Type: + type: string + enum: + - application/json payload: type: object properties: diff --git a/examples/rpc-client.yml b/examples/rpc-client-asyncapi.yml similarity index 80% rename from examples/rpc-client.yml rename to examples/rpc-client-asyncapi.yml index dd35d2de5..58602be3a 100644 --- a/examples/rpc-client.yml +++ b/examples/rpc-client-asyncapi.yml @@ -10,10 +10,10 @@ servers: host: rabbitmq.example.org protocol: amqp channels: - '{queue}': + queue: address: '{queue}' messages: - receiveSumResult.message: + receiveSumResult: correlationId: location: $message.header#/correlation_id payload: @@ -33,11 +33,7 @@ channels: rpc_queue: address: rpc_queue messages: - requestSum.message: - bindings: - amqp: - replyTo: - type: string + requestSum: correlationId: location: $message.header#/correlation_id payload: @@ -59,12 +55,12 @@ operations: receiveSumResult: action: receive channel: - $ref: '#/channels/{queue}' + $ref: '#/channels/queue' bindings: amqp: ack: false messages: - - $ref: '#/channels/{queue}/messages/receiveSumResult.message' + - $ref: '#/channels/queue/messages/receiveSumResult' requestSum: action: send channel: @@ -73,4 +69,4 @@ operations: amqp: ack: true messages: - - $ref: '#/channels/rpc_queue/messages/requestSum.message' + - $ref: '#/channels/rpc_queue/messages/requestSum' diff --git a/examples/rpc-server.yml b/examples/rpc-server-asyncapi.yml similarity index 81% rename from examples/rpc-server.yml rename to examples/rpc-server-asyncapi.yml index de1f8ca43..3d93776c8 100644 --- a/examples/rpc-server.yml +++ b/examples/rpc-server-asyncapi.yml @@ -10,10 +10,10 @@ servers: host: rabbitmq.example.org protocol: amqp channels: - '{queue}': + queue: address: '{queue}' messages: - sendSumResult.message: + sendSumResult: correlationId: location: $message.header#/correlation_id payload: @@ -33,11 +33,7 @@ channels: rpc_queue: address: rpc_queue messages: - sum.message: - bindings: - amqp: - replyTo: - type: string + sum: correlationId: location: $message.header#/correlation_id payload: @@ -59,15 +55,15 @@ operations: sendSumResult: action: send channel: - $ref: '#/channels/{queue}' + $ref: '#/channels/queue' bindings: amqp: ack: true messages: - - $ref: '#/channels/{queue}/messages/sendSumResult.message' + - $ref: '#/channels/queue/messages/sendSumResult' sum: action: receive channel: $ref: '#/channels/rpc_queue' messages: - - $ref: '#/channels/rpc_queue/messages/sum.message' + - $ref: '#/channels/rpc_queue/messages/sum' diff --git a/examples/simple.yml b/examples/simple-asyncapi.yml similarity index 79% rename from examples/simple.yml rename to examples/simple-asyncapi.yml index f72ea6ece..f724c8b08 100644 --- a/examples/simple.yml +++ b/examples/simple-asyncapi.yml @@ -4,16 +4,16 @@ info: version: 1.0.0 description: This service is in charge of processing user signups channels: - user/signedup: + userSignedup: address: user/signedup messages: - subscribe.message: + UserSignedUp: $ref: '#/components/messages/UserSignedUp' operations: - user/signedup.subscribe: + sendUserSignedup: action: send channel: - $ref: '#/channels/user~1signedup' + $ref: '#/channels/userSignedup' messages: - $ref: '#/components/messages/UserSignedUp' components: @@ -28,4 +28,4 @@ components: email: type: string format: email - description: Email of the user + description: Email of the user \ No newline at end of file diff --git a/examples/slack-rtm.yml b/examples/slack-rtm-asyncapi.yml similarity index 94% rename from examples/slack-rtm.yml rename to examples/slack-rtm-asyncapi.yml index 4de2a3c8f..883f5ea26 100644 --- a/examples/slack-rtm.yml +++ b/examples/slack-rtm-asyncapi.yml @@ -12,114 +12,114 @@ servers: security: - $ref: '#/components/securitySchemes/token' channels: - /: + root: address: / messages: - publish.message: + outgoingMessage: $ref: '#/components/messages/outgoingMessage' - subscribe.message.0: + hello: $ref: '#/components/messages/hello' - subscribe.message.1: + connectionError: $ref: '#/components/messages/connectionError' - subscribe.message.2: + accountsChanged: $ref: '#/components/messages/accountsChanged' - subscribe.message.3: + botAdded: $ref: '#/components/messages/botAdded' - subscribe.message.4: + botChanged: $ref: '#/components/messages/botChanged' - subscribe.message.5: + channelArchive: $ref: '#/components/messages/channelArchive' - subscribe.message.6: + channelCreated: $ref: '#/components/messages/channelCreated' - subscribe.message.7: + channelDeleted: $ref: '#/components/messages/channelDeleted' - subscribe.message.8: + channelHistoryChanged: $ref: '#/components/messages/channelHistoryChanged' - subscribe.message.9: + channelJoined: $ref: '#/components/messages/channelJoined' - subscribe.message.10: + channelLeft: $ref: '#/components/messages/channelLeft' - subscribe.message.11: + channelMarked: $ref: '#/components/messages/channelMarked' - subscribe.message.12: + channelRename: $ref: '#/components/messages/channelRename' - subscribe.message.13: + channelUnarchive: $ref: '#/components/messages/channelUnarchive' - subscribe.message.14: + commandsChanged: $ref: '#/components/messages/commandsChanged' - subscribe.message.15: + dndUpdated: $ref: '#/components/messages/dndUpdated' - subscribe.message.16: + dndUpdatedUser: $ref: '#/components/messages/dndUpdatedUser' - subscribe.message.17: + emailDomainChanged: $ref: '#/components/messages/emailDomainChanged' - subscribe.message.18: + emojiRemoved: $ref: '#/components/messages/emojiRemoved' - subscribe.message.19: + emojiAdded: $ref: '#/components/messages/emojiAdded' - subscribe.message.20: + fileChange: $ref: '#/components/messages/fileChange' - subscribe.message.21: + fileCommentAdded: $ref: '#/components/messages/fileCommentAdded' - subscribe.message.22: + fileCommentDeleted: $ref: '#/components/messages/fileCommentDeleted' - subscribe.message.23: + fileCommentEdited: $ref: '#/components/messages/fileCommentEdited' - subscribe.message.24: + fileCreated: $ref: '#/components/messages/fileCreated' - subscribe.message.25: + fileDeleted: $ref: '#/components/messages/fileDeleted' - subscribe.message.26: + filePublic: $ref: '#/components/messages/filePublic' - subscribe.message.27: + fileShared: $ref: '#/components/messages/fileShared' - subscribe.message.28: + fileUnshared: $ref: '#/components/messages/fileUnshared' - subscribe.message.29: + goodbye: $ref: '#/components/messages/goodbye' - subscribe.message.30: + groupArchive: $ref: '#/components/messages/groupArchive' - subscribe.message.31: + groupClose: $ref: '#/components/messages/groupClose' - subscribe.message.32: + groupHistoryChanged: $ref: '#/components/messages/groupHistoryChanged' - subscribe.message.33: + groupJoined: $ref: '#/components/messages/groupJoined' - subscribe.message.34: + groupLeft: $ref: '#/components/messages/groupLeft' - subscribe.message.35: + groupMarked: $ref: '#/components/messages/groupMarked' - subscribe.message.36: + groupOpen: $ref: '#/components/messages/groupOpen' - subscribe.message.37: + groupRename: $ref: '#/components/messages/groupRename' - subscribe.message.38: + groupUnarchive: $ref: '#/components/messages/groupUnarchive' - subscribe.message.39: + imClose: $ref: '#/components/messages/imClose' - subscribe.message.40: + imCreated: $ref: '#/components/messages/imCreated' - subscribe.message.41: + imMarked: $ref: '#/components/messages/imMarked' - subscribe.message.42: + imOpen: $ref: '#/components/messages/imOpen' - subscribe.message.43: + manualPresenceChange: $ref: '#/components/messages/manualPresenceChange' - subscribe.message.44: + memberJoinedChannel: $ref: '#/components/messages/memberJoinedChannel' - subscribe.message.45: + message: $ref: '#/components/messages/message' operations: - /.publish: + receiveOutgoingMessage: action: receive channel: - $ref: '#/channels/~1' + $ref: '#/channels/root' messages: - $ref: '#/components/messages/outgoingMessage' - /.subscribe: + sendMessages: action: send channel: - $ref: '#/channels/~1' + $ref: '#/channels/root' messages: - $ref: '#/components/messages/hello' - $ref: '#/components/messages/connectionError' diff --git a/examples/social-media/backend/asyncapi.yaml b/examples/social-media/backend/asyncapi.yaml index b93a16dc3..ca4ed7ccd 100644 --- a/examples/social-media/backend/asyncapi.yaml +++ b/examples/social-media/backend/asyncapi.yaml @@ -4,7 +4,7 @@ info: version: 1.0.0 servers: websiteWebSocketServer: - $ref: ../common/servers.yaml#/websiteWebSocketServer + $ref: '../common/servers.yaml#/websiteWebSocketServer' mosquitto: host: test.mosquitto.org protocol: mqtt @@ -19,27 +19,27 @@ servers: mqtt: clientId: websocketServer channels: - comment/liked: + notifyAllCommentLiked: address: comment/liked messages: subscribe.message: - $ref: ../common/messages.yaml#/commentLiked + $ref: '../common/messages.yaml#/commentLiked' description: Notify all the services that a comment has been liked. servers: - $ref: '#/servers/mosquitto' - like/comment: + newLikeComment: address: like/comment messages: publish.message: - $ref: ../common/messages.yaml#/likeComment + $ref: '../common/messages.yaml#/likeComment' description: When a comment like is received from the frontend. servers: - $ref: '#/servers/websiteWebSocketServer' - 'comment/{commentId}/changed': + commentsCountChange: address: 'comment/{commentId}/changed' messages: publish.message: - $ref: ../common/messages.yaml#/commentChanged + $ref: '../common/messages.yaml#/commentChanged' description: >- When an event from the broker arrives telling us to update the comment likes count on the frontend. @@ -47,36 +47,36 @@ channels: - $ref: '#/servers/mosquitto' parameters: commentId: {} - update/comment/likes: + updateCommentsCount: address: update/comment/likes messages: subscribe.message: - $ref: ../common/messages.yaml#/updateCommentLikes + $ref: '../common/messages.yaml#/updateCommentLikes' description: Update comment likes count in the frontend. servers: - $ref: '#/servers/websiteWebSocketServer' operations: - comment/liked.subscribe: + sendCommentLiked: action: send channel: - $ref: '#/channels/comment~1liked' + $ref: '#/channels/notifyAllCommentLiked' messages: - - $ref: ../common/messages.yaml#/commentLiked - like/comment.publish: + - $ref: '../common/messages.yaml#/commentLiked' + receiveCommentLike: action: receive channel: - $ref: '#/channels/like~1comment' + $ref: '#/channels/newLikeComment' messages: - - $ref: ../common/messages.yaml#/likeComment - 'comment/{commentId}/changed.publish': + - $ref: '../common/messages.yaml#/likeComment' + receiveCommentChange: action: receive channel: - $ref: '#/channels/comment~1{commentId}~1changed' + $ref: '#/channels/commentsCountChange' messages: - - $ref: ../common/messages.yaml#/commentChanged - update/comment/likes.subscribe: + - $ref: '../common/messages.yaml#/commentChanged' + sendCommentLikeUpdate: action: send channel: - $ref: '#/channels/update~1comment~1likes' + $ref: '#/channels/updateCommentsCount' messages: - - $ref: ../common/messages.yaml#/updateCommentLikes + - $ref: '../common/messages.yaml#/updateCommentLikes' diff --git a/examples/social-media/comments-service/asyncapi.yaml b/examples/social-media/comments-service/asyncapi.yaml index db4f3603f..4c9fb309f 100644 --- a/examples/social-media/comments-service/asyncapi.yaml +++ b/examples/social-media/comments-service/asyncapi.yaml @@ -18,34 +18,34 @@ servers: mqtt: clientId: comment-service channels: - comment/liked: + commentLiked: address: comment/liked messages: - publish.message: - $ref: ../common/messages.yaml#/commentLiked + commentLiked: + $ref: '../common/messages.yaml#/commentLiked' description: >- Updates the likes count in the database and sends the new count to the broker. - 'comment/{commentId}/changed': + commentCountChange: address: 'comment/{commentId}/changed' messages: - subscribe.message: - $ref: ../common/messages.yaml#/commentChanged + commentChanged: + $ref: '../common/messages.yaml#/commentChanged' description: >- Sends the new count to the broker after it has been updated in the database. parameters: commentId: {} operations: - comment/liked.publish: + receiveCommentLiked: action: receive channel: - $ref: '#/channels/comment~1liked' + $ref: '#/channels/commentLiked' messages: - - $ref: ../common/messages.yaml#/commentLiked - 'comment/{commentId}/changed.subscribe': + - $ref: '../common/messages.yaml#/commentLiked' + sendCommentChange: action: send channel: - $ref: '#/channels/comment~1{commentId}~1changed' + $ref: '#/channels/commentCountChange' messages: - - $ref: ../common/messages.yaml#/commentChanged + - $ref: '../common/messages.yaml#/commentChanged' diff --git a/examples/social-media/frontend/asyncapi.yaml b/examples/social-media/frontend/asyncapi.yaml index 0257336a6..c1d5355ea 100644 --- a/examples/social-media/frontend/asyncapi.yaml +++ b/examples/social-media/frontend/asyncapi.yaml @@ -4,30 +4,30 @@ info: version: 1.0.0 servers: websiteWebSocketServer: - $ref: ../common/servers.yaml#/websiteWebSocketServer + $ref: '../common/servers.yaml#/websiteWebSocketServer' channels: - like/comment: + likeComment: address: like/comment messages: - subscribe.message: - $ref: ../common/messages.yaml#/likeComment + likeComment: + $ref: '../common/messages.yaml#/likeComment' description: Notify the backend that a comment has been liked. - update/comment/likes: + updateCommentLike: address: update/comment/likes messages: - publish.message: - $ref: ../common/messages.yaml#/updateCommentLikes + updateCommentLikes: + $ref: '../common/messages.yaml#/updateCommentLikes' description: Update the UI when the comment likes count is updated. operations: - like/comment.subscribe: + sendLikeComment: action: send channel: - $ref: '#/channels/like~1comment' + $ref: '#/channels/likeComment' messages: - - $ref: ../common/messages.yaml#/likeComment - update/comment/likes.publish: + - $ref: '../common/messages.yaml#/likeComment' + receiveUpdateCommentLiked: action: receive channel: - $ref: '#/channels/update~1comment~1likes' + $ref: '#/channels/updateCommentLike' messages: - - $ref: ../common/messages.yaml#/updateCommentLikes + - $ref: '../common/messages.yaml#/updateCommentLikes' \ No newline at end of file diff --git a/examples/social-media/notification-service/asyncapi.yaml b/examples/social-media/notification-service/asyncapi.yaml index 858f3e2eb..fc4b5bb17 100644 --- a/examples/social-media/notification-service/asyncapi.yaml +++ b/examples/social-media/notification-service/asyncapi.yaml @@ -17,18 +17,18 @@ servers: mqtt: clientId: notification-service channels: - comment/liked: + commentLiked: address: comment/liked messages: - publish.message: - $ref: ../common/messages.yaml#/commentLiked + commentLiked: + $ref: '../common/messages.yaml#/commentLiked' description: >- When a "comment has been liked" message is received, it sends an SMS or push notification to the author. operations: - comment/liked.publish: + receiveCommentLiked: action: receive channel: - $ref: '#/channels/comment~1liked' + $ref: '#/channels/commentLiked' messages: - - $ref: ../common/messages.yaml#/commentLiked + - $ref: '../common/messages.yaml#/commentLiked' \ No newline at end of file diff --git a/examples/social-media/public-api/asyncapi.yaml b/examples/social-media/public-api/asyncapi.yaml index 9c6ec1b72..01c7b462c 100644 --- a/examples/social-media/public-api/asyncapi.yaml +++ b/examples/social-media/public-api/asyncapi.yaml @@ -18,18 +18,18 @@ servers: mqtt: clientId: public-api channels: - comment/liked: + commentLiked: address: comment/liked messages: - publish.message: - $ref: ../common/messages.yaml#/commentLiked + commentLiked: + $ref: '../common/messages.yaml#/commentLiked' description: >- Others are publishing to you, whenever a comment is liked, for you to do react to such an event. operations: - comment/liked.publish: + receiveCommentLiked: action: receive channel: - $ref: '#/channels/comment~1liked' + $ref: '#/channels/commentLiked' messages: - - $ref: ../common/messages.yaml#/commentLiked + - $ref: '../common/messages.yaml#/commentLiked' \ No newline at end of file diff --git a/examples/streetlights-kafka.yml b/examples/streetlights-kafka-asyncapi.yml similarity index 88% rename from examples/streetlights-kafka.yml rename to examples/streetlights-kafka-asyncapi.yml index 0affab93b..957198a54 100644 --- a/examples/streetlights-kafka.yml +++ b/examples/streetlights-kafka-asyncapi.yml @@ -37,35 +37,35 @@ servers: - name: 'visibility:private' description: This resource is private and only available to certain users channels: - 'smartylighting.streetlights.1.0.event.{streetlightId}.lighting.measured': + lightingMeasured: address: 'smartylighting.streetlights.1.0.event.{streetlightId}.lighting.measured' messages: - receiveLightMeasurement.message: + lightMeasured: $ref: '#/components/messages/lightMeasured' description: The topic on which measured values may be produced and consumed. parameters: streetlightId: $ref: '#/components/parameters/streetlightId' - 'smartylighting.streetlights.1.0.action.{streetlightId}.turn.on': + lightTurnOn: address: 'smartylighting.streetlights.1.0.action.{streetlightId}.turn.on' messages: - turnOn.message: + turnOn: $ref: '#/components/messages/turnOnOff' parameters: streetlightId: $ref: '#/components/parameters/streetlightId' - 'smartylighting.streetlights.1.0.action.{streetlightId}.turn.off': + lightTurnOff: address: 'smartylighting.streetlights.1.0.action.{streetlightId}.turn.off' messages: - turnOff.message: + turnOff: $ref: '#/components/messages/turnOnOff' parameters: streetlightId: $ref: '#/components/parameters/streetlightId' - 'smartylighting.streetlights.1.0.action.{streetlightId}.dim': + lightsDim: address: 'smartylighting.streetlights.1.0.action.{streetlightId}.dim' messages: - dimLight.message: + dimLight: $ref: '#/components/messages/dimLight' parameters: streetlightId: @@ -74,8 +74,7 @@ operations: receiveLightMeasurement: action: receive channel: - $ref: >- - #/channels/smartylighting.streetlights.1.0.event.{streetlightId}.lighting.measured + $ref: '#/channels/lightingMeasured' summary: >- Inform about environmental lighting conditions of a particular streetlight. @@ -86,8 +85,7 @@ operations: turnOn: action: send channel: - $ref: >- - #/channels/smartylighting.streetlights.1.0.action.{streetlightId}.turn.on + $ref: '#/channels/lightTurnOn' traits: - $ref: '#/components/operationTraits/kafka' messages: @@ -95,8 +93,7 @@ operations: turnOff: action: send channel: - $ref: >- - #/channels/smartylighting.streetlights.1.0.action.{streetlightId}.turn.off + $ref: '#/channels/lightTurnOff' traits: - $ref: '#/components/operationTraits/kafka' messages: @@ -104,7 +101,7 @@ operations: dimLight: action: send channel: - $ref: '#/channels/smartylighting.streetlights.1.0.action.{streetlightId}.dim' + $ref: '#/channels/lightsDim' traits: - $ref: '#/components/operationTraits/kafka' messages: diff --git a/examples/streetlights-mqtt.yml b/examples/streetlights-mqtt-asyncapi.yml similarity index 91% rename from examples/streetlights-mqtt.yml rename to examples/streetlights-mqtt-asyncapi.yml index 7a3fb23cb..5e67c9ca8 100644 --- a/examples/streetlights-mqtt.yml +++ b/examples/streetlights-mqtt-asyncapi.yml @@ -63,35 +63,35 @@ servers: - name: 'visibility:public' description: This resource is public and available to everyone channels: - 'smartylighting/streetlights/1/0/event/{streetlightId}/lighting/measured': + lightingMeasured: address: 'smartylighting/streetlights/1/0/event/{streetlightId}/lighting/measured' messages: - receiveLightMeasurement.message: + lightMeasured: $ref: '#/components/messages/lightMeasured' description: The topic on which measured values may be produced and consumed. parameters: streetlightId: $ref: '#/components/parameters/streetlightId' - 'smartylighting/streetlights/1/0/action/{streetlightId}/turn/on': + lightTurnOn: address: 'smartylighting/streetlights/1/0/action/{streetlightId}/turn/on' messages: - turnOn.message: + turnOn: $ref: '#/components/messages/turnOnOff' parameters: streetlightId: $ref: '#/components/parameters/streetlightId' - 'smartylighting/streetlights/1/0/action/{streetlightId}/turn/off': + lightTurnOff: address: 'smartylighting/streetlights/1/0/action/{streetlightId}/turn/off' messages: - turnOff.message: + turnOff: $ref: '#/components/messages/turnOnOff' parameters: streetlightId: $ref: '#/components/parameters/streetlightId' - 'smartylighting/streetlights/1/0/action/{streetlightId}/dim': + lightsDim: address: 'smartylighting/streetlights/1/0/action/{streetlightId}/dim' messages: - dimLight.message: + dimLight: $ref: '#/components/messages/dimLight' parameters: streetlightId: @@ -100,8 +100,7 @@ operations: receiveLightMeasurement: action: receive channel: - $ref: >- - #/channels/smartylighting~1streetlights~11~10~1event~1{streetlightId}~1lighting~1measured + $ref: '#/channels/lightingMeasured' summary: >- Inform about environmental lighting conditions of a particular streetlight. @@ -112,8 +111,7 @@ operations: turnOn: action: send channel: - $ref: >- - #/channels/smartylighting~1streetlights~11~10~1action~1{streetlightId}~1turn~1on + $ref: '#/channels/lightTurnOn' traits: - $ref: '#/components/operationTraits/mqtt' messages: @@ -121,8 +119,7 @@ operations: turnOff: action: send channel: - $ref: >- - #/channels/smartylighting~1streetlights~11~10~1action~1{streetlightId}~1turn~1off + $ref: '#/channels/lightTurnOff' traits: - $ref: '#/components/operationTraits/mqtt' messages: @@ -130,8 +127,7 @@ operations: dimLight: action: send channel: - $ref: >- - #/channels/smartylighting~1streetlights~11~10~1action~1{streetlightId}~1dim + $ref: '#/channels/lightsDim' traits: - $ref: '#/components/operationTraits/mqtt' messages: diff --git a/examples/streetlights-operation-security.yml b/examples/streetlights-operation-security-asyncapi.yml similarity index 90% rename from examples/streetlights-operation-security.yml rename to examples/streetlights-operation-security-asyncapi.yml index a29723e9c..a159f9b32 100644 --- a/examples/streetlights-operation-security.yml +++ b/examples/streetlights-operation-security-asyncapi.yml @@ -31,10 +31,10 @@ servers: - 'streetlights:write' - 'streetlights:read' channels: - 'smartylighting.streetlights.1.0.event.{streetlightId}.lighting.measured': + lightingMeasured: address: 'smartylighting.streetlights.1.0.event.{streetlightId}.lighting.measured' messages: - receiveLightMeasurement.message: + lightMeasured: $ref: '#/components/messages/lightMeasured' description: The topic on which measured values may be produced and consumed. servers: @@ -42,30 +42,30 @@ channels: parameters: streetlightId: $ref: '#/components/parameters/streetlightId' - 'smartylighting.streetlights.1.0.action.{streetlightId}.turn.on': + lightTurnOn: address: 'smartylighting.streetlights.1.0.action.{streetlightId}.turn.on' messages: - turnOn.message: + turnOn: $ref: '#/components/messages/turnOnOff' servers: - $ref: '#/servers/test_oauth' parameters: streetlightId: $ref: '#/components/parameters/streetlightId' - 'smartylighting.streetlights.1.0.action.{streetlightId}.turn.off': + lightTurnOff: address: 'smartylighting.streetlights.1.0.action.{streetlightId}.turn.off' messages: - turnOff.message: + turnOff: $ref: '#/components/messages/turnOnOff' servers: - $ref: '#/servers/test_oauth' parameters: streetlightId: $ref: '#/components/parameters/streetlightId' - 'smartylighting.streetlights.1.0.action.{streetlightId}.dim': + lightsDim: address: 'smartylighting.streetlights.1.0.action.{streetlightId}.dim' messages: - dimLight.message: + dimLight: $ref: '#/components/messages/dimLight' servers: - $ref: '#/servers/test_oauth' @@ -76,8 +76,7 @@ operations: receiveLightMeasurement: action: receive channel: - $ref: >- - #/channels/smartylighting.streetlights.1.0.event.{streetlightId}.lighting.measured + $ref: '#/channels/lightingMeasured' summary: >- Inform about environmental lighting conditions of a particular streetlight. @@ -88,8 +87,7 @@ operations: turnOn: action: send channel: - $ref: >- - #/channels/smartylighting.streetlights.1.0.action.{streetlightId}.turn.on + $ref: '#/channels/lightTurnOn' security: - type: oauth2 description: The oauth security descriptions @@ -108,8 +106,7 @@ operations: turnOff: action: send channel: - $ref: >- - #/channels/smartylighting.streetlights.1.0.action.{streetlightId}.turn.off + $ref: '#/channels/lightTurnOff' security: - type: oauth2 description: The oauth security descriptions @@ -128,7 +125,7 @@ operations: dimLight: action: send channel: - $ref: '#/channels/smartylighting.streetlights.1.0.action.{streetlightId}.dim' + $ref: '#/channels/lightsDim' security: - type: oauth2 description: The oauth security descriptions diff --git a/examples/websocket-gemini.yml b/examples/websocket-gemini-asyncapi.yml similarity index 98% rename from examples/websocket-gemini.yml rename to examples/websocket-gemini-asyncapi.yml index cc1cd9193..2a72fa272 100644 --- a/examples/websocket-gemini.yml +++ b/examples/websocket-gemini-asyncapi.yml @@ -25,10 +25,10 @@ servers: host: api.gemini.com protocol: wss channels: - '/v1/marketdata/{symbol}': + marketDataV1: address: '/v1/marketdata/{symbol}' messages: - subscribe.message: + marketData: $ref: '#/components/messages/marketData' parameters: symbol: @@ -149,10 +149,10 @@ channels: default: true description: Include auction events operations: - '/v1/marketdata/{symbol}.subscribe': + sendMarketData: action: send channel: - $ref: '#/channels/~1v1~1marketdata~1{symbol}' + $ref: '#/channels/marketDataV1' summary: Receive market updates on a given symbol messages: - $ref: '#/components/messages/marketData' @@ -302,4 +302,4 @@ components: multipleOf: 1 description: >- The quantity changed. May be negative, if an order is filled or - canceled. For initial messages, delta will equal remaining. + canceled. For initial messages, delta will equal remaining. \ No newline at end of file From 413f45276d25cda7318e75f5429a4439cac64865 Mon Sep 17 00:00:00 2001 From: derberg Date: Tue, 10 Oct 2023 15:26:53 +0200 Subject: [PATCH 2/3] fix mercure param --- examples/mercure-asyncapi.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/examples/mercure-asyncapi.yml b/examples/mercure-asyncapi.yml index 098c42275..a2ff832e8 100644 --- a/examples/mercure-asyncapi.yml +++ b/examples/mercure-asyncapi.yml @@ -20,7 +20,8 @@ channels: modified, a JSON-LD representation of the new version of this resource must be pushed in this Mercure topic. parameters: - id: {} + id: + description: ID of the book operations: ReceiveBooksInfo: action: receive From c0407a1a59d1cbbb4fa34d2982c659d68a2cd249 Mon Sep 17 00:00:00 2001 From: derberg Date: Tue, 10 Oct 2023 15:35:33 +0200 Subject: [PATCH 3/3] fix param for social media example --- examples/social-media/backend/asyncapi.yaml | 3 ++- examples/social-media/comments-service/asyncapi.yaml | 3 ++- examples/social-media/common/parameters.yaml | 2 ++ 3 files changed, 6 insertions(+), 2 deletions(-) create mode 100644 examples/social-media/common/parameters.yaml diff --git a/examples/social-media/backend/asyncapi.yaml b/examples/social-media/backend/asyncapi.yaml index ca4ed7ccd..0ff462f50 100644 --- a/examples/social-media/backend/asyncapi.yaml +++ b/examples/social-media/backend/asyncapi.yaml @@ -46,7 +46,8 @@ channels: servers: - $ref: '#/servers/mosquitto' parameters: - commentId: {} + commentId: + $ref: '../common/parameters.yaml#/commentId' updateCommentsCount: address: update/comment/likes messages: diff --git a/examples/social-media/comments-service/asyncapi.yaml b/examples/social-media/comments-service/asyncapi.yaml index 4c9fb309f..74085de8d 100644 --- a/examples/social-media/comments-service/asyncapi.yaml +++ b/examples/social-media/comments-service/asyncapi.yaml @@ -35,7 +35,8 @@ channels: Sends the new count to the broker after it has been updated in the database. parameters: - commentId: {} + commentId: + $ref: '../common/parameters.yaml#/commentId' operations: receiveCommentLiked: action: receive diff --git a/examples/social-media/common/parameters.yaml b/examples/social-media/common/parameters.yaml new file mode 100644 index 000000000..91948c25e --- /dev/null +++ b/examples/social-media/common/parameters.yaml @@ -0,0 +1,2 @@ +commentId: + description: ID of the comment \ No newline at end of file