Skip to content

Commit

Permalink
Merge branch 'master' of github.com:asyncapi/parser-js
Browse files Browse the repository at this point in the history
  • Loading branch information
AyushNautiyalDeveloper committed Jun 5, 2024
2 parents 5556406 + cb45061 commit 1378ee3
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 4 deletions.
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
4 changes: 3 additions & 1 deletion .github/workflows/if-nodejs-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,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
2 changes: 0 additions & 2 deletions apps/parser/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 apps/parser/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 1378ee3

Please sign in to comment.