This repository has been archived by the owner on Apr 11, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathevent-gateway-demo.asyncapi.yaml
116 lines (116 loc) · 4.79 KB
/
event-gateway-demo.asyncapi.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
asyncapi: '2.0.0' # Go parser does not support 2.1.0 at this moment.
info:
title: AsyncAPI Event-Gateway demo API
version: 1.0.0-alpha
description: This API lets users interact with an instance of the [AsyncAPI Event-Gateway](https://github.com/asyncapi/event-gateway).
defaultContentType: application/json
servers:
asyncapi-event-gateway-demo:
url: 'event-gateway-demo.asyncapi.org:20472'
protocol: kafka
description: AsyncAPI [Event-Gateway](https://github.com/asyncapi/event-gateway) demo Kafka proxy. Expected messages are based on a small portion of the [StreetLights tutorial](https://bit.ly/asyncapi).
asyncapi-event-gateway-demo-validation:
url: 'event-gateway-demo.asyncapi.org:5000/ws'
protocol: ws
description: AsyncAPI [Event-Gateway](https://github.com/asyncapi/event-gateway) demo. Subscribe for Kafka proxy message validation errors.
asyncapi-kafka-test:
url: 'asyncapi-kafka-test-asyncapi-8f90.aivencloud.com:20472' # Kafka with 3 brokers.
protocol: kafka-secure
description: AsyncAPI Kafka test broker. Private.
channels:
event-gateway-demo:
description: Demo Kafka topic for asyncapi-event-gateway-demo server. Users can send their events to this topic and see how message validation happens on the fly based on this right AsyncAPI file by connecting to `event-gateway-demo-validation-events` channel (`asyncapi-event-gateway-demo-validation` ws server).
x-servers: # Based on https://github.com/asyncapi/spec/pull/531
- asyncapi-event-gateway-demo
publish:
message:
$ref: '#/components/messages/lightMeasured'
event-gateway-demo-validation-events:
description: Validation errors are published here, so users can see how message validation happens on the fly based on this right AsyncAPI file.
x-servers: # Based on https://github.com/asyncapi/spec/pull/531
- asyncapi-event-gateway-demo-validation
subscribe:
message:
$ref: '#/components/messages/invalidMessage'
event-gateway-demo-validation:
description: Validation errors are published to and consumed from it. AsyncAPI Event-gateway is the only user of this channel. It can be consumed and exposed via `event-gateway-demo-validation-events` channel (`asyncapi-event-gateway-demo-validation` ws server).
x-servers: # Based on https://github.com/asyncapi/spec/pull/531
- asyncapi-kafka-test
subscribe:
message:
$ref: '#/components/messages/invalidMessage'
components:
messages:
# lightMeasured is copied from the Streetlights tutorial instead of using references due to a bug in parser-go: https://github.com/asyncapi/parser-go/issues/82
lightMeasured:
name: lightMeasured
title: Light measured
summary: Inform about environmental lighting conditions of a particular streetlight.
contentType: application/json
traits:
- $ref: '#/components/messageTraits/commonHeaders'
payload:
$ref: "#/components/schemas/lightMeasuredPayload"
invalidMessage:
title: Invalid message
summary: Message with a Validation Error.
contentType: application/json
payload:
$ref: "#/components/schemas/sentMessage"
headers:
type: object
properties:
_asyncapi_eg_channel:
type: string
description: AsyncAPI Channel where the message was published to.
_asyncapi_eg_validation_error:
$ref: '#/components/schemas/validationError'
schemas:
sentMessage:
type: object
properties:
UUID:
type: string
description: Unique identifier of message. I.e. Kafka message key.
Payload:
type: string
description: Message value. I.e. Kafka message (base64).
examples:
- UUID: 'YXN5bmNhcGktd2FzLWhlcmU='
Payload: 'eyJsdW1lbnMiOiAid2hhdGV2ZXIifQ=='
validationError:
type: object
properties:
ts:
type: string
description: RFC-3339 date-time. Date and time when the message was validated.
errors:
type: array
description: Array of string. Validation errors.
items:
type: string
examples:
- ts: '2021-09-10T12:04:18:475203609Z'
errors: [ 'lumens: Invalid type. Expected: integer, given: string' ]
lightMeasuredPayload:
type: object
properties:
lumens:
type: integer
minimum: 0
description: Light intensity measured in lumens.
sentAt:
$ref: "#/components/schemas/sentAt"
sentAt:
type: string
format: date-time
description: Date and time when the message was sent.
messageTraits:
commonHeaders:
headers:
type: object
properties:
my-app-header:
type: integer
minimum: 0
maximum: 100