@asyncapi/converter 0.6.2 → 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.
@@ -11,7 +11,7 @@ on:
11
11
 
12
12
  jobs:
13
13
  add-labels:
14
- if: github.event.issue && github.event.issue.state != 'closed'
14
+ if: ${{!github.event.issue.pull_request && github.event.issue.state != 'closed' && github.actor != 'asyncapi-bot'}}
15
15
  runs-on: ubuntu-latest
16
16
  steps:
17
17
  - name: Add label
@@ -32,7 +32,7 @@ jobs:
32
32
  values[1] = 'docs';
33
33
  }
34
34
  if(values.length != 2 || !areas.includes(values[1])){
35
- const message = `Hey @${context.payload.sender.login}, something is wrong with your command please use \`/help\` for help.`
35
+ const message = `Hey @${context.payload.sender.login}, your message doesn't follow the requirements, you can try \`/help\`.`
36
36
 
37
37
  await github.rest.issues.createComment({
38
38
  issue_number: context.issue.number,
@@ -27,6 +27,6 @@ jobs:
27
27
  GITHUB_TOKEN: "${{ secrets.GH_TOKEN }}"
28
28
  MERGE_LABELS: "!do-not-merge,ready-to-merge"
29
29
  MERGE_METHOD: "squash"
30
- MERGE_COMMIT_MESSAGE: "pull-request-title"
30
+ MERGE_COMMIT_MESSAGE: "{pullRequest.title} (#{pullRequest.number})"
31
31
  MERGE_RETRIES: "20"
32
32
  MERGE_RETRY_SLEEP: "30000"
@@ -1,5 +1,5 @@
1
- # This action is centrally managed in https://github.com/asyncapi/.github/
2
- # Don't make changes to this file in this repo as they will be overwritten with changes made to the same file in above mentioned repo.
1
+ # This action is centrally managed in https://github.com/asyncapi/.github/
2
+ # Don't make changes to this file in this repo as they will be overwritten with changes made to the same file in above mentioned repo.
3
3
 
4
4
  name: Automerge release bump PR
5
5
 
@@ -19,9 +19,8 @@ on:
19
19
  - submitted
20
20
 
21
21
  jobs:
22
-
23
22
  autoapprove:
24
- if: github.event.pull_request.draft == false && (github.event.pull_request.user.login == 'asyncapi-bot' || github.event.pull_request.user.login == 'dependabot[bot]' || github.event.pull_request.user.login == 'dependabot-preview[bot]') && !contains(github.event.pull_request.labels.*.name, 'released')
23
+ if: github.event.pull_request.draft == false && (github.actor == 'asyncapi-bot' || github.actor == 'dependabot[bot]' || github.actor == 'dependabot-preview[bot]') && !contains(github.event.pull_request.labels.*.name, 'released')
25
24
  runs-on: ubuntu-latest
26
25
  steps:
27
26
  - name: Autoapproving
@@ -39,8 +38,7 @@ jobs:
39
38
  owner: context.repo.owner,
40
39
  repo: context.repo.repo,
41
40
  labels: ['autoapproved']
42
- })
43
-
41
+ })
44
42
 
45
43
  automerge:
46
44
  needs: [autoapprove]
@@ -54,6 +52,6 @@ jobs:
54
52
  GITHUB_LOGIN: asyncapi-bot
55
53
  MERGE_LABELS: ""
56
54
  MERGE_METHOD: "squash"
57
- MERGE_COMMIT_MESSAGE: "pull-request-title"
55
+ MERGE_COMMIT_MESSAGE: "{pullRequest.title} (#{pullRequest.number})"
58
56
  MERGE_RETRIES: "20"
59
57
  MERGE_RETRY_SLEEP: "30000"
@@ -2,7 +2,7 @@
2
2
  #Don't make changes to this file in this repo as they will be overwritten with changes made to the same file in above mentioned repo
3
3
 
4
4
  #This workflow is designed to work with:
5
- # - autoapprove and automerge workflows for dependabot and asyncapibot.
5
+ # - autoapprove and automerge workflows for dependabot and asyncapibot.
6
6
  # - special release branches that we from time to time create in upstream repos. If we open up PRs for them from the very beginning of the release, the release branch will constantly update with new things from the destination branch they are opened against
7
7
 
8
8
  # It uses GitHub Action that auto-updates pull requests branches, whenever changes are pushed to their destination branch.
@@ -11,17 +11,21 @@
11
11
  name: autoupdate
12
12
 
13
13
  on:
14
- push: {}
15
-
16
- jobs:
14
+ push:
15
+ branches-ignore:
16
+ - 'version-bump/**'
17
+ - 'dependabot/**'
18
+ - 'bot/**'
19
+ - 'all-contributors/**'
17
20
 
21
+ jobs:
18
22
  autoupdate:
