@asyncapi/converter 0.9.0 → 0.10.0
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/README.md +23 -3
- package/lib/convert.d.ts +3 -0
- package/lib/convert.js +193 -0
- package/lib/index.d.ts +2 -0
- package/lib/index.js +5 -212
- package/lib/interfaces.d.ts +7 -0
- package/lib/interfaces.js +2 -0
- package/lib/utils.d.ts +21 -0
- package/lib/utils.js +114 -0
- package/package.json +21 -6
- package/.github/workflows/add-good-first-issue-labels.yml +0 -68
- package/.github/workflows/automerge-for-humans-add-ready-to-merge-or-do-not-merge-label.yml +0 -54
- package/.github/workflows/automerge-for-humans-merging.yml +0 -32
- package/.github/workflows/automerge-for-humans-remove-ready-to-merge-label-on-edit.yml +0 -35
- package/.github/workflows/automerge-orphans.yml +0 -63
- package/.github/workflows/automerge.yml +0 -50
- package/.github/workflows/autoupdate.yml +0 -32
- package/.github/workflows/bump.yml +0 -33
- package/.github/workflows/help-command.yml +0 -43
- package/.github/workflows/if-go-pr-testing.yml +0 -68
- package/.github/workflows/if-nodejs-pr-testing.yml +0 -60
- package/.github/workflows/if-nodejs-release.yml +0 -85
- package/.github/workflows/if-nodejs-version-bump.yml +0 -48
- package/.github/workflows/issues-prs-notifications.yml +0 -72
- package/.github/workflows/lint-pr-title.yml +0 -22
- package/.github/workflows/notify-tsc-members-mention.yml +0 -142
- package/.github/workflows/release-announcements.yml +0 -76
- package/.github/workflows/sentiment-analysis.yml +0 -44
- package/.github/workflows/stale-issues-prs.yml +0 -42
- package/.github/workflows/welcome-first-time-contrib.yml +0 -83
- package/CODEOWNERS +0 -8
- package/lib/helpers.js +0 -109
- package/test/index.js +0 -257
- package/test/input/1.0.0/streetlights.yml +0 -120
- package/test/input/1.1.0/streetlights.yml +0 -120
- package/test/input/1.2.0/gitter-streaming.yml +0 -140
- package/test/input/1.2.0/slack-rtm.yml +0 -876
- package/test/input/1.2.0/streetlights.yml +0 -120
- package/test/input/2.0.0/streetlights.json +0 -172
- package/test/input/2.0.0/streetlights.yml +0 -112
- package/test/input/2.0.0-rc1/streetlights.yml +0 -109
- package/test/input/2.0.0-rc2/streetlights.yml +0 -112
- package/test/input/2.1.0/streetlights.yml +0 -112
- package/test/input/2.2.0/streetlights.yml +0 -112
- package/test/output/2.0.0/gitter-streaming.yml +0 -137
- package/test/output/2.0.0/slack-rtm.yml +0 -879
- package/test/output/2.0.0/streetlights.yml +0 -112
- package/test/output/2.0.0-rc1/gitter-streaming.yml +0 -137
- package/test/output/2.0.0-rc1/slack-rtm.yml +0 -879
- package/test/output/2.0.0-rc1/streetlights.yml +0 -109
- package/test/output/2.0.0-rc2/gitter-streaming.yml +0 -137
- package/test/output/2.0.0-rc2/slack-rtm.yml +0 -879
- package/test/output/2.0.0-rc2/streetlights.yml +0 -112
- package/test/output/2.1.0/streetlights.json +0 -172
- package/test/output/2.1.0/streetlights.yml +0 -112
- package/test/output/2.2.0/streetlights.yml +0 -112
- package/test/output/2.3.0/streetlights.yml +0 -112
package/test/index.js
DELETED
|
@@ -1,257 +0,0 @@
|
|
|
1
|
-
const assert = require('assert');
|
|
2
|
-
const fs = require('fs');
|
|
3
|
-
const path = require("path");
|
|
4
|
-
const { convert } = require('../lib');
|
|
5
|
-
const { serialize } = require('../lib/helpers');
|
|
6
|
-
|
|
7
|
-
describe('#convert', () => {
|
|
8
|
-
it('should not convert to lowest version', () => {
|
|
9
|
-
assert.throws(
|
|
10
|
-
() => convert(`asyncapi: '2.1.0'`, '2.0.0'),
|
|
11
|
-
/^Error: Cannot downgrade from 2.1.0 to 2.0.0.$/
|
|
12
|
-
);
|
|
13
|
-
});
|
|
14
|
-
|
|
15
|
-
it('should not convert from non existing version', () => {
|
|
16
|
-
assert.throws(
|
|
17
|
-
() => convert(`asyncapi: '2.0.0-rc3'`, '2.1.0'),
|
|
18
|
-
/^Error: Cannot convert from 2.0.0-rc3 to 2.1.0.$/
|
|
19
|
-
);
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
it('should not convert to this same version', () => {
|
|
23
|
-
assert.throws(
|
|
24
|
-
() => convert(`asyncapi: '2.1.0'`, '2.1.0'),
|
|
25
|
-
/^Error: Cannot convert to the same version.$/
|
|
26
|
-
);
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
it('should convert from 1.0.0 to 2.0.0-rc1', () => {
|
|
30
|
-
const input = fs.readFileSync(path.resolve(__dirname, 'input', '1.0.0', 'streetlights.yml'), 'utf8');
|
|
31
|
-
const output = fs.readFileSync(path.resolve(__dirname, 'output', '2.0.0-rc1', 'streetlights.yml'), 'utf8');
|
|
32
|
-
const result = convert(input, '2.0.0-rc1');
|
|
33
|
-
assertResults(output, result);
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
it('should convert from 1.1.0 to 2.0.0-rc1', () => {
|
|
37
|
-
const input = fs.readFileSync(path.resolve(__dirname, 'input', '1.1.0', 'streetlights.yml'), 'utf8');
|
|
38
|
-
const output = fs.readFileSync(path.resolve(__dirname, 'output', '2.0.0-rc1', 'streetlights.yml'), 'utf8');
|
|
39
|
-
const result = convert(input, '2.0.0-rc1');
|
|
40
|
-
assertResults(output, result);
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
it('should convert from 1.2.0 to 2.0.0-rc1', () => {
|
|
44
|
-
const input = fs.readFileSync(path.resolve(__dirname, 'input', '1.2.0', 'streetlights.yml'), 'utf8');
|
|
45
|
-
const output = fs.readFileSync(path.resolve(__dirname, 'output', '2.0.0-rc1', 'streetlights.yml'), 'utf8');
|
|
46
|
-
const result = convert(input, '2.0.0-rc1');
|
|
47
|
-
assertResults(output, result);
|
|
48
|
-
});
|
|
49
|
-
|
|
50
|
-
it('should convert from 1.2.0 to 2.0.0-rc1 - stream', () => {
|
|
51
|
-
const input = fs.readFileSync(path.resolve(__dirname, 'input', '1.2.0', 'gitter-streaming.yml'), 'utf8');
|
|
52
|
-
const output = fs.readFileSync(path.resolve(__dirname, 'output', '2.0.0-rc1', 'gitter-streaming.yml'), 'utf8');
|
|
53
|
-
const result = convert(input, '2.0.0-rc1');
|
|
54
|
-
assertResults(output, result);
|
|
55
|
-
});
|
|
56
|
-
|
|
57
|
-
it('should convert from 1.2.0 to 2.0.0-rc1 - events', () => {
|
|
58
|
-
const input = fs.readFileSync(path.resolve(__dirname, 'input', '1.2.0', 'slack-rtm.yml'), 'utf8');
|
|
59
|
-
const output = fs.readFileSync(path.resolve(__dirname, 'output', '2.0.0-rc1', 'slack-rtm.yml'), 'utf8');
|
|
60
|
-
const result = convert(input, '2.0.0-rc1');
|
|
61
|
-
assertResults(output, result);
|
|
62
|
-
});
|
|
63
|
-
|
|
64
|
-
it('should convert from 1.0.0 to 2.0.0-rc2', () => {
|
|
65
|
-
const input = fs.readFileSync(path.resolve(__dirname, 'input', '1.0.0', 'streetlights.yml'), 'utf8');
|
|
66
|
-
const output = fs.readFileSync(path.resolve(__dirname, 'output', '2.0.0-rc2', 'streetlights.yml'), 'utf8');
|
|
67
|
-
const result = convert(input, '2.0.0-rc2');
|
|
68
|
-
assertResults(output, result);
|
|
69
|
-
});
|
|
70
|
-
|
|
71
|
-
it('should convert from 1.1.0 to 2.0.0-rc2', () => {
|
|
72
|
-
const input = fs.readFileSync(path.resolve(__dirname, 'input', '1.1.0', 'streetlights.yml'), 'utf8');
|
|
73
|
-
const output = fs.readFileSync(path.resolve(__dirname, 'output', '2.0.0-rc2', 'streetlights.yml'), 'utf8');
|
|
74
|
-
const result = convert(input, '2.0.0-rc2');
|
|
75
|
-
assertResults(output, result);
|
|
76
|
-
});
|
|
77
|
-
|
|
78
|
-
it('should convert from 1.2.0 to 2.0.0-rc2 - stream', () => {
|
|
79
|
-
const input = fs.readFileSync(path.resolve(__dirname, 'input', '1.2.0', 'gitter-streaming.yml'), 'utf8');
|
|
80
|
-
const output = fs.readFileSync(path.resolve(__dirname, 'output', '2.0.0-rc2', 'gitter-streaming.yml'), 'utf8');
|
|
81
|
-
const result = convert(input, '2.0.0-rc2');
|
|
82
|
-
assertResults(output, result);
|
|
83
|
-
});
|
|
84
|
-
|
|
85
|
-
it('should convert from 1.2.0 to 2.0.0-rc2 - events', () => {
|
|
86
|
-
const input = fs.readFileSync(path.resolve(__dirname, 'input', '1.2.0', 'slack-rtm.yml'), 'utf8');
|
|
87
|
-
const output = fs.readFileSync(path.resolve(__dirname, 'output', '2.0.0-rc2', 'slack-rtm.yml'), 'utf8');
|
|
88
|
-
const result = convert(input, '2.0.0-rc2');
|
|
89
|
-
assertResults(output, result);
|
|
90
|
-
});
|
|
91
|
-
|
|
92
|
-
it('should convert from 1.2.0 to 2.0.0-rc2', () => {
|
|
93
|
-
const input = fs.readFileSync(path.resolve(__dirname, 'input', '1.2.0', 'streetlights.yml'), 'utf8');
|
|
94
|
-
const output = fs.readFileSync(path.resolve(__dirname, 'output', '2.0.0-rc2', 'streetlights.yml'), 'utf8');
|
|
95
|
-
const result = convert(input, '2.0.0-rc2');
|
|
96
|
-
assertResults(output, result);
|
|
97
|
-
});
|
|
98
|
-
|
|
99
|
-
it('should convert from 1.0.0 to 2.0.0', () => {
|
|
100
|
-
const input = fs.readFileSync(path.resolve(__dirname, 'input', '1.0.0', 'streetlights.yml'), 'utf8');
|
|
101
|
-
const output = fs.readFileSync(path.resolve(__dirname, 'output', '2.0.0', 'streetlights.yml'), 'utf8');
|
|
102
|
-
const result = convert(input, '2.0.0');
|
|
103
|
-
assertResults(output, result);
|
|
104
|
-
});
|
|
105
|
-
|
|
106
|
-
it('should convert from 1.1.0 to 2.0.0', () => {
|
|
107
|
-
const input = fs.readFileSync(path.resolve(__dirname, 'input', '1.1.0', 'streetlights.yml'), 'utf8');
|
|
108
|
-
const output = fs.readFileSync(path.resolve(__dirname, 'output', '2.0.0', 'streetlights.yml'), 'utf8');
|
|
109
|
-
const result = convert(input, '2.0.0');
|
|
110
|
-
assertResults(output, result);
|
|
111
|
-
});
|
|
112
|
-
|
|
113
|
-
it('should convert from 1.2.0 to 2.0.0', () => {
|
|
114
|
-
const input = fs.readFileSync(path.resolve(__dirname, 'input', '1.2.0', 'streetlights.yml'), 'utf8');
|
|
115
|
-
const output = fs.readFileSync(path.resolve(__dirname, 'output', '2.0.0', 'streetlights.yml'), 'utf8');
|
|
116
|
-
const result = convert(input, '2.0.0');
|
|
117
|
-
assertResults(output, result);
|
|
118
|
-
});
|
|
119
|
-
|
|
120
|
-
it('should convert from 2.0.0-rc1 to 2.0.0', () => {
|
|
121
|
-
const input = fs.readFileSync(path.resolve(__dirname, 'input', '2.0.0-rc1', 'streetlights.yml'), 'utf8');
|
|
122
|
-
const output = fs.readFileSync(path.resolve(__dirname, 'output', '2.0.0', 'streetlights.yml'), 'utf8');
|
|
123
|
-
const result = convert(input, '2.0.0');
|
|
124
|
-
assertResults(output, result);
|
|
125
|
-
});
|
|
126
|
-
|
|
127
|
-
it('should convert from 2.0.0-rc2 to 2.0.0', () => {
|
|
128
|
-
const input = fs.readFileSync(path.resolve(__dirname, 'input', '2.0.0-rc2', 'streetlights.yml'), 'utf8');
|
|
129
|
-
const output = fs.readFileSync(path.resolve(__dirname, 'output', '2.0.0', 'streetlights.yml'), 'utf8');
|
|
130
|
-
const result = convert(input, '2.0.0');
|
|
131
|
-
assertResults(output, result);
|
|
132
|
-
});
|
|
133
|
-
|
|
134
|
-
it('should convert from 1.0.0 to 2.1.0', () => {
|
|
135
|
-
const input = fs.readFileSync(path.resolve(__dirname, 'input', '1.0.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.1.0 to 2.1.0', () => {
|
|
142
|
-
const input = fs.readFileSync(path.resolve(__dirname, 'input', '1.1.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);
|
|
146
|
-
});
|
|
147
|
-
|
|
148
|
-
it('should convert from 1.2.0 to 2.1.0', () => {
|
|
149
|
-
const input = fs.readFileSync(path.resolve(__dirname, 'input', '1.2.0', '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-rc1 to 2.1.0', () => {
|
|
156
|
-
const input = fs.readFileSync(path.resolve(__dirname, 'input', '2.0.0-rc1', '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-rc2 to 2.1.0', () => {
|
|
163
|
-
const input = fs.readFileSync(path.resolve(__dirname, 'input', '2.0.0-rc2', '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.1.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.1.0', 'streetlights.yml'), 'utf8');
|
|
172
|
-
const result = convert(input, '2.1.0');
|
|
173
|
-
assertResults(output, result);
|
|
174
|
-
});
|
|
175
|
-
|
|
176
|
-
it('should convert from 2.0.0 to 2.2.0', () => {
|
|
177
|
-
const input = fs.readFileSync(path.resolve(__dirname, 'input', '2.0.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
|
-
it('should convert from 2.1.0 to 2.2.0', () => {
|
|
184
|
-
const input = fs.readFileSync(path.resolve(__dirname, 'input', '2.1.0', 'streetlights.yml'), 'utf8');
|
|
185
|
-
const output = fs.readFileSync(path.resolve(__dirname, 'output', '2.2.0', 'streetlights.yml'), 'utf8');
|
|
186
|
-
const result = convert(input, '2.2.0');
|
|
187
|
-
assertResults(output, result);
|
|
188
|
-
});
|
|
189
|
-
|
|
190
|
-
it('should convert from 2.1.0 to 2.3.0', () => {
|
|
191
|
-
const input = fs.readFileSync(path.resolve(__dirname, 'input', '2.1.0', 'streetlights.yml'), 'utf8');
|
|
192
|
-
const output = fs.readFileSync(path.resolve(__dirname, 'output', '2.3.0', 'streetlights.yml'), 'utf8');
|
|
193
|
-
const result = convert(input, '2.3.0');
|
|
194
|
-
assertResults(output, result);
|
|
195
|
-
});
|
|
196
|
-
|
|
197
|
-
it('should convert from 2.2.0 to 2.3.0', () => {
|
|
198
|
-
const input = fs.readFileSync(path.resolve(__dirname, 'input', '2.2.0', 'streetlights.yml'), 'utf8');
|
|
199
|
-
const output = fs.readFileSync(path.resolve(__dirname, 'output', '2.3.0', 'streetlights.yml'), 'utf8');
|
|
200
|
-
const result = convert(input, '2.3.0');
|
|
201
|
-
assertResults(output, result);
|
|
202
|
-
});
|
|
203
|
-
|
|
204
|
-
it('should convert from 2.0.0 to 2.1.0 (JSON case)', () => {
|
|
205
|
-
const input = fs.readFileSync(path.resolve(__dirname, 'input', '2.0.0', 'streetlights.json'), 'utf8');
|
|
206
|
-
let output = fs.readFileSync(path.resolve(__dirname, 'output', '2.1.0', 'streetlights.json'), 'utf8');
|
|
207
|
-
let result = convert(input, '2.1.0');
|
|
208
|
-
|
|
209
|
-
output = JSON.stringify(JSON.parse(output));
|
|
210
|
-
result = JSON.stringify(JSON.parse(JSON.stringify(result)));
|
|
211
|
-
assert.strictEqual(output, result);
|
|
212
|
-
});
|
|
213
|
-
});
|
|
214
|
-
|
|
215
|
-
describe('#serialize', () => {
|
|
216
|
-
it('should serialize JSON', () => {
|
|
217
|
-
const input = '{"foo": "bar"}';
|
|
218
|
-
const output = serialize(input);
|
|
219
|
-
assert.strictEqual(output.isYAML, false);
|
|
220
|
-
assert.deepEqual(output.parsed, {foo: "bar"});
|
|
221
|
-
});
|
|
222
|
-
|
|
223
|
-
it('should serialize YAML', () => {
|
|
224
|
-
const input = 'foo: bar';
|
|
225
|
-
const output = serialize(input);
|
|
226
|
-
assert.strictEqual(output.isYAML, true);
|
|
227
|
-
assert.deepEqual(output.parsed, {foo: "bar"});
|
|
228
|
-
});
|
|
229
|
-
|
|
230
|
-
it('should serialize YAML (with JSON syntax)', () => {
|
|
231
|
-
const input = '{foo: bar}';
|
|
232
|
-
const output = serialize(input);
|
|
233
|
-
assert.strictEqual(output.isYAML, true);
|
|
234
|
-
assert.deepEqual(output.parsed, {foo: "bar"});
|
|
235
|
-
});
|
|
236
|
-
|
|
237
|
-
it('should throw error', () => {
|
|
238
|
-
const input = '%{foo: bar}';
|
|
239
|
-
try {
|
|
240
|
-
serialize(input);
|
|
241
|
-
} catch(e) {
|
|
242
|
-
assert.strictEqual(e.message, 'AsyncAPI document must be a valid JSON or YAML document.');
|
|
243
|
-
}
|
|
244
|
-
});
|
|
245
|
-
});
|
|
246
|
-
|
|
247
|
-
/*
|
|
248
|
-
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.
|
|
249
|
-
We need to remove all line breaks from the string
|
|
250
|
-
*/
|
|
251
|
-
function removeLineBreaks(str) {
|
|
252
|
-
return str.replace(/\r?\n|\r/g, '')
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
function assertResults(output, result){
|
|
256
|
-
assert.strictEqual(removeLineBreaks(output), removeLineBreaks(result));
|
|
257
|
-
}
|
|
@@ -1,120 +0,0 @@
|
|
|
1
|
-
asyncapi: '1.0.0'
|
|
2
|
-
info:
|
|
3
|
-
title: Streetlights API
|
|
4
|
-
version: '1.0.0'
|
|
5
|
-
description: |
|
|
6
|
-
The Smartylighting Streetlights API allows you to remotely manage the city lights.
|
|
7
|
-
|
|
8
|
-
### Check out its awesome features:
|
|
9
|
-
|
|
10
|
-
* Turn a specific streetlight on/off 🌃
|
|
11
|
-
* Dim a specific streetlight 😎
|
|
12
|
-
* Receive real-time information about environmental lighting conditions 📈
|
|
13
|
-
license:
|
|
14
|
-
name: Apache 2.0
|
|
15
|
-
url: https://www.apache.org/licenses/LICENSE-2.0
|
|
16
|
-
baseTopic: smartylighting.streetlights.1.0
|
|
17
|
-
|
|
18
|
-
servers:
|
|
19
|
-
- url: api.streetlights.smartylighting.com:{port}
|
|
20
|
-
scheme: mqtt
|
|
21
|
-
description: Test broker
|
|
22
|
-
variables:
|
|
23
|
-
port:
|
|
24
|
-
description: Secure connection (TLS) is available through port 8883.
|
|
25
|
-
default: '1883'
|
|
26
|
-
enum:
|
|
27
|
-
- '1883'
|
|
28
|
-
- '8883'
|
|
29
|
-
|
|
30
|
-
security:
|
|
31
|
-
- apiKey: []
|
|
32
|
-
|
|
33
|
-
topics:
|
|
34
|
-
event.{streetlightId}.lighting.measured:
|
|
35
|
-
parameters:
|
|
36
|
-
- $ref: '#/components/parameters/streetlightId'
|
|
37
|
-
publish:
|
|
38
|
-
$ref: '#/components/messages/lightMeasured'
|
|
39
|
-
|
|
40
|
-
action.{streetlightId}.turn.on:
|
|
41
|
-
parameters:
|
|
42
|
-
- $ref: '#/components/parameters/streetlightId'
|
|
43
|
-
subscribe:
|
|
44
|
-
$ref: '#/components/messages/turnOnOff'
|
|
45
|
-
|
|
46
|
-
action.{streetlightId}.turn.off:
|
|
47
|
-
parameters:
|
|
48
|
-
- $ref: '#/components/parameters/streetlightId'
|
|
49
|
-
subscribe:
|
|
50
|
-
$ref: '#/components/messages/turnOnOff'
|
|
51
|
-
|
|
52
|
-
action.{streetlightId}.dim:
|
|
53
|
-
parameters:
|
|
54
|
-
- $ref: '#/components/parameters/streetlightId'
|
|
55
|
-
subscribe:
|
|
56
|
-
$ref: '#/components/messages/dimLight'
|
|
57
|
-
|
|
58
|
-
components:
|
|
59
|
-
messages:
|
|
60
|
-
lightMeasured:
|
|
61
|
-
summary: Inform about environmental lighting conditions for a particular streetlight.
|
|
62
|
-
payload:
|
|
63
|
-
$ref: "#/components/schemas/lightMeasuredPayload"
|
|
64
|
-
turnOnOff:
|
|
65
|
-
summary: Command a particular streetlight to turn the lights on or off.
|
|
66
|
-
payload:
|
|
67
|
-
$ref: "#/components/schemas/turnOnOffPayload"
|
|
68
|
-
dimLight:
|
|
69
|
-
summary: Command a particular streetlight to dim the lights.
|
|
70
|
-
payload:
|
|
71
|
-
$ref: "#/components/schemas/dimLightPayload"
|
|
72
|
-
|
|
73
|
-
schemas:
|
|
74
|
-
lightMeasuredPayload:
|
|
75
|
-
type: object
|
|
76
|
-
properties:
|
|
77
|
-
lumens:
|
|
78
|
-
type: integer
|
|
79
|
-
minimum: 0
|
|
80
|
-
description: Light intensity measured in lumens.
|
|
81
|
-
sentAt:
|
|
82
|
-
$ref: "#/components/schemas/sentAt"
|
|
83
|
-
turnOnOffPayload:
|
|
84
|
-
type: object
|
|
85
|
-
properties:
|
|
86
|
-
command:
|
|
87
|
-
type: string
|
|
88
|
-
enum:
|
|
89
|
-
- on
|
|
90
|
-
- off
|
|
91
|
-
description: Whether to turn on or off the light.
|
|
92
|
-
sentAt:
|
|
93
|
-
$ref: "#/components/schemas/sentAt"
|
|
94
|
-
dimLightPayload:
|
|
95
|
-
type: object
|
|
96
|
-
properties:
|
|
97
|
-
percentage:
|
|
98
|
-
type: integer
|
|
99
|
-
description: Percentage to which the light should be dimmed to.
|
|
100
|
-
minimum: 0
|
|
101
|
-
maximum: 100
|
|
102
|
-
sentAt:
|
|
103
|
-
$ref: "#/components/schemas/sentAt"
|
|
104
|
-
sentAt:
|
|
105
|
-
type: string
|
|
106
|
-
format: date-time
|
|
107
|
-
description: Date and time when the message was sent.
|
|
108
|
-
|
|
109
|
-
securitySchemes:
|
|
110
|
-
apiKey:
|
|
111
|
-
type: apiKey
|
|
112
|
-
in: user
|
|
113
|
-
description: Provide your API key as the user and leave the password empty.
|
|
114
|
-
|
|
115
|
-
parameters:
|
|
116
|
-
streetlightId:
|
|
117
|
-
name: streetlightId
|
|
118
|
-
description: The ID of the streetlight.
|
|
119
|
-
schema:
|
|
120
|
-
type: string
|
|
@@ -1,120 +0,0 @@
|
|
|
1
|
-
asyncapi: '1.1.0'
|
|
2
|
-
info:
|
|
3
|
-
title: Streetlights API
|
|
4
|
-
version: '1.0.0'
|
|
5
|
-
description: |
|
|
6
|
-
The Smartylighting Streetlights API allows you to remotely manage the city lights.
|
|
7
|
-
|
|
8
|
-
### Check out its awesome features:
|
|
9
|
-
|
|
10
|
-
* Turn a specific streetlight on/off 🌃
|
|
11
|
-
* Dim a specific streetlight 😎
|
|
12
|
-
* Receive real-time information about environmental lighting conditions 📈
|
|
13
|
-
license:
|
|
14
|
-
name: Apache 2.0
|
|
15
|
-
url: https://www.apache.org/licenses/LICENSE-2.0
|
|
16
|
-
baseTopic: smartylighting.streetlights.1.0
|
|
17
|
-
|
|
18
|
-
servers:
|
|
19
|
-
- url: api.streetlights.smartylighting.com:{port}
|
|
20
|
-
scheme: mqtt
|
|
21
|
-
description: Test broker
|
|
22
|
-
variables:
|
|
23
|
-
port:
|
|
24
|
-
description: Secure connection (TLS) is available through port 8883.
|
|
25
|
-
default: '1883'
|
|
26
|
-
enum:
|
|
27
|
-
- '1883'
|
|
28
|
-
- '8883'
|
|
29
|
-
|
|
30
|
-
security:
|
|
31
|
-
- apiKey: []
|
|
32
|
-
|
|
33
|
-
topics:
|
|
34
|
-
event.{streetlightId}.lighting.measured:
|
|
35
|
-
parameters:
|
|
36
|
-
- $ref: '#/components/parameters/streetlightId'
|
|
37
|
-
publish:
|
|
38
|
-
$ref: '#/components/messages/lightMeasured'
|
|
39
|
-
|
|
40
|
-
action.{streetlightId}.turn.on:
|
|
41
|
-
parameters:
|
|
42
|
-
- $ref: '#/components/parameters/streetlightId'
|
|
43
|
-
subscribe:
|
|
44
|
-
$ref: '#/components/messages/turnOnOff'
|
|
45
|
-
|
|
46
|
-
action.{streetlightId}.turn.off:
|
|
47
|
-
parameters:
|
|
48
|
-
- $ref: '#/components/parameters/streetlightId'
|
|
49
|
-
subscribe:
|
|
50
|
-
$ref: '#/components/messages/turnOnOff'
|
|
51
|
-
|
|
52
|
-
action.{streetlightId}.dim:
|
|
53
|
-
parameters:
|
|
54
|
-
- $ref: '#/components/parameters/streetlightId'
|
|
55
|
-
subscribe:
|
|
56
|
-
$ref: '#/components/messages/dimLight'
|
|
57
|
-
|
|
58
|
-
components:
|
|
59
|
-
messages:
|
|
60
|
-
lightMeasured:
|
|
61
|
-
summary: Inform about environmental lighting conditions for a particular streetlight.
|
|
62
|
-
payload:
|
|
63
|
-
$ref: "#/components/schemas/lightMeasuredPayload"
|
|
64
|
-
turnOnOff:
|
|
65
|
-
summary: Command a particular streetlight to turn the lights on or off.
|
|
66
|
-
payload:
|
|
67
|
-
$ref: "#/components/schemas/turnOnOffPayload"
|
|
68
|
-
dimLight:
|
|
69
|
-
summary: Command a particular streetlight to dim the lights.
|
|
70
|
-
payload:
|
|
71
|
-
$ref: "#/components/schemas/dimLightPayload"
|
|
72
|
-
|
|
73
|
-
schemas:
|
|
74
|
-
lightMeasuredPayload:
|
|
75
|
-
type: object
|
|
76
|
-
properties:
|
|
77
|
-
lumens:
|
|
78
|
-
type: integer
|
|
79
|
-
minimum: 0
|
|
80
|
-
description: Light intensity measured in lumens.
|
|
81
|
-
sentAt:
|
|
82
|
-
$ref: "#/components/schemas/sentAt"
|
|
83
|
-
turnOnOffPayload:
|
|
84
|
-
type: object
|
|
85
|
-
properties:
|
|
86
|
-
command:
|
|
87
|
-
type: string
|
|
88
|
-
enum:
|
|
89
|
-
- on
|
|
90
|
-
- off
|
|
91
|
-
description: Whether to turn on or off the light.
|
|
92
|
-
sentAt:
|
|
93
|
-
$ref: "#/components/schemas/sentAt"
|
|
94
|
-
dimLightPayload:
|
|
95
|
-
type: object
|
|
96
|
-
properties:
|
|
97
|
-
percentage:
|
|
98
|
-
type: integer
|
|
99
|
-
description: Percentage to which the light should be dimmed to.
|
|
100
|
-
minimum: 0
|
|
101
|
-
maximum: 100
|
|
102
|
-
sentAt:
|
|
103
|
-
$ref: "#/components/schemas/sentAt"
|
|
104
|
-
sentAt:
|
|
105
|
-
type: string
|
|
106
|
-
format: date-time
|
|
107
|
-
description: Date and time when the message was sent.
|
|
108
|
-
|
|
109
|
-
securitySchemes:
|
|
110
|
-
apiKey:
|
|
111
|
-
type: apiKey
|
|
112
|
-
in: user
|
|
113
|
-
description: Provide your API key as the user and leave the password empty.
|
|
114
|
-
|
|
115
|
-
parameters:
|
|
116
|
-
streetlightId:
|
|
117
|
-
name: streetlightId
|
|
118
|
-
description: The ID of the streetlight.
|
|
119
|
-
schema:
|
|
120
|
-
type: string
|
|
@@ -1,140 +0,0 @@
|
|
|
1
|
-
asyncapi: '1.2.0'
|
|
2
|
-
info:
|
|
3
|
-
title: Gitter Streaming API
|
|
4
|
-
version: '1.0.0'
|
|
5
|
-
|
|
6
|
-
servers:
|
|
7
|
-
- url: https://stream.gitter.im/v1/rooms/{roomId}/{resource}
|
|
8
|
-
scheme: https
|
|
9
|
-
schemeVersion: '1.1'
|
|
10
|
-
variables:
|
|
11
|
-
roomId:
|
|
12
|
-
description: Id of the Gitter room.
|
|
13
|
-
resource:
|
|
14
|
-
description: The resource to consume.
|
|
15
|
-
enum:
|
|
16
|
-
- chatMessages
|
|
17
|
-
- events
|
|
18
|
-
|
|
19
|
-
security:
|
|
20
|
-
- httpBearerToken: []
|
|
21
|
-
|
|
22
|
-
stream:
|
|
23
|
-
framing:
|
|
24
|
-
type: 'chunked'
|
|
25
|
-
delimiter: '\n'
|
|
26
|
-
read:
|
|
27
|
-
- $ref: '#/components/messages/chatMessage'
|
|
28
|
-
- $ref: '#/components/messages/heartbeat'
|
|
29
|
-
|
|
30
|
-
components:
|
|
31
|
-
securitySchemes:
|
|
32
|
-
httpBearerToken:
|
|
33
|
-
type: http
|
|
34
|
-
scheme: bearer
|
|
35
|
-
messages:
|
|
36
|
-
chatMessage:
|
|
37
|
-
summary: >-
|
|
38
|
-
A message represents an individual chat message sent to a room.
|
|
39
|
-
They are a sub-resource of a room.
|
|
40
|
-
payload:
|
|
41
|
-
type: object
|
|
42
|
-
properties:
|
|
43
|
-
id:
|
|
44
|
-
type: string
|
|
45
|
-
description: ID of the message.
|
|
46
|
-
text:
|
|
47
|
-
type: string
|
|
48
|
-
description: Original message in plain-text/markdown.
|
|
49
|
-
html:
|
|
50
|
-
type: string
|
|
51
|
-
description: HTML formatted message.
|
|
52
|
-
sent:
|
|
53
|
-
type: string
|
|
54
|
-
format: date-time
|
|
55
|
-
description: ISO formatted date of the message.
|
|
56
|
-
fromUser:
|
|
57
|
-
type: object
|
|
58
|
-
description: User that sent the message.
|
|
59
|
-
properties:
|
|
60
|
-
id:
|
|
61
|
-
type: string
|
|
62
|
-
description: Gitter User ID.
|
|
63
|
-
username:
|
|
64
|
-
type: string
|
|
65
|
-
description: Gitter/GitHub username.
|
|
66
|
-
displayName:
|
|
67
|
-
type: string
|
|
68
|
-
description: Gitter/GitHub user real name.
|
|
69
|
-
url:
|
|
70
|
-
type: string
|
|
71
|
-
description: Path to the user on Gitter.
|
|
72
|
-
avatarUrl:
|
|
73
|
-
type: string
|
|
74
|
-
format: uri
|
|
75
|
-
description: User avatar URI.
|
|
76
|
-
avatarUrlSmall:
|
|
77
|
-
type: string
|
|
78
|
-
format: uri
|
|
79
|
-
description: User avatar URI (small).
|
|
80
|
-
avatarUrlMedium:
|
|
81
|
-
type: string
|
|
82
|
-
format: uri
|
|
83
|
-
description: User avatar URI (medium).
|
|
84
|
-
v:
|
|
85
|
-
type: number
|
|
86
|
-
description: Version.
|
|
87
|
-
gv:
|
|
88
|
-
type: string
|
|
89
|
-
description: Stands for "Gravatar version" and is used for cache busting.
|
|
90
|
-
unread:
|
|
91
|
-
type: boolean
|
|
92
|
-
description: Boolean that indicates if the current user has read the message.
|
|
93
|
-
readBy:
|
|
94
|
-
type: number
|
|
95
|
-
description: Number of users that have read the message.
|
|
96
|
-
urls:
|
|
97
|
-
type: array
|
|
98
|
-
description: List of URLs present in the message.
|
|
99
|
-
items:
|
|
100
|
-
type: string
|
|
101
|
-
format: uri
|
|
102
|
-
mentions:
|
|
103
|
-
type: array
|
|
104
|
-
description: List of @Mentions in the message.
|
|
105
|
-
items:
|
|
106
|
-
type: object
|
|
107
|
-
properties:
|
|
108
|
-
screenName:
|
|
109
|
-
type: string
|
|
110
|
-
userId:
|
|
111
|
-
type: string
|
|
112
|
-
userIds:
|
|
113
|
-
type: array
|
|
114
|
-
items:
|
|
115
|
-
type: string
|
|
116
|
-
issues:
|
|
117
|
-
type: array
|
|
118
|
-
description: 'List of #Issues referenced in the message.'
|
|
119
|
-
items:
|
|
120
|
-
type: object
|
|
121
|
-
properties:
|
|
122
|
-
number:
|
|
123
|
-
type: string
|
|
124
|
-
meta:
|
|
125
|
-
type: array
|
|
126
|
-
description: Metadata. This is currently not used for anything.
|
|
127
|
-
items: {}
|
|
128
|
-
v:
|
|
129
|
-
type: number
|
|
130
|
-
description: Version.
|
|
131
|
-
gv:
|
|
132
|
-
type: string
|
|
133
|
-
description: Stands for "Gravatar version" and is used for cache busting.
|
|
134
|
-
|
|
135
|
-
heartbeat:
|
|
136
|
-
summary: Its purpose is to keep the connection alive.
|
|
137
|
-
payload:
|
|
138
|
-
type: string
|
|
139
|
-
enum:
|
|
140
|
-
- "\n"
|