-
-
Notifications
You must be signed in to change notification settings - Fork 240
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(rulesets): add rule to check if the AsyncAPI document is using t…
…he latest version.
- Loading branch information
1 parent
33e3770
commit c13d7ab
Showing
4 changed files
with
53 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
packages/rulesets/src/asyncapi/__tests__/asyncapi-latest-version.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { DiagnosticSeverity } from '@stoplight/types'; | ||
import { latestAsyncApiVersion } from '../functions/asyncApi2DocumentSchema'; | ||
import testRule from './__helpers__/tester'; | ||
|
||
testRule('asyncapi-latest-version', [ | ||
{ | ||
name: 'valid case', | ||
document: { | ||
asyncapi: latestAsyncApiVersion, | ||
}, | ||
errors: [], | ||
}, | ||
|
||
{ | ||
name: 'invalid case', | ||
document: { | ||
asyncapi: '2.0.0', | ||
}, | ||
errors: [ | ||
{ | ||
message: `The latest version is not used. You should update to the "${latestAsyncApiVersion}" version.`, | ||
path: ['asyncapi'], | ||
severity: DiagnosticSeverity.Information, | ||
}, | ||
], | ||
}, | ||
]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters