Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: spec v3 support (update examples to v3.0.0) #549

Merged
merged 44 commits into from
May 1, 2024
Merged
Show file tree
Hide file tree
Changes from 43 commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
c7ba693
feat: update parser-js to v2
Souvikns Sep 20, 2023
5c90e5b
chore: fixing tests
Souvikns Sep 20, 2023
c6d4136
fix the tests
Souvikns Sep 21, 2023
c7d50d0
feat: updating adapters
Souvikns Sep 22, 2023
35a7c68
Update client.ts
Souvikns Sep 22, 2023
523b527
fix: some minor issues
Souvikns Sep 22, 2023
0d6f324
fix: code smells
Souvikns Sep 25, 2023
55881a9
fix: minor issues with parsing
Souvikns Sep 26, 2023
1181316
fix: migration mistakes
Souvikns Sep 28, 2023
e1c12f5
fix: security
Souvikns Sep 29, 2023
ddd88f3
fix: channelName and address
Souvikns Oct 2, 2023
acdb3dd
Update index.ts
Souvikns Oct 2, 2023
5124aa7
Update client.ts
Souvikns Oct 2, 2023
93e6466
fix: update parser to latest pre release
Souvikns Oct 6, 2023
1f6ccb5
fix: review changes.
Souvikns Oct 10, 2023
bd0d57a
Merge remote-tracking branch 'upstream/master' into update-parser
Souvikns Oct 11, 2023
c5828af
Update client.ts
Souvikns Oct 11, 2023
4f48945
fix: reverting markdown template
Souvikns Oct 11, 2023
893a03b
fix: review suggestions
Souvikns Oct 12, 2023
617a15c
ignore docs generation for dummy.
KhudaDad414 Oct 12, 2023
a7aec69
better error message
KhudaDad414 Oct 12, 2023
9ddc198
improve types for flight-management example
KhudaDad414 Oct 12, 2023
f2ca30b
ignore docs
KhudaDad414 Oct 12, 2023
cfb3b15
upgrade package-lock
KhudaDad414 Oct 12, 2023
e9b991d
resolve small bug
KhudaDad414 Oct 12, 2023
4a6eff5
fix(hopefully) test error
KhudaDad414 Oct 12, 2023
8bd20ed
ci: upgrade test coverage
KhudaDad414 Oct 12, 2023
c92ac97
discard changes in coverall
KhudaDad414 Oct 12, 2023
b3f57c0
Merge remote-tracking branch 'upstream/master' into pr/Souvikns/523
KhudaDad414 Oct 12, 2023
cd0801d
Update adapter.ts
Souvikns Oct 16, 2023
9715e99
chore: update to latest parser-js pre-release
Souvikns Oct 16, 2023
f0d7d84
upgrade parser
KhudaDad414 Oct 16, 2023
3e2886b
feat: spec v3 support
Souvikns Oct 23, 2023
dc21771
Merge remote-tracking branch 'upstream/master' into spec-v3-support
Souvikns Oct 23, 2023
168acc1
Update asyncapi.yaml
Souvikns Nov 16, 2023
5e2ea7e
feat: human readable asyncapi.yaml files
Souvikns Nov 16, 2023
6be2ac1
feat: human readable asyncapi.yaml files
Souvikns Nov 16, 2023
35748a2
Merge remote-tracking branch 'upstream/master' into spec-v3-support
Souvikns Jan 11, 2024
0ee38d0
fix: remove reply from send operations
Souvikns Jan 11, 2024
0e74944
fix: reply from functions
Souvikns Jan 11, 2024
b22427d
Create README.md
Souvikns Jan 15, 2024
3b16414
fix: asyncapi.yaml of examples
Souvikns Jan 15, 2024
aa5d702
Update asyncapi.yaml
Souvikns Jan 16, 2024
304fd0a
Update asyncapi.yaml
Souvikns Jan 16, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions examples/anime-http/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Anime-HTTP

This application is a dummy application showcasing the use of HTTP adapter in Glee. This application makes and `GET` call to a third-party REST API to fetch the list of famous Anime.


## Prerequisites

- Node.js (version 12 or higher)

## How to run the Application

The application is divided into a `server` and a `client` which needs to be run simultaneously.

**To run Server**

```sh
cd server
npm run dev
```

**To run Client**

```sh
cd client
npm run dev
```


The Server needs to run first and then the client application. The server fetches the data from the third-party REST API when the client makes a `GET` API call to the server.
5 changes: 0 additions & 5 deletions examples/anime-http/client/asyncapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,6 @@ operations:
$ref: '#/channels/trendingAnime'
messages:
- $ref: '#/components/messages/trendingAnimeMessage'
reply:
KhudaDad414 marked this conversation as resolved.
Show resolved Hide resolved
channel:
$ref: '#/channels/trendingAnime'
messages:
- $ref: '#/components/messages/trendingAnimeReply'
components:
messages:
testMessage:
Expand Down
11 changes: 6 additions & 5 deletions examples/anime-http/server/asyncapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,12 @@ operations:
$ref: '#/channels/trendingAnime'
messages:
- $ref: '#/components/messages/trendingAnime'
reply:
channel:
$ref: "#/channels/trendingAnime"
messages:
- $ref: '#/components/messages/trendingAnimeReply'
trindingAnimeReply:
KhudaDad414 marked this conversation as resolved.
Show resolved Hide resolved
action: send
channel:
$ref: '#/channels/trendingAnime'
messages:
- $ref: '#/components/messages/trendingAnime'
components:
messages:
trendingAnime:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@ export default async function (event) {
const replyPayload = event.payload
const replyQuery = event.query
return {
reply: [
send: [
KhudaDad414 marked this conversation as resolved.
Show resolved Hide resolved
{
payload: replyPayload,
query: replyQuery
},
],
query: replyQuery,
channel: 'trendingAnime'
}

]
}
}
2 changes: 1 addition & 1 deletion examples/crypto-websockets/server/asyncapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ channels:
token:
type: string
operations:
/price.subscribe:
sendPrice:
action: send
channel:
$ref: '#/channels/price'
Expand Down
46 changes: 32 additions & 14 deletions examples/flight-management/backend/asyncapi.yaml
Original file line number Diff line number Diff line change
@@ -1,33 +1,49 @@
asyncapi: 2.4.0
asyncapi: 3.0.0
info:
title: Flight Board
version: 0.0.1
description: Flight Board offers real time flight info on all of the screens at an airport. This AsyncAPI file is only for the real time communication. We are using Glee to manage the WebSocket server as well as the REST API server, which is being created with Express.js.

description: >-
Flight Board offers real time flight info on all of the screens at an
airport. This AsyncAPI file is only for the real time communication. We are
using Glee to manage the WebSocket server as well as the REST API server,
which is being created with Express.js.
servers:
websockets:
url: ws://localhost:3000
host: 'localhost:3000'
protocol: ws
description: This Websocket server is available without authorization. It receives the changes that are made by different sources and updates the database and Flight Boards.
description: >-
This Websocket server is available without authorization. It receives the
changes that are made by different sources and updates the database and
Flight Boards.
channels:
/:
publish:
operationId: sendMessage
message:
oneOf:
- $ref: '#/components/messages/updateFlight'
- $ref: '#/components/messages/getFlights'
index:
address: /
messages:
updateFlight:
$ref: '#/components/messages/updateFlight'
getFlights:
$ref: '#/components/messages/getFlights'
bindings:
ws:
query:
additionalProperties: false
properties:
airport:
type: string
operations:
sendMessage:
action: receive
channel:
$ref: '#/channels/index'
messages:
- $ref: '#/components/messages/updateFlight'
- $ref: '#/components/messages/getFlights'
components:
messages:
getFlights:
summary: This message should be published when a board wants to receive all of the flights that depart or arrive at that airport.
summary: >-
This message should be published when a board wants to receive all of
the flights that depart or arrive at that airport.
payload:
type: object
additionalProperties: false
Expand All @@ -52,4 +68,6 @@ components:
eventName:
type: string
description: The name of the event.
enum: ['allFlights', 'updateFlight']
enum:
- allFlights
- updateFlight
36 changes: 25 additions & 11 deletions examples/kafka-test/asyncapi.yaml
Original file line number Diff line number Diff line change
@@ -1,31 +1,45 @@
asyncapi: 2.4.0
asyncapi: 3.0.0
info:
title: Kafka test
version: '1'
servers:
mykafka:
url: kafka://pkc-6ojv2.us-west4.gcp.confluent.cloud:9092
host: 'pkc-6ojv2.us-west4.gcp.confluent.cloud:9092'
protocol: kafka-secure
security:
- saslScramExample: []
- $ref: '#/components/securitySchemes/saslScramExample'
channels:
test:
publish:
operationId: onTest
message:
address: test
messages:
testMessage:
$ref: '#/components/messages/testMessage'
produce:
subscribe:
message:
address: produce
messages:
testMessage:
$ref: '#/components/messages/testMessage'
operations:
onTest:
action: receive
channel:
$ref: '#/channels/test'
messages:
- $ref: '#/components/messages/testMessage'
sendMessage:
action: send
channel:
$ref: '#/channels/produce'
messages:
- $ref: '#/components/messages/testMessage'
components:
messages:
testMessage:
payload:
type: object
properties:
test:
type: string
type: string
securitySchemes:
saslScramExample:
type: scramSha256
saslScramExample:
type: scramSha256
78 changes: 42 additions & 36 deletions examples/shrek-websockets/asyncapi.yaml
Original file line number Diff line number Diff line change
@@ -1,50 +1,56 @@
asyncapi: 2.0.0

