@asyncapi/converter 0.5.0 → 0.7.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/CODEOWNERS ADDED
@@ -0,0 +1,8 @@
1
+ # This file provides an overview of code owners in this repository.
2
+
3
+ # Each line is a file pattern followed by one or more owners.
4
+ # The last matching pattern has the most precedence.
5
+ # For more details, read the following article on GitHub: https://help.github.com/articles/about-codeowners/.
6
+
7
+ # The default owners are automatically added as reviewers when you open a pull request unless different owners are specified in the file.
8
+ * @fmvilas @magicmatatjahu @derberg @github-actions[bot]
package/cli.js CHANGED
@@ -32,7 +32,7 @@ if (!asyncapiFile) {
32
32
  program.help(); // This exits the process
33
33
  }
34
34
  if (!version) {
35
- version = '2.1.0';
35
+ version = '2.3.0';
36
36
  }
37
37
 
38
38
  try {
package/lib/index.js CHANGED
@@ -21,6 +21,8 @@ const conversions = {
21
21
  '2.0.0-rc2': from__2_0_0_rc1__to__2_0_0_rc2,
22
22
  '2.0.0': from__2_0_0_rc2__to__2_0_0,
23
23
  '2.1.0': from__2_0_0__to__2_1_0,
24
+ '2.2.0': from__2_1_0__to__2_2_0,
25
+ '2.3.0': from__2_2_0__to__2_3_0,
24
26
  }
25
27
  const conversionVersions = Object.keys(conversions);
26
28
 
@@ -71,12 +73,12 @@ function from__1_2_0__to__2_0_0_rc1(asyncapi1, options) { // NOSONAR
71
73
 
72
74
  result.asyncapi = '2.0.0-rc1';
73
75
  result.id = options.id || `urn:${asyncapi1.info.title.toLowerCase().split(' ').join('.')}`;
74
-
76
+
75
77
  if (asyncapi1.servers) {
76
78
  const security = asyncapi1.security;
77
79
  result.servers = asyncapi1.servers.map(server => {
78
80
  const { scheme, schemeVersion, ...rest } = server;
79
-
81
+
80
82
  const out = {
81
83
  ...rest,
82
84
  ...{
@@ -93,9 +95,10 @@ function from__1_2_0__to__2_0_0_rc1(asyncapi1, options) { // NOSONAR
93
95
  return out;
94
96
  });
95
97
  }
96
-
98
+
97
99
  if (asyncapi1.topics) {
98
- result.channels = _.mapKeys(result.topics, (_, topicName) => dotsToSlashes(`${asyncapi1.baseTopic ? `${asyncapi1.baseTopic}.` : ''}${topicName}`));
100
+ const baseTopic = asyncapi1.baseTopic ? `${asyncapi1.baseTopic}.` : "";
101
+ result.channels = _.mapKeys(result.topics, (__, topicName) => dotsToSlashes(`${baseTopic}${topicName}`));
99
102
  _.map(result.channels, ch => {
100
103
  if (ch.publish) {
101
104
  ch.publish = { message: ch.publish };
@@ -113,7 +116,7 @@ function from__1_2_0__to__2_0_0_rc1(asyncapi1, options) { // NOSONAR
113
116
  '/': eventToChannel(asyncapi1.events),
114
117
  };
115
118
  }
116
-
119
+
117
120
  delete result.topics;
118
121
  delete result.stream;
119
122
  delete result.events;
@@ -128,7 +131,7 @@ function from__2_0_0_rc1__to__2_0_0_rc2(asyncapi2rc1, options) { // NOSONAR
128
131
 
129
132
  result.asyncapi = '2.0.0-rc2';
130
133
  result.id = result.id || options.id;
131
-
134
+
132
135
  if (asyncapi2rc1.servers) {
133
136
  const serverMap = {};
134
137
  asyncapi2rc1.servers.forEach((server, index) => {
@@ -138,12 +141,12 @@ function from__2_0_0_rc1__to__2_0_0_rc2(asyncapi2rc1, options) { // NOSONAR
138
141
  });
139
142
  result.servers = serverMap;
140
143
  }
141
-
144
+
142
145
  if (result.channels) {
143
146
  _.each(result.channels, (channel, channelName) => {
144
147
  if (channel.parameters) {
145
148
  const parametersMap = {};
146
- const paramNames = channelName.match(/\{([^\}]+)\}/g).map(p => p.substr(1, p.length - 2));
149
+ const paramNames = channelName.match(/\{([^\}]{1,100})\}/g).map(p => p.substr(1, p.length - 2));
147
150
  channel.parameters.forEach((parameter, index) => {
148
151
  const name = parameter.name || paramNames[index];
149
152
  if (parameter.name) delete parameter.name;
@@ -156,7 +159,7 @@ function from__2_0_0_rc1__to__2_0_0_rc2(asyncapi2rc1, options) { // NOSONAR
156
159
  const message = channel.publish.message;
157
160
  convertMessage(message);
158
161
  }
159
-
162
+
160
163
  if (channel.subscribe && channel.subscribe.message) {
161
164
  const message = channel.subscribe.message;
162
165
  convertMessage(message);
@@ -176,7 +179,7 @@ function from__2_0_0_rc1__to__2_0_0_rc2(asyncapi2rc1, options) { // NOSONAR
176
179
  channel.subscribe.bindings = channel.subscribe.protocolInfo;
177
180
  delete channel.subscribe.protocolInfo;
178
181
  }
179
- });
182
+ });
180
183
  }
181
184
 
182
185
  if (!options.id) delete result.id;
@@ -190,8 +193,17 @@ function from__2_0_0_rc2__to__2_0_0(asyncapi2rc2, options) {
190
193
  return result;
191
194
  }
192
195
 
193
- function from__2_0_0__to__2_1_0(asyncapi2) {
194
- const result = asyncapi2;
195
- result.asyncapi = '2.1.0';
196
- return result;
196
+ function from__2_0_0__to__2_1_0(asyncapi) {
197
+ asyncapi.asyncapi = '2.1.0';
198
+ return asyncapi;
197
199
  }
200
+
201
+ function from__2_1_0__to__2_2_0(asyncapi) {
202
+ asyncapi.asyncapi = '2.2.0';
203
+ return asyncapi;
204
+ }
205
+
206
+ function from__2_2_0__to__2_3_0(asyncapi) {
207
+ asyncapi.asyncapi = '2.3.0';
208
+ return asyncapi;
209
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@asyncapi/converter",
3
- "version": "0.5.0",
3
+ "version": "0.7.0",
4
4
  "description": "Convert AsyncAPI documents from older to newer versions.",
5
5
  "bin": {
6
6
  "asyncapi-converter": "cli.js"
@@ -11,9 +11,7 @@
11
11
  "lint": "echo 'no linter configured yet'",
12
12
  "release": "semantic-release",
13
13
  "generate:assets": "echo 'No additional assets need to be generated at the moment'",
14
- "bump:version": "npm --no-git-tag-version --allow-same-version version $VERSION",
15
- "get:version": "echo $npm_package_version",
16
- "get:name": "echo $npm_package_name"
14
+ "bump:version": "npm --no-git-tag-version --allow-same-version version $VERSION"
17
15
  },
18
16
  "keywords": [
19
17
  "asyncapi",
@@ -35,18 +33,18 @@
35
33
  "author": "Fran Mendez <fmvilas@gmail.com> (fmvilas.com)",
36
34
  "license": "Apache-2.0",
37
35
  "dependencies": {
38
- "commander": "^2.20.0",
39
- "js-yaml": "^3.13.1",
40
- "lodash": "^4.17.15",
41
- "mocha": "^6.1.4"
36
+ "commander": "^8.3.0",
37
+ "js-yaml": "^3.14.1",
38
+ "lodash": "^4.17.21"
42
39
  },
43
40
  "devDependencies": {
44
- "@semantic-release/commit-analyzer": "^8.0.1",
45
- "@semantic-release/github": "^7.0.4",
46
- "@semantic-release/npm": "^7.0.3",
47
- "@semantic-release/release-notes-generator": "^9.0.1",
48
- "conventional-changelog-conventionalcommits": "^4.2.3",
49
- "semantic-release": "^17.0.4"
41
+ "@semantic-release/commit-analyzer": "^9.0.2",
42
+ "@semantic-release/github": "^8.0.2",
43
+ "@semantic-release/npm": "^8.0.3",
44
+ "@semantic-release/release-notes-generator": "^10.0.3",
45
+ "conventional-changelog-conventionalcommits": "^4.6.3",
46
+ "semantic-release": "^18.0.1",
47
+ "mocha": "^9.1.3"
50
48
  },
51
49
  "release": {
52
50
  "branches": [
package/test/index.js CHANGED
@@ -165,6 +165,34 @@ describe('#convert', () => {
165
165
  const result = convert(input, '2.1.0');
166
166
  assertResults(output, result);
167
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
+ it('should convert from 2.1.0 to 2.3.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.3.0', 'streetlights.yml'), 'utf8');
186
+ const result = convert(input, '2.3.0');
187
+ assertResults(output, result);
188
+ });
189
+
190
+ it('should convert from 2.2.0 to 2.3.0', () => {
191
+ const input = fs.readFileSync(path.resolve(__dirname, 'input', '2.2.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
+ });
168
196
  });
169
197
 
170
198
  /*
@@ -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.2.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.2.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.3.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'