Skip to content

Commit

Permalink
feat: add AsyncAPI 2.6
Browse files Browse the repository at this point in the history
  • Loading branch information
jonaslagoni committed Feb 7, 2023
2 parents b87f2d3 + bda6196 commit 0da5543
Show file tree
Hide file tree
Showing 54 changed files with 3,539 additions and 25 deletions.
33 changes: 17 additions & 16 deletions .github/workflows/add-good-first-issue-labels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,36 +4,37 @@
# Purpose of this workflow is to enable anyone to label issue with 'Good First Issue' and 'area/*' with a single command.
name: Add 'Good First Issue' and 'area/*' labels # if proper comment added

on:
issue_comment:
types:
- created
on:
issue_comment:
types:
- created

jobs:
add-labels:
if: ${{!github.event.issue.pull_request && github.event.issue.state != 'closed' && github.actor != 'asyncapi-bot'}}
if: ${{(!github.event.issue.pull_request && github.event.issue.state != 'closed' && github.actor != 'asyncapi-bot') && (contains(github.event.comment.body, '/good-first-issue') || contains(github.event.comment.body, '/gfi' ))}}
runs-on: ubuntu-latest
steps:
- name: Add label
if: contains(github.event.comment.body, '/good-first-issue') || contains(github.event.comment.body, '/gfi' )
uses: actions/github-script@v5
with:
github-token: ${{ secrets.GH_TOKEN }}
script: |
const areas = ['javascript', 'typescript', 'java' , 'go', 'docs', 'ci-cd', 'design'];
const values = context.payload.comment.body.trim().split(" ");
switch(values[1]){
const words = context.payload.comment.body.trim().split(" ");
const areaIndex = words.findIndex((word)=> word === '/gfi' || word === '/good-first-issue') + 1
let area = words[areaIndex];
switch(area){
case 'ts':
values[1] = 'typescript';
area = 'typescript';
break;
case 'js':
values[1] = 'javascript';
area = 'javascript';
break;
case 'markdown':
values[1] = 'docs';
area = 'docs';
break;
}
if(values.length != 2 || !areas.includes(values[1])){
if(!areas.includes(area)){
const message = `Hey @${context.payload.sender.login}, your message doesn't follow the requirements, you can try \`/help\`.`
await github.rest.issues.createComment({
Expand All @@ -44,14 +45,14 @@ jobs:
})
} else {
//remove complexity and areas if there are any before adding new labels;
// remove area if there is any before adding new labels.
const currentLabels = (await github.rest.issues.listLabelsOnIssue({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
})).data.map(label => label.name);
const shouldBeRemoved = currentLabels.filter(label => (label.startsWith('area/') && !label.endsWith(values[1])));
const shouldBeRemoved = currentLabels.filter(label => (label.startsWith('area/') && !label.endsWith(area));
shouldBeRemoved.forEach(label => {
github.rest.issues.deleteLabel({
owner: context.repo.owner,
Expand All @@ -60,11 +61,11 @@ jobs:
});
});
//add new labels
// Add new labels.
github.rest.issues.addLabels({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
labels: ['good first issue', `area/${values[1]}`]
labels: ['good first issue', `area/${area}`]
});
}
6 changes: 3 additions & 3 deletions .github/workflows/if-nodejs-pr-testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,10 @@ jobs:
npm install --loglevel verbose
- if: steps.packagejson.outputs.exists == 'true'
name: Test
run: npm test
run: npm test --if-present
- if: steps.packagejson.outputs.exists == 'true'
name: Run linter
run: npm run lint
run: npm run lint --if-present
- if: steps.packagejson.outputs.exists == 'true'
name: Run release assets generation to make sure PR does not break it
run: npm run generate:assets
run: npm run generate:assets --if-present
12 changes: 6 additions & 6 deletions .github/workflows/scripts/mailchimp/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

38 changes: 38 additions & 0 deletions definitions/2.6.0/APIKeyHTTPSecurityScheme.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"type": "object",
"required": [
"type",
"name",
"in"
],
"properties": {
"type": {
"type": "string",
"enum": [
"httpApiKey"
]
},
"name": {
"type": "string"
},
"in": {
"type": "string",
"enum": [
"header",
"query",
"cookie"
]
},
"description": {
"type": "string"
}
},
"patternProperties": {
"^x-[\\w\\d\\.\\x2d_]+$": {
"$ref": "http://asyncapi.com/definitions/2.6.0/specificationExtension.json"
}
},
"additionalProperties": false,
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "http://asyncapi.com/definitions/2.6.0/APIKeyHTTPSecurityScheme.json"
}
35 changes: 35 additions & 0 deletions definitions/2.6.0/BearerHTTPSecurityScheme.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"type": "object",
"required": [
"type",
"scheme"
],
"properties": {
"scheme": {
"type": "string",
"enum": [
"bearer"
]
},
"bearerFormat": {
"type": "string"
},
"type": {
"type": "string",
"enum": [
"http"
]
},
"description": {
"type": "string"
}
},
"patternProperties": {
"^x-[\\w\\d\\.\\x2d_]+$": {
"$ref": "http://asyncapi.com/definitions/2.6.0/specificationExtension.json"
}
},
"additionalProperties": false,
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "http://asyncapi.com/definitions/2.6.0/BearerHTTPSecurityScheme.json"
}
15 changes: 15 additions & 0 deletions definitions/2.6.0/HTTPSecurityScheme.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"oneOf": [
{
"$ref": "http://asyncapi.com/definitions/2.6.0/NonBearerHTTPSecurityScheme.json"
},
{
"$ref": "http://asyncapi.com/definitions/2.6.0/BearerHTTPSecurityScheme.json"
},
{
"$ref": "http://asyncapi.com/definitions/2.6.0/APIKeyHTTPSecurityScheme.json"
}
],
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "http://asyncapi.com/definitions/2.6.0/HTTPSecurityScheme.json"
}
40 changes: 40 additions & 0 deletions definitions/2.6.0/NonBearerHTTPSecurityScheme.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{
"not": {
"type": "object",
"properties": {
"scheme": {
"type": "string",
"enum": [
"bearer"
]
}
}
},
"type": "object",
"required": [
"scheme",
"type"
],
"properties": {
"scheme": {
"type": "string"
},
"description": {
"type": "string"
},
"type": {
"type": "string",
"enum": [
"http"
]
}
},
"patternProperties": {
"^x-[\\w\\d\\.\\x2d_]+$": {
"$ref": "http://asyncapi.com/definitions/2.6.0/specificationExtension.json"
}
},
"additionalProperties": false,
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "http://asyncapi.com/definitions/2.6.0/NonBearerHTTPSecurityScheme.json"
}
13 changes: 13 additions & 0 deletions definitions/2.6.0/Reference.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"type": "object",
"required": [
"$ref"
],
"properties": {
"$ref": {
"$ref": "http://asyncapi.com/definitions/2.6.0/ReferenceObject.json"
}
},
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "http://asyncapi.com/definitions/2.6.0/Reference.json"
}
6 changes: 6 additions & 0 deletions definitions/2.6.0/ReferenceObject.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"type": "string",
"format": "uri-reference",
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "http://asyncapi.com/definitions/2.6.0/ReferenceObject.json"
}
25 changes: 25 additions & 0 deletions definitions/2.6.0/SaslGssapiSecurityScheme.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"type": "object",
"required": [
"type"
],
"properties": {
"type": {
"type": "string",
"enum": [
"gssapi"
]
},
"description": {
"type": "string"
}
},
"patternProperties": {
"^x-[\\w\\d\\.\\x2d_]+$": {
"$ref": "http://asyncapi.com/definitions/2.6.0/specificationExtension.json"
}
},
"additionalProperties": false,
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "http://asyncapi.com/definitions/2.6.0/SaslGssapiSecurityScheme.json"
}
25 changes: 25 additions & 0 deletions definitions/2.6.0/SaslPlainSecurityScheme.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"type": "object",
"required": [
"type"
],
"properties": {
"type": {
"type": "string",
"enum": [
"plain"
]
},
"description": {
"type": "string"
}
},
"patternProperties": {
"^x-[\\w\\d\\.\\x2d_]+$": {
"$ref": "http://asyncapi.com/definitions/2.6.0/specificationExtension.json"
}
},
"additionalProperties": false,
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "http://asyncapi.com/definitions/2.6.0/SaslPlainSecurityScheme.json"
}
26 changes: 26 additions & 0 deletions definitions/2.6.0/SaslScramSecurityScheme.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"type": "object",
"required": [
"type"
],
"properties": {
"type": {
"type": "string",
"enum": [
"scramSha256",
"scramSha512"
]
},
"description": {
"type": "string"
}
},
"patternProperties": {
"^x-[\\w\\d\\.\\x2d_]+$": {
"$ref": "http://asyncapi.com/definitions/2.6.0/specificationExtension.json"
}
},
"additionalProperties": false,
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "http://asyncapi.com/definitions/2.6.0/SaslScramSecurityScheme.json"
}
15 changes: 15 additions & 0 deletions definitions/2.6.0/SaslSecurityScheme.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"oneOf": [
{
"$ref": "http://asyncapi.com/definitions/2.6.0/SaslPlainSecurityScheme.json"
},
{
"$ref": "http://asyncapi.com/definitions/2.6.0/SaslScramSecurityScheme.json"
},
{
"$ref": "http://asyncapi.com/definitions/2.6.0/SaslGssapiSecurityScheme.json"
}
],
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "http://asyncapi.com/definitions/2.6.0/SaslSecurityScheme.json"
}
12 changes: 12 additions & 0 deletions definitions/2.6.0/SecurityRequirement.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"type": "object",
"additionalProperties": {
"type": "array",
"items": {
"type": "string"
},
"uniqueItems": true
},
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "http://asyncapi.com/definitions/2.6.0/SecurityRequirement.json"
}
Loading

0 comments on commit 0da5543

Please sign in to comment.