#
# Overal information for users of the application
#
asyncapi: 3.0.0
info:
title: Shrek App
version: '1.0.0'
description: |
Purpose of this app is to have some fun with AsyncAPI and WebSocket and define an interface for ... Shrek.
version: 1.0.0
description: >
Purpose of this app is to have some fun with AsyncAPI and WebSocket and
define an interface for ... Shrek.


![](https://media.giphy.com/media/10Ug6rDDuG3YoU/giphy-downsized.gif)

You can use this API to chat with Shrek bot or to get updates about artifical travels to different locations.
#
# Details on how to connect to the application
#

You can use this API to chat with Shrek bot or to get updates about
artifical travels to different locations.
servers:
swamp:
url: ws://localhost
host: localhost
protocol: ws

#
# Details about all the channels that you can listen to or send to messages
#
channels:
/chat:
subscribe:
summary: Client can receive chat messages.
operationId: subChatMessage
message:
chat:
address: /chat
messages:
receiveChatMessage:
$ref: '#/components/messages/chatMessage'
publish:
summary: Client can send chat messages.
operationId: pubChatMessage
message:
sendChatMessage:
$ref: '#/components/messages/chatMessage'
/travel/status:
subscribe:
summary: Client can receive travel info status.
operationId: subTravelInfo
message:
travelStatus:
address: /travel/status
messages:
subTravelInfo:
$ref: '#/components/messages/travelInfo'

#
# All reusable parts for readability and staying DRY
#
operations:
recieveChatMessage:
action: receive
channel:
$ref: '#/channels/chat'
summary: Client can send chat messages.
messages:
- $ref: '#/components/messages/chatMessage'
sendChatMessage:
action: send
channel:
$ref: '#/channels/chat'
summary: Client can receive chat messages.
messages:
- $ref: '#/components/messages/chatMessage'
sendTravelInfo:
action: send
channel:
$ref: '#/channels/travelStatus'
summary: Client can receive travel info status.
messages:
- $ref: '#/components/messages/travelInfo'
components:
messages:
chatMessage:
Expand All @@ -69,4 +75,4 @@ components:
type: string
arrival:
description: Time left to get there.
type: string
type: string
21 changes: 13 additions & 8 deletions examples/social-network/notifications-service/asyncapi.yaml
Original file line number Diff line number Diff line change
@@ -1,19 +1,24 @@
asyncapi: 2.2.0
asyncapi: 3.0.0
info:
title: Notifications Service
version: 0.1.0

servers:
mosquitto:
url: mqtt://test.mosquitto.org
host: test.mosquitto.org
protocol: mqtt
bindings:
mqtt:
clientId: notifications-service

channels:
post/liked:
publish:
operationId: onPostLiked
message:
postLiked:
address: post/liked
messages:
onPostLikedMmessage:
$ref: '../websocket-server/asyncapi.yaml#/components/messages/notifyPostLiked'
operations:
onPostLiked:
action: receive
channel:
$ref: '#/channels/postLiked'
messages:
- $ref: '#/channels/post~1liked/messages/onPostLikedMessage'
Loading
Loading