@asyncapi/converter 0.4.3 → 0.6.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/add-good-first-issue-labels.yml +68 -0
- package/.github/workflows/automerge-for-humans-add-ready-to-merge-or-do-not-merge-label.yml +54 -0
- package/.github/workflows/automerge-for-humans-merging.yml +32 -0
- package/.github/workflows/automerge-for-humans-remove-ready-to-merge-label-on-edit.yml +35 -0
- package/.github/workflows/automerge-orphans.yml +63 -0
- package/.github/workflows/automerge.yml +24 -13
- package/.github/workflows/autoupdate.yml +28 -0
- package/.github/workflows/bump.yml +13 -13
- package/.github/workflows/help-command.yml +43 -0
- package/.github/workflows/if-go-pr-testing.yml +58 -0
- package/.github/workflows/if-nodejs-pr-testing.yml +54 -0
- package/.github/workflows/if-nodejs-release.yml +80 -0
- package/.github/workflows/if-nodejs-version-bump.yml +48 -0
- package/.github/workflows/issues-prs-notifications.yml +72 -0
- package/.github/workflows/lint-pr-title.yml +22 -0
- package/.github/workflows/release-announcements.yml +76 -0
- package/.github/workflows/sentiment-analysis.yml +3 -0
- package/.github/workflows/stale-issues-prs.yml +24 -9
- package/.github/workflows/welcome-first-time-contrib.yml +68 -10
- package/CODEOWNERS +8 -0
- package/README.md +2 -2
- package/cli.js +1 -1
- package/lib/index.js +71 -53
- package/package.json +13 -13
- package/test/index.js +99 -16
- package/test/input/1.2.0/gitter-streaming.yml +3 -2
- package/test/input/2.0.0/streetlights.yml +113 -0
- package/test/input/2.1.0/streetlights.yml +113 -0
- package/test/output/2.0.0/gitter-streaming.yml +2 -1
- package/test/output/2.0.0-rc1/gitter-streaming.yml +2 -1
- package/test/output/2.0.0-rc2/gitter-streaming.yml +2 -1
- package/test/output/2.1.0/streetlights.yml +113 -0
- package/test/output/2.2.0/streetlights.yml +113 -0
- package/.github/workflows/pull-request-testing.yml +0 -24
- package/.github/workflows/release.yml +0 -65
package/test/index.js
CHANGED
|
@@ -4,108 +4,191 @@ const path = require("path");
|
|
|
4
4
|
const { convert } = require('../lib');
|
|
5
5
|
|
|
6
6
|
describe('#convert', () => {
|
|
7
|
+
it('should not convert to lowest version', () => {
|
|
8
|
+
const result = convert(`asyncapi: '2.1.0'`, '2.0.0');
|
|
9
|
+
assert.strictEqual(result, undefined);
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
it('should not convert from non existing version', () => {
|
|
13
|
+
const result = convert(`asyncapi: '2.0.0-rc3'`, '2.1.0');
|
|
14
|
+
assert.strictEqual(result, undefined);
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
it('should not convert to this same version', () => {
|
|
18
|
+
const result = convert(`asyncapi: '2.1.0'`, '2.1.0');
|
|
19
|
+
assert.strictEqual(result, undefined);
|
|
20
|
+
});
|
|
21
|
+
|
|
7
22
|
it('should convert from 1.0.0 to 2.0.0-rc1', () => {
|
|
8
23
|
const input = fs.readFileSync(path.resolve(__dirname, 'input', '1.0.0', 'streetlights.yml'), 'utf8');
|
|
9
24
|
const output = fs.readFileSync(path.resolve(__dirname, 'output', '2.0.0-rc1', 'streetlights.yml'), 'utf8');
|
|
10
25
|
const result = convert(input, '2.0.0-rc1');
|
|
11
|
-
|
|
26
|
+
assertResults(output, result);
|
|
12
27
|
});
|
|
13
28
|
|
|
14
29
|
it('should convert from 1.1.0 to 2.0.0-rc1', () => {
|
|
15
30
|
const input = fs.readFileSync(path.resolve(__dirname, 'input', '1.1.0', 'streetlights.yml'), 'utf8');
|
|
16
31
|
const output = fs.readFileSync(path.resolve(__dirname, 'output', '2.0.0-rc1', 'streetlights.yml'), 'utf8');
|
|
17
32
|
const result = convert(input, '2.0.0-rc1');
|
|
18
|
-
|
|
33
|
+
assertResults(output, result);
|
|
19
34
|
});
|
|
20
35
|
|
|
21
36
|
it('should convert from 1.2.0 to 2.0.0-rc1', () => {
|
|
22
37
|
const input = fs.readFileSync(path.resolve(__dirname, 'input', '1.2.0', 'streetlights.yml'), 'utf8');
|
|
23
38
|
const output = fs.readFileSync(path.resolve(__dirname, 'output', '2.0.0-rc1', 'streetlights.yml'), 'utf8');
|
|
24
39
|
const result = convert(input, '2.0.0-rc1');
|
|
25
|
-
|
|
40
|
+
assertResults(output, result);
|
|
26
41
|
});
|
|
27
42
|
|
|
28
43
|
it('should convert from 1.2.0 to 2.0.0-rc1 - stream', () => {
|
|
29
44
|
const input = fs.readFileSync(path.resolve(__dirname, 'input', '1.2.0', 'gitter-streaming.yml'), 'utf8');
|
|
30
45
|
const output = fs.readFileSync(path.resolve(__dirname, 'output', '2.0.0-rc1', 'gitter-streaming.yml'), 'utf8');
|
|
31
46
|
const result = convert(input, '2.0.0-rc1');
|
|
32
|
-
|
|
47
|
+
assertResults(output, result);
|
|
33
48
|
});
|
|
34
49
|
|
|
35
50
|
it('should convert from 1.2.0 to 2.0.0-rc1 - events', () => {
|
|
36
51
|
const input = fs.readFileSync(path.resolve(__dirname, 'input', '1.2.0', 'slack-rtm.yml'), 'utf8');
|
|
37
52
|
const output = fs.readFileSync(path.resolve(__dirname, 'output', '2.0.0-rc1', 'slack-rtm.yml'), 'utf8');
|
|
38
53
|
const result = convert(input, '2.0.0-rc1');
|
|
39
|
-
|
|
54
|
+
assertResults(output, result);
|
|
40
55
|
});
|
|
41
56
|
|
|
42
57
|
it('should convert from 1.0.0 to 2.0.0-rc2', () => {
|
|
43
58
|
const input = fs.readFileSync(path.resolve(__dirname, 'input', '1.0.0', 'streetlights.yml'), 'utf8');
|
|
44
59
|
const output = fs.readFileSync(path.resolve(__dirname, 'output', '2.0.0-rc2', 'streetlights.yml'), 'utf8');
|
|
45
60
|
const result = convert(input, '2.0.0-rc2');
|
|
46
|
-
|
|
61
|
+
assertResults(output, result);
|
|
47
62
|
});
|
|
48
63
|
|
|
49
64
|
it('should convert from 1.1.0 to 2.0.0-rc2', () => {
|
|
50
65
|
const input = fs.readFileSync(path.resolve(__dirname, 'input', '1.1.0', 'streetlights.yml'), 'utf8');
|
|
51
66
|
const output = fs.readFileSync(path.resolve(__dirname, 'output', '2.0.0-rc2', 'streetlights.yml'), 'utf8');
|
|
52
67
|
const result = convert(input, '2.0.0-rc2');
|
|
53
|
-
|
|
68
|
+
assertResults(output, result);
|
|
54
69
|
});
|
|
55
70
|
|
|
56
71
|
it('should convert from 1.2.0 to 2.0.0-rc2 - stream', () => {
|
|
57
72
|
const input = fs.readFileSync(path.resolve(__dirname, 'input', '1.2.0', 'gitter-streaming.yml'), 'utf8');
|
|
58
73
|
const output = fs.readFileSync(path.resolve(__dirname, 'output', '2.0.0-rc2', 'gitter-streaming.yml'), 'utf8');
|
|
59
74
|
const result = convert(input, '2.0.0-rc2');
|
|
60
|
-
|
|
75
|
+
assertResults(output, result);
|
|
61
76
|
});
|
|
62
77
|
|
|
63
78
|
it('should convert from 1.2.0 to 2.0.0-rc2 - events', () => {
|
|
64
79
|
const input = fs.readFileSync(path.resolve(__dirname, 'input', '1.2.0', 'slack-rtm.yml'), 'utf8');
|
|
65
80
|
const output = fs.readFileSync(path.resolve(__dirname, 'output', '2.0.0-rc2', 'slack-rtm.yml'), 'utf8');
|
|
66
81
|
const result = convert(input, '2.0.0-rc2');
|
|
67
|
-
|
|
82
|
+
assertResults(output, result);
|
|
68
83
|
});
|
|
69
84
|
|
|
70
85
|
it('should convert from 1.2.0 to 2.0.0-rc2', () => {
|
|
71
86
|
const input = fs.readFileSync(path.resolve(__dirname, 'input', '1.2.0', 'streetlights.yml'), 'utf8');
|
|
72
87
|
const output = fs.readFileSync(path.resolve(__dirname, 'output', '2.0.0-rc2', 'streetlights.yml'), 'utf8');
|
|
73
88
|
const result = convert(input, '2.0.0-rc2');
|
|
74
|
-
|
|
89
|
+
assertResults(output, result);
|
|
75
90
|
});
|
|
76
91
|
|
|
77
92
|
it('should convert from 1.0.0 to 2.0.0', () => {
|
|
78
93
|
const input = fs.readFileSync(path.resolve(__dirname, 'input', '1.0.0', 'streetlights.yml'), 'utf8');
|
|
79
94
|
const output = fs.readFileSync(path.resolve(__dirname, 'output', '2.0.0', 'streetlights.yml'), 'utf8');
|
|
80
95
|
const result = convert(input, '2.0.0');
|
|
81
|
-
|
|
96
|
+
assertResults(output, result);
|
|
82
97
|
});
|
|
83
98
|
|
|
84
99
|
it('should convert from 1.1.0 to 2.0.0', () => {
|
|
85
100
|
const input = fs.readFileSync(path.resolve(__dirname, 'input', '1.1.0', 'streetlights.yml'), 'utf8');
|
|
86
101
|
const output = fs.readFileSync(path.resolve(__dirname, 'output', '2.0.0', 'streetlights.yml'), 'utf8');
|
|
87
102
|
const result = convert(input, '2.0.0');
|
|
88
|
-
|
|
103
|
+
assertResults(output, result);
|
|
89
104
|
});
|
|
90
105
|
|
|
91
106
|
it('should convert from 1.2.0 to 2.0.0', () => {
|
|
92
107
|
const input = fs.readFileSync(path.resolve(__dirname, 'input', '1.2.0', 'streetlights.yml'), 'utf8');
|
|
93
108
|
const output = fs.readFileSync(path.resolve(__dirname, 'output', '2.0.0', 'streetlights.yml'), 'utf8');
|
|
94
109
|
const result = convert(input, '2.0.0');
|
|
95
|
-
|
|
110
|
+
assertResults(output, result);
|
|
96
111
|
});
|
|
97
112
|
|
|
98
113
|
it('should convert from 2.0.0-rc1 to 2.0.0', () => {
|
|
99
114
|
const input = fs.readFileSync(path.resolve(__dirname, 'input', '2.0.0-rc1', 'streetlights.yml'), 'utf8');
|
|
100
115
|
const output = fs.readFileSync(path.resolve(__dirname, 'output', '2.0.0', 'streetlights.yml'), 'utf8');
|
|
101
116
|
const result = convert(input, '2.0.0');
|
|
102
|
-
|
|
117
|
+
assertResults(output, result);
|
|
103
118
|
});
|
|
104
119
|
|
|
105
120
|
it('should convert from 2.0.0-rc2 to 2.0.0', () => {
|
|
106
121
|
const input = fs.readFileSync(path.resolve(__dirname, 'input', '2.0.0-rc2', 'streetlights.yml'), 'utf8');
|
|
107
122
|
const output = fs.readFileSync(path.resolve(__dirname, 'output', '2.0.0', 'streetlights.yml'), 'utf8');
|
|
108
123
|
const result = convert(input, '2.0.0');
|
|
109
|
-
|
|
124
|
+
assertResults(output, result);
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
it('should convert from 1.0.0 to 2.1.0', () => {
|
|
128
|
+
const input = fs.readFileSync(path.resolve(__dirname, 'input', '1.0.0', 'streetlights.yml'), 'utf8');
|
|
129
|
+
const output = fs.readFileSync(path.resolve(__dirname, 'output', '2.1.0', 'streetlights.yml'), 'utf8');
|
|
130
|
+
const result = convert(input, '2.1.0');
|
|
131
|
+
assertResults(output, result);
|
|
132
|
+
});
|
|
133
|
+
|
|
134
|
+
it('should convert from 1.1.0 to 2.1.0', () => {
|
|
135
|
+
const input = fs.readFileSync(path.resolve(__dirname, 'input', '1.1.0', 'streetlights.yml'), 'utf8');
|
|
136
|
+
const output = fs.readFileSync(path.resolve(__dirname, 'output', '2.1.0', 'streetlights.yml'), 'utf8');
|
|
137
|
+
const result = convert(input, '2.1.0');
|
|
138
|
+
assertResults(output, result);
|
|
139
|
+
});
|
|
140
|
+
|
|
141
|
+
it('should convert from 1.2.0 to 2.1.0', () => {
|
|
142
|
+
const input = fs.readFileSync(path.resolve(__dirname, 'input', '1.2.0', 'streetlights.yml'), 'utf8');
|
|
143
|
+
const output = fs.readFileSync(path.resolve(__dirname, 'output', '2.1.0', 'streetlights.yml'), 'utf8');
|
|
144
|
+
const result = convert(input, '2.1.0');
|
|
145
|
+
assertResults(output, result);
|
|
110
146
|
});
|
|
111
|
-
|
|
147
|
+
|
|
148
|
+
it('should convert from 2.0.0-rc1 to 2.1.0', () => {
|
|
149
|
+
const input = fs.readFileSync(path.resolve(__dirname, 'input', '2.0.0-rc1', 'streetlights.yml'), 'utf8');
|
|
150
|
+
const output = fs.readFileSync(path.resolve(__dirname, 'output', '2.1.0', 'streetlights.yml'), 'utf8');
|
|
151
|
+
const result = convert(input, '2.1.0');
|
|
152
|
+
assertResults(output, result);
|
|
153
|
+
});
|
|
154
|
+
|
|
155
|
+
it('should convert from 2.0.0-rc2 to 2.1.0', () => {
|
|
156
|
+
const input = fs.readFileSync(path.resolve(__dirname, 'input', '2.0.0-rc2', 'streetlights.yml'), 'utf8');
|
|
157
|
+
const output = fs.readFileSync(path.resolve(__dirname, 'output', '2.1.0', 'streetlights.yml'), 'utf8');
|
|
158
|
+
const result = convert(input, '2.1.0');
|
|
159
|
+
assertResults(output, result);
|
|
160
|
+
});
|
|
161
|
+
|
|
162
|
+
it('should convert from 2.0.0 to 2.1.0', () => {
|
|
163
|
+
const input = fs.readFileSync(path.resolve(__dirname, 'input', '2.0.0', 'streetlights.yml'), 'utf8');
|
|
164
|
+
const output = fs.readFileSync(path.resolve(__dirname, 'output', '2.1.0', 'streetlights.yml'), 'utf8');
|
|
165
|
+
const result = convert(input, '2.1.0');
|
|
166
|
+
assertResults(output, result);
|
|
167
|
+
});
|
|
168
|
+
|
|
169
|
+
it('should convert from 2.0.0 to 2.2.0', () => {
|
|
170
|
+
const input = fs.readFileSync(path.resolve(__dirname, 'input', '2.0.0', 'streetlights.yml'), 'utf8');
|
|
171
|
+
const output = fs.readFileSync(path.resolve(__dirname, 'output', '2.2.0', 'streetlights.yml'), 'utf8');
|
|
172
|
+
const result = convert(input, '2.2.0');
|
|
173
|
+
assertResults(output, result);
|
|
174
|
+
});
|
|
175
|
+
|
|
176
|
+
it('should convert from 2.1.0 to 2.2.0', () => {
|
|
177
|
+
const input = fs.readFileSync(path.resolve(__dirname, 'input', '2.1.0', 'streetlights.yml'), 'utf8');
|
|
178
|
+
const output = fs.readFileSync(path.resolve(__dirname, 'output', '2.2.0', 'streetlights.yml'), 'utf8');
|
|
179
|
+
const result = convert(input, '2.2.0');
|
|
180
|
+
assertResults(output, result);
|
|
181
|
+
});
|
|
182
|
+
});
|
|
183
|
+
|
|
184
|
+
/*
|
|
185
|
+
It is a helper required for testing on windows. It can't be solved by editor configuration and the end line setting because expected result is converted during tests.
|
|
186
|
+
We need to remove all line breaks from the string
|
|
187
|
+
*/
|
|
188
|
+
function removeLineBreaks(str) {
|
|
189
|
+
return str.replace(/\r?\n|\r/g, '')
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
function assertResults(output, result){
|
|
193
|
+
assert.strictEqual(removeLineBreaks(output), removeLineBreaks(result));
|
|
194
|
+
}
|
|
@@ -22,7 +22,7 @@ security:
|
|
|
22
22
|
stream:
|
|
23
23
|
framing:
|
|
24
24
|
type: 'chunked'
|
|
25
|
-
delimiter: '\
|
|
25
|
+
delimiter: '\n'
|
|
26
26
|
read:
|
|
27
27
|
- $ref: '#/components/messages/chatMessage'
|
|
28
28
|
- $ref: '#/components/messages/heartbeat'
|
|
@@ -136,4 +136,5 @@ components:
|
|
|
136
136
|
summary: Its purpose is to keep the connection alive.
|
|
137
137
|
payload:
|
|
138
138
|
type: string
|
|
139
|
-
enum:
|
|
139
|
+
enum:
|
|
140
|
+
- "\n"
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
asyncapi: 2.0.0
|
|
2
|
+
info:
|
|
3
|
+
title: Streetlights API
|
|
4
|
+
version: 1.0.0
|
|
5
|
+
description: "The Smartylighting Streetlights API allows you to remotely manage the city lights.\n\n### Check out its awesome features:\n\n* Turn a specific streetlight on/off \U0001F303\n* Dim a specific streetlight \U0001F60E\n* Receive real-time information about environmental lighting conditions \U0001F4C8\n"
|
|
6
|
+
license:
|
|
7
|
+
name: Apache 2.0
|
|
8
|
+
url: 'https://www.apache.org/licenses/LICENSE-2.0'
|
|
9
|
+
servers:
|
|
10
|
+
default:
|
|
11
|
+
url: 'api.streetlights.smartylighting.com:{port}'
|
|
12
|
+
description: Test broker
|
|
13
|
+
variables:
|
|
14
|
+
port:
|
|
15
|
+
description: Secure connection (TLS) is available through port 8883.
|
|
16
|
+
default: '1883'
|
|
17
|
+
enum:
|
|
18
|
+
- '1883'
|
|
19
|
+
- '8883'
|
|
20
|
+
protocol: mqtt
|
|
21
|
+
security:
|
|
22
|
+
- apiKey: []
|
|
23
|
+
components:
|
|
24
|
+
messages:
|
|
25
|
+
lightMeasured:
|
|
26
|
+
summary: >-
|
|
27
|
+
Inform about environmental lighting conditions for a particular
|
|
28
|
+
streetlight.
|
|
29
|
+
payload:
|
|
30
|
+
$ref: '#/components/schemas/lightMeasuredPayload'
|
|
31
|
+
turnOnOff:
|
|
32
|
+
summary: Command a particular streetlight to turn the lights on or off.
|
|
33
|
+
payload:
|
|
34
|
+
$ref: '#/components/schemas/turnOnOffPayload'
|
|
35
|
+
dimLight:
|
|
36
|
+
summary: Command a particular streetlight to dim the lights.
|
|
37
|
+
payload:
|
|
38
|
+
$ref: '#/components/schemas/dimLightPayload'
|
|
39
|
+
schemas:
|
|
40
|
+
lightMeasuredPayload:
|
|
41
|
+
type: object
|
|
42
|
+
properties:
|
|
43
|
+
lumens:
|
|
44
|
+
type: integer
|
|
45
|
+
minimum: 0
|
|
46
|
+
description: Light intensity measured in lumens.
|
|
47
|
+
sentAt:
|
|
48
|
+
$ref: '#/components/schemas/sentAt'
|
|
49
|
+
turnOnOffPayload:
|
|
50
|
+
type: object
|
|
51
|
+
properties:
|
|
52
|
+
command:
|
|
53
|
+
type: string
|
|
54
|
+
enum:
|
|
55
|
+
- 'on'
|
|
56
|
+
- 'off'
|
|
57
|
+
description: Whether to turn on or off the light.
|
|
58
|
+
sentAt:
|
|
59
|
+
$ref: '#/components/schemas/sentAt'
|
|
60
|
+
dimLightPayload:
|
|
61
|
+
type: object
|
|
62
|
+
properties:
|
|
63
|
+
percentage:
|
|
64
|
+
type: integer
|
|
65
|
+
description: Percentage to which the light should be dimmed to.
|
|
66
|
+
minimum: 0
|
|
67
|
+
maximum: 100
|
|
68
|
+
sentAt:
|
|
69
|
+
$ref: '#/components/schemas/sentAt'
|
|
70
|
+
sentAt:
|
|
71
|
+
type: string
|
|
72
|
+
format: date-time
|
|
73
|
+
description: Date and time when the message was sent.
|
|
74
|
+
securitySchemes:
|
|
75
|
+
apiKey:
|
|
76
|
+
type: apiKey
|
|
77
|
+
in: user
|
|
78
|
+
description: Provide your API key as the user and leave the password empty.
|
|
79
|
+
parameters:
|
|
80
|
+
streetlightId:
|
|
81
|
+
name: streetlightId
|
|
82
|
+
description: The ID of the streetlight.
|
|
83
|
+
schema:
|
|
84
|
+
type: string
|
|
85
|
+
channels:
|
|
86
|
+
'smartylighting/streetlights/1/0/event/{streetlightId}/lighting/measured':
|
|
87
|
+
parameters:
|
|
88
|
+
streetlightId:
|
|
89
|
+
$ref: '#/components/parameters/streetlightId'
|
|
90
|
+
publish:
|
|
91
|
+
message:
|
|
92
|
+
$ref: '#/components/messages/lightMeasured'
|
|
93
|
+
'smartylighting/streetlights/1/0/action/{streetlightId}/turn/on':
|
|
94
|
+
parameters:
|
|
95
|
+
streetlightId:
|
|
96
|
+
$ref: '#/components/parameters/streetlightId'
|
|
97
|
+
subscribe:
|
|
98
|
+
message:
|
|
99
|
+
$ref: '#/components/messages/turnOnOff'
|
|
100
|
+
'smartylighting/streetlights/1/0/action/{streetlightId}/turn/off':
|
|
101
|
+
parameters:
|
|
102
|
+
streetlightId:
|
|
103
|
+
$ref: '#/components/parameters/streetlightId'
|
|
104
|
+
subscribe:
|
|
105
|
+
message:
|
|
106
|
+
$ref: '#/components/messages/turnOnOff'
|
|
107
|
+
'smartylighting/streetlights/1/0/action/{streetlightId}/dim':
|
|
108
|
+
parameters:
|
|
109
|
+
streetlightId:
|
|
110
|
+
$ref: '#/components/parameters/streetlightId'
|
|
111
|
+
subscribe:
|
|
112
|
+
message:
|
|
113
|
+
$ref: '#/components/messages/dimLight'
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
asyncapi: 2.1.0
|
|
2
|
+
info:
|
|
3
|
+
title: Streetlights API
|
|
4
|
+
version: 1.0.0
|
|
5
|
+
description: "The Smartylighting Streetlights API allows you to remotely manage the city lights.\n\n### Check out its awesome features:\n\n* Turn a specific streetlight on/off \U0001F303\n* Dim a specific streetlight \U0001F60E\n* Receive real-time information about environmental lighting conditions \U0001F4C8\n"
|
|
6
|
+
license:
|
|
7
|
+
name: Apache 2.0
|
|
8
|
+
url: 'https://www.apache.org/licenses/LICENSE-2.0'
|
|
9
|
+
servers:
|
|
10
|
+
default:
|
|
11
|
+
url: 'api.streetlights.smartylighting.com:{port}'
|
|
12
|
+
description: Test broker
|
|
13
|
+
variables:
|
|
14
|
+
port:
|
|
15
|
+
description: Secure connection (TLS) is available through port 8883.
|
|
16
|
+
default: '1883'
|
|
17
|
+
enum:
|
|
18
|
+
- '1883'
|
|
19
|
+
- '8883'
|
|
20
|
+
protocol: mqtt
|
|
21
|
+
security:
|
|
22
|
+
- apiKey: []
|
|
23
|
+
components:
|
|
24
|
+
messages:
|
|
25
|
+
lightMeasured:
|
|
26
|
+
summary: >-
|
|
27
|
+
Inform about environmental lighting conditions for a particular
|
|
28
|
+
streetlight.
|
|
29
|
+
payload:
|
|
30
|
+
$ref: '#/components/schemas/lightMeasuredPayload'
|
|
31
|
+
turnOnOff:
|
|
32
|
+
summary: Command a particular streetlight to turn the lights on or off.
|
|
33
|
+
payload:
|
|
34
|
+
$ref: '#/components/schemas/turnOnOffPayload'
|
|
35
|
+
dimLight:
|
|
36
|
+
summary: Command a particular streetlight to dim the lights.
|
|
37
|
+
payload:
|
|
38
|
+
$ref: '#/components/schemas/dimLightPayload'
|
|
39
|
+
schemas:
|
|
40
|
+
lightMeasuredPayload:
|
|
41
|
+
type: object
|
|
42
|
+
properties:
|
|
43
|
+
lumens:
|
|
44
|
+
type: integer
|
|
45
|
+
minimum: 0
|
|
46
|
+
description: Light intensity measured in lumens.
|
|
47
|
+
sentAt:
|
|
48
|
+
$ref: '#/components/schemas/sentAt'
|
|
49
|
+
turnOnOffPayload:
|
|
50
|
+
type: object
|
|
51
|
+
properties:
|
|
52
|
+
command:
|
|
53
|
+
type: string
|
|
54
|
+
enum:
|
|
55
|
+
- 'on'
|
|
56
|
+
- 'off'
|
|
57
|
+
description: Whether to turn on or off the light.
|
|
58
|
+
sentAt:
|
|
59
|
+
$ref: '#/components/schemas/sentAt'
|
|
60
|
+
dimLightPayload:
|
|
61
|
+
type: object
|
|
62
|
+
properties:
|
|
63
|
+
percentage:
|
|
64
|
+
type: integer
|
|
65
|
+
description: Percentage to which the light should be dimmed to.
|
|
66
|
+
minimum: 0
|
|
67
|
+
maximum: 100
|
|
68
|
+
sentAt:
|
|
69
|
+
$ref: '#/components/schemas/sentAt'
|
|
70
|
+
sentAt:
|
|
71
|
+
type: string
|
|
72
|
+
format: date-time
|
|
73
|
+
description: Date and time when the message was sent.
|
|
74
|
+
securitySchemes:
|
|
75
|
+
apiKey:
|
|
76
|
+
type: apiKey
|
|
77
|
+
in: user
|
|
78
|
+
description: Provide your API key as the user and leave the password empty.
|
|
79
|
+
parameters:
|
|
80
|
+
streetlightId:
|
|
81
|
+
name: streetlightId
|
|
82
|
+
description: The ID of the streetlight.
|
|
83
|
+
schema:
|
|
84
|
+
type: string
|
|
85
|
+
channels:
|
|
86
|
+
'smartylighting/streetlights/1/0/event/{streetlightId}/lighting/measured':
|
|
87
|
+
parameters:
|
|
88
|
+
streetlightId:
|
|
89
|
+
$ref: '#/components/parameters/streetlightId'
|
|
90
|
+
publish:
|
|
91
|
+
message:
|
|
92
|
+
$ref: '#/components/messages/lightMeasured'
|
|
93
|
+
'smartylighting/streetlights/1/0/action/{streetlightId}/turn/on':
|
|
94
|
+
parameters:
|
|
95
|
+
streetlightId:
|
|
96
|
+
$ref: '#/components/parameters/streetlightId'
|
|
97
|
+
subscribe:
|
|
98
|
+
message:
|
|
99
|
+
$ref: '#/components/messages/turnOnOff'
|
|
100
|
+
'smartylighting/streetlights/1/0/action/{streetlightId}/turn/off':
|
|
101
|
+
parameters:
|
|
102
|
+
streetlightId:
|
|
103
|
+
$ref: '#/components/parameters/streetlightId'
|
|
104
|
+
subscribe:
|
|
105
|
+
message:
|
|
106
|
+
$ref: '#/components/messages/turnOnOff'
|
|
107
|
+
'smartylighting/streetlights/1/0/action/{streetlightId}/dim':
|
|
108
|
+
parameters:
|
|
109
|
+
streetlightId:
|
|
110
|
+
$ref: '#/components/parameters/streetlightId'
|
|
111
|
+
subscribe:
|
|
112
|
+
message:
|
|
113
|
+
$ref: '#/components/messages/dimLight'
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
asyncapi: 2.1.0
|
|
2
|
+
info:
|
|
3
|
+
title: Streetlights API
|
|
4
|
+
version: 1.0.0
|
|
5
|
+
description: "The Smartylighting Streetlights API allows you to remotely manage the city lights.\n\n### Check out its awesome features:\n\n* Turn a specific streetlight on/off \U0001F303\n* Dim a specific streetlight \U0001F60E\n* Receive real-time information about environmental lighting conditions \U0001F4C8\n"
|
|
6
|
+
license:
|
|
7
|
+
name: Apache 2.0
|
|
8
|
+
url: 'https://www.apache.org/licenses/LICENSE-2.0'
|
|
9
|
+
servers:
|
|
10
|
+
default:
|
|
11
|
+
url: 'api.streetlights.smartylighting.com:{port}'
|
|
12
|
+
description: Test broker
|
|
13
|
+
variables:
|
|
14
|
+
port:
|
|
15
|
+
description: Secure connection (TLS) is available through port 8883.
|
|
16
|
+
default: '1883'
|
|
17
|
+
enum:
|
|
18
|
+
- '1883'
|
|
19
|
+
- '8883'
|
|
20
|
+
protocol: mqtt
|
|
21
|
+
security:
|
|
22
|
+
- apiKey: []
|
|
23
|
+
components:
|
|
24
|
+
messages:
|
|
25
|
+
lightMeasured:
|
|
26
|
+
summary: >-
|
|
27
|
+
Inform about environmental lighting conditions for a particular
|
|
28
|
+
streetlight.
|
|
29
|
+
payload:
|
|
30
|
+
$ref: '#/components/schemas/lightMeasuredPayload'
|
|
31
|
+
turnOnOff:
|
|
32
|
+
summary: Command a particular streetlight to turn the lights on or off.
|
|
33
|
+
payload:
|
|
34
|
+
$ref: '#/components/schemas/turnOnOffPayload'
|
|
35
|
+
dimLight:
|
|
36
|
+
summary: Command a particular streetlight to dim the lights.
|
|
37
|
+
payload:
|
|
38
|
+
$ref: '#/components/schemas/dimLightPayload'
|
|
39
|
+
schemas:
|
|
40
|
+
lightMeasuredPayload:
|
|
41
|
+
type: object
|
|
42
|
+
properties:
|
|
43
|
+
lumens:
|
|
44
|
+
type: integer
|
|
45
|
+
minimum: 0
|
|
46
|
+
description: Light intensity measured in lumens.
|
|
47
|
+
sentAt:
|
|
48
|
+
$ref: '#/components/schemas/sentAt'
|
|
49
|
+
turnOnOffPayload:
|
|
50
|
+
type: object
|
|
51
|
+
properties:
|
|
52
|
+
command:
|
|
53
|
+
type: string
|
|
54
|
+
enum:
|
|
55
|
+
- 'on'
|
|
56
|
+
- 'off'
|
|
57
|
+
description: Whether to turn on or off the light.
|
|
58
|
+
sentAt:
|
|
59
|
+
$ref: '#/components/schemas/sentAt'
|
|
60
|
+
dimLightPayload:
|
|
61
|
+
type: object
|
|
62
|
+
properties:
|
|
63
|
+
percentage:
|
|
64
|
+
type: integer
|
|
65
|
+
description: Percentage to which the light should be dimmed to.
|
|
66
|
+
minimum: 0
|
|
67
|
+
maximum: 100
|
|
68
|
+
sentAt:
|
|
69
|
+
$ref: '#/components/schemas/sentAt'
|
|
70
|
+
sentAt:
|
|
71
|
+
type: string
|
|
72
|
+
format: date-time
|
|
73
|
+
description: Date and time when the message was sent.
|
|
74
|
+
securitySchemes:
|
|
75
|
+
apiKey:
|
|
76
|
+
type: apiKey
|
|
77
|
+
in: user
|
|
78
|
+
description: Provide your API key as the user and leave the password empty.
|
|
79
|
+
parameters:
|
|
80
|
+
streetlightId:
|
|
81
|
+
name: streetlightId
|
|
82
|
+
description: The ID of the streetlight.
|
|
83
|
+
schema:
|
|
84
|
+
type: string
|
|
85
|
+
channels:
|
|
86
|
+
'smartylighting/streetlights/1/0/event/{streetlightId}/lighting/measured':
|
|
87
|
+
parameters:
|
|
88
|
+
streetlightId:
|
|
89
|
+
$ref: '#/components/parameters/streetlightId'
|
|
90
|
+
publish:
|
|
91
|
+
message:
|
|
92
|
+
$ref: '#/components/messages/lightMeasured'
|
|
93
|
+
'smartylighting/streetlights/1/0/action/{streetlightId}/turn/on':
|
|
94
|
+
parameters:
|
|
95
|
+
streetlightId:
|
|
96
|
+
$ref: '#/components/parameters/streetlightId'
|
|
97
|
+
subscribe:
|
|
98
|
+
message:
|
|
99
|
+
$ref: '#/components/messages/turnOnOff'
|
|
100
|
+
'smartylighting/streetlights/1/0/action/{streetlightId}/turn/off':
|
|
101
|
+
parameters:
|
|
102
|
+
streetlightId:
|
|
103
|
+
$ref: '#/components/parameters/streetlightId'
|
|
104
|
+
subscribe:
|
|
105
|
+
message:
|
|
106
|
+
$ref: '#/components/messages/turnOnOff'
|
|
107
|
+
'smartylighting/streetlights/1/0/action/{streetlightId}/dim':
|
|
108
|
+
parameters:
|
|
109
|
+
streetlightId:
|
|
110
|
+
$ref: '#/components/parameters/streetlightId'
|
|
111
|
+
subscribe:
|
|
112
|
+
message:
|
|
113
|
+
$ref: '#/components/messages/dimLight'
|