19
23
  runs-on: ubuntu-latest
20
24
  steps:
21
25
  - name: Autoupdating
22
26
  uses: docker://chinthakagodawita/autoupdate-action:v1
23
27
  env:
24
- GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}'
28
+ GITHUB_TOKEN: '${{ secrets.GH_TOKEN }}'
25
29
  PR_FILTER: "labelled"
26
30
  PR_LABELS: "autoapproved"
27
31
  PR_READY_STATE: "ready_for_review"
@@ -10,7 +10,7 @@ on:
10
10
 
11
11
  jobs:
12
12
  create_help_comment_pr:
13
- if: github.event.issue.pull_request && contains(github.event.comment.body, '/help')
13
+ if: ${{ github.event.issue.pull_request && contains(github.event.comment.body, '/help') && github.actor != 'asyncapi-bot' }}
14
14
  runs-on: ubuntu-latest
15
15
  steps:
16
16
  - uses: actions-ecosystem/action-create-comment@v1
@@ -26,7 +26,7 @@ jobs:
26
26
  - `/ready-to-merge` or `/rtm` - This comment will trigger automerge of PR in case all required checks are green, approvals in place and do-not-merge label is not added
27
27
  - `/do-not-merge` or `/dnm` - This comment will block automerging even if all conditions are met and ready-to-merge label is added
28
28
  create_help_comment_issue:
29
- if: ${{ !github.event.issue.pull_request && contains(github.event.comment.body, '/help') }}
29
+ if: ${{ !github.event.issue.pull_request && contains(github.event.comment.body, '/help') && github.actor != 'asyncapi-bot' }}
30
30
  runs-on: ubuntu-latest
31
31
  steps:
32
32
  - uses: actions-ecosystem/action-create-comment@v1
@@ -10,7 +10,10 @@ on:
10
10
  # below lines are not enough to have release supported for these branches
11
11
  # make sure configuration of `semantic-release` package mentiones these branches
12
12
  - next
13
- - '**-release'
13
+ - next-major
14
+ - beta
15
+ - alpha
16
+ - '**-release' # custom
14
17
 
15
18
  jobs:
16
19
 
@@ -47,7 +50,7 @@ jobs:
47
50
 
48
51
  release:
49
52
  needs: test
50
- name: Publish to NPM and GitHub
53
+ name: Publish to any of NPM, Github, and Docker Hub
51
54
  runs-on: ubuntu-latest
52
55
  steps:
53
56
  - name: Set git to use LF #to once and for all finish neverending fight between Unix and Windows
@@ -68,11 +71,13 @@ jobs:
68
71
  name: Install dependencies
69
72
  run: npm install
70
73
  - if: steps.packagejson.outputs.exists == 'true'
71
- name: Release to NPM and GitHub
74
+ name: Publish to any of NPM, Github, and Docker Hub
72
75
  id: release
73
76
  env:
74
77
  GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
75
78
  NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
79
+ DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
80
+ DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
76
81
  GIT_AUTHOR_NAME: asyncapi-bot
77
82
  GIT_AUTHOR_EMAIL: info@asyncapi.io
78
83
  GIT_COMMITTER_NAME: asyncapi-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.2.0';
35
+ version = '2.3.0';
36
36
  }
37
37
 
38
38
  try {
package/lib/index.js CHANGED
@@ -22,6 +22,7 @@ const conversions = {
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
24
  '2.2.0': from__2_1_0__to__2_2_0,
25
+ '2.3.0': from__2_2_0__to__2_3_0,
25
26
  }
26
27
  const conversionVersions = Object.keys(conversions);
27
28
 
@@ -192,14 +193,17 @@ function from__2_0_0_rc2__to__2_0_0(asyncapi2rc2, options) {
192
193
  return result;
193
194
  }
194
195
 
195
- function from__2_0_0__to__2_1_0(asyncapi2) {
196
- const result = asyncapi2;
197
- result.asyncapi = '2.1.0';
198
- return result;
196
+ function from__2_0_0__to__2_1_0(asyncapi) {
197
+ asyncapi.asyncapi = '2.1.0';
198
+ return asyncapi;
199
199
  }
200
200
 
201
- function from__2_1_0__to__2_2_0(asyncapi2) {
202
- const result = asyncapi2;
203
- result.asyncapi = '2.2.0';
204
- return result;
201
+ function from__2_1_0__to__2_2_0(asyncapi) {
202
+ asyncapi.asyncapi = '2.2.0';
203
+ return asyncapi;
205
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.6.2",
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"
package/test/index.js CHANGED
@@ -179,6 +179,20 @@ describe('#convert', () => {
179
179
  const result = convert(input, '2.2.0');
180
180
  assertResults(output, result);
181
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
+ });
182
196
  });
183
197
 
184
198
  /*
@@ -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'