Skip to content

Commit

Permalink
Merge branch 'master' into update_browser_export
Browse files Browse the repository at this point in the history
  • Loading branch information
jonaslagoni authored Jun 25, 2024
2 parents 0459e6d + 01be22e commit 333ae36
Show file tree
Hide file tree
Showing 6 changed files with 57 additions and 64 deletions.
6 changes: 0 additions & 6 deletions .github/workflows/issues-prs-notifications.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ jobs:
name: Notify slack on every new issue
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Convert markdown to slack markdown for issue
uses: asyncapi/.github/.github/actions/slackify-markdown@master
id: issuemarkdown
Expand All @@ -40,8 +38,6 @@ jobs:
name: Notify slack on every new pull request
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Convert markdown to slack markdown for pull request
uses: asyncapi/.github/.github/actions/slackify-markdown@master
id: prmarkdown
Expand All @@ -60,8 +56,6 @@ jobs:
name: Notify slack on every new pull request
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Convert markdown to slack markdown for pull request
uses: asyncapi/.github/.github/actions/slackify-markdown@master
id: discussionmarkdown
Expand Down
14 changes: 13 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,19 @@ Additionally to all the methods declared in the [Parser-API](https://github.com/

## Spectral rulesets

[Spectral](https://github.com/stoplightio/spectral) powers the validation of AsyncAPI documents within ParserJS. For this reason, it is possible to use your rulesets/rules or overwrite existing ones, passing the `ruleset` option to the Parser instance:
[Spectral](https://github.com/stoplightio/spectral) powers the validation of AsyncAPI documents within ParserJS.
The default [built-in rulesets](src/ruleset) are:

- Core ruleset:
- Basic and global validation. Apply to all AsyncAPI Spec versions (with some exceptions).
- Recommended ruleset:
- These are good practices. They won't create validation errors but warnings.
- Specific rulesets per each AsyncAPI Spec version:
- Contain particular rulesets that apply only to documents of a particular Spec version:
- Core rulesets: Rules that generate validation errors if not fulfilled by a particular Spec version.
- Recommended rulesets: Best practices for a particular Spec version

It is possible to use your rulesets/rules or overwrite existing ones, passing the `ruleset` option to the Parser instance:

```ts
import { Parser, stringify, unstringify } from '@asyncapi/parser';
Expand Down
93 changes: 39 additions & 54 deletions package-lock.json

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

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@asyncapi/parser",
"version": "3.0.16",
"version": "3.1.0",
"description": "JavaScript AsyncAPI parser.",
"bugs": {
"url": "https://github.com/asyncapi/parser-js/issues"
Expand Down Expand Up @@ -62,7 +62,7 @@
"node-fetch": "2.6.7"
},
"devDependencies": {
"@asyncapi/avro-schema-parser": "^3.0.23",
"@asyncapi/avro-schema-parser": "^3.0.24",
"@jest/types": "^29.0.2",
"@swc/core": "^1.2.248",
"@swc/jest": "^0.2.22",
Expand Down
1 change: 1 addition & 0 deletions src/ruleset/v2/ruleset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ export const v2CoreRuleset = {
export const v2SchemasRuleset = (parser: Parser) => {
return {
description: 'Schemas AsyncAPI 2.x.x ruleset.',
formats: AsyncAPIFormats.filterByMajorVersions(['2']).formats(),
rules: {
'asyncapi2-schemas': asyncApi2SchemaParserRule(parser),
'asyncapi2-schema-default': {
Expand Down
3 changes: 2 additions & 1 deletion test/validate.spec.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { AsyncAPIDocument } from '../src/models/v3/asyncapi';
import { Parser } from '../src/parser';
import { hasErrorDiagnostic, hasWarningDiagnostic } from '../src/utils';

Expand Down Expand Up @@ -91,7 +92,7 @@ describe('validate()', function() {
}
};
const { document, diagnostics } = await parser.parse(documentRaw, { validateOptions: { allowedSeverity: { warning: false } } });
console.log(diagnostics);
expect(diagnostics).toHaveLength(0);
expect(document).toBeInstanceOf(AsyncAPIDocument);
});
});

0 comments on commit 333ae36

Please sign in to comment.