Skip to content

Commit

Permalink
Merge branch 'master' into add-allComponent-functions
Browse files Browse the repository at this point in the history
  • Loading branch information
smoya authored Jun 6, 2024
2 parents 4a707e7 + cb45061 commit 8d90dc4
Show file tree
Hide file tree
Showing 8 changed files with 123 additions and 39 deletions.
50 changes: 43 additions & 7 deletions .github/workflows/bounty-program-commands.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,18 @@ on:
types:
- created

env:
BOUNTY_PROGRAM_LABELS_JSON: |
[
{"name": "bounty", "color": "0e8a16", "description": "Participation in the Bounty Program"}
]
jobs:
guard-against-unauthorized-use:
if: >
github.actor != ('aeworxet' || 'thulieblack') &&
(
contains(github.event.comment.body, '/bounty' )
startsWith(github.event.comment.body, '/bounty' )
)
runs-on: ubuntu-latest
Expand All @@ -46,15 +52,10 @@ jobs:
if: >
github.actor == ('aeworxet' || 'thulieblack') &&
(
contains(github.event.comment.body, '/bounty' )
startsWith(github.event.comment.body, '/bounty' )
)
runs-on: ubuntu-latest
env:
BOUNTY_PROGRAM_LABELS_JSON: |
[
{"name": "bounty", "color": "0e8a16", "description": "Participation in the Bounty Program"}
]

steps:
- name: Add label `bounty`
Expand Down Expand Up @@ -88,3 +89,38 @@ jobs:
repo: context.repo.repo,
labels: [BOUNTY_PROGRAM_LABELS[0].name]
})
remove-label-bounty:
if: >
github.actor == ('aeworxet' || 'thulieblack') &&
(
startsWith(github.event.comment.body, '/unbounty' )
)
runs-on: ubuntu-latest

steps:
- name: Remove label `bounty`
uses: actions/github-script@v6

with:
github-token: ${{ secrets.GH_TOKEN }}
script: |
const BOUNTY_PROGRAM_LABELS = JSON.parse(process.env.BOUNTY_PROGRAM_LABELS_JSON);
let LIST_OF_LABELS_FOR_ISSUE = await github.rest.issues.listLabelsOnIssue({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
});
LIST_OF_LABELS_FOR_ISSUE = LIST_OF_LABELS_FOR_ISSUE.data.map(key => key.name);
if (LIST_OF_LABELS_FOR_ISSUE.includes(BOUNTY_PROGRAM_LABELS[0].name)) {
console.log('Removing label `bounty`...');
github.rest.issues.removeLabel({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
name: [BOUNTY_PROGRAM_LABELS[0].name]
})
}
4 changes: 3 additions & 1 deletion .github/workflows/if-nodejs-pr-testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
# Using macos-13 instead of latest (macos-14) due to an issue with Puppeteer and such runner.
# See: https://github.com/puppeteer/puppeteer/issues/12327 and https://github.com/asyncapi/parser-js/issues/1001
os: [ubuntu-latest, macos-13, windows-latest]
steps:
- if: >
!github.event.pull_request.draft && !(
Expand Down
7 changes: 5 additions & 2 deletions .github/workflows/if-nodejs-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ on:
- next-major-spec
- beta
- alpha
- next

jobs:

Expand All @@ -32,7 +33,9 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
# Using macos-13 instead of latest (macos-14) due to an issue with Puppeteer and such runner.
# See: https://github.com/puppeteer/puppeteer/issues/12327 and https://github.com/asyncapi/parser-js/issues/1001
os: [ubuntu-latest, macos-13, windows-latest]
steps:
- name: Set git to use LF #to once and for all finish neverending fight between Unix and Windows
run: |
Expand Down Expand Up @@ -128,4 +131,4 @@ jobs:
fields: repo,action,workflow
text: 'Release workflow failed in release job'
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_CI_FAIL_NOTIFY }}
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_CI_FAIL_NOTIFY }}
2 changes: 2 additions & 0 deletions .releaserc
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ branches:
prerelease: true
- name: alpha
prerelease: true
- name: next
prerelease: true
plugins:
- - "@semantic-release/commit-analyzer"
- preset: conventionalcommits
Expand Down
48 changes: 24 additions & 24 deletions package-lock.json

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

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@asyncapi/parser",
"version": "3.0.14",
"version": "3.0.16",
"description": "JavaScript AsyncAPI parser.",
"bugs": {
"url": "https://github.com/asyncapi/parser-js/issues"
Expand Down Expand Up @@ -41,7 +41,7 @@
"prepublishOnly": "npm run generate:assets"
},
"dependencies": {
"@asyncapi/specs": "^6.6.0",
"@asyncapi/specs": "^6.7.1",
"@openapi-contrib/openapi-schema-to-json-schema": "~3.2.0",
"@stoplight/json": "^3.20.2",
"@stoplight/json-ref-readers": "^1.2.2",
Expand All @@ -62,7 +62,7 @@
"node-fetch": "2.6.7"
},
"devDependencies": {
"@asyncapi/avro-schema-parser": "^3.0.22",
"@asyncapi/avro-schema-parser": "^3.0.23",
"@jest/types": "^29.0.2",
"@swc/core": "^1.2.248",
"@swc/jest": "^0.2.22",
Expand Down
2 changes: 0 additions & 2 deletions src/custom-operations/apply-traits.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,9 @@ function applyTraitsToObjectV2(value: Record<string, unknown>) {
const v3TraitPaths = [
// operations
'$.operations.*',
'$.operations.*.channel.*',
'$.operations.*.channel.messages.*',
'$.operations.*.messages.*',
'$.components.operations.*',
'$.components.operations.*.channel.*',
'$.components.operations.*.channel.messages.*',
'$.components.operations.*.messages.*',
// Channels
Expand Down
43 changes: 43 additions & 0 deletions test/validate.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,47 @@ describe('validate()', function() {
expect(hasErrorDiagnostic(diagnostics)).toEqual(false);
expect(hasWarningDiagnostic(diagnostics)).toEqual(true);
});

// See https://github.com/asyncapi/parser-js/issues/996
it('user case - null channel address should not make operation traits appliance fail', async function() {
const documentRaw = {
asyncapi: '3.0.0',
info: {
title: 'Nexus Server API',
version: '1.0.0'
},
channels: {
Exchange: {
address: null,
messages: {
FooEvent: {
name: 'FooEvent',
title: 'Tenant Created',
contentType: 'application/json',
payload: {
type: 'string'
}
}
}
}
},
operations: {
sendTenantCreated: {
title: 'Send tenant created event to client',
action: 'send',
channel: {
$ref: '#/channels/Exchange'
},
messages: [
{
$ref: '#/channels/Exchange/messages/FooEvent'
}
]
}
}
};
const { document, diagnostics } = await parser.parse(documentRaw, { validateOptions: { allowedSeverity: { warning: false } } });
console.log(diagnostics);
expect(diagnostics).toHaveLength(0);
});
});

0 comments on commit 8d90dc4

Please sign in to comment.