-
-
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 (#2282)
- Loading branch information
1 parent
33e3770
commit 366779f
Showing
5 changed files
with
61 additions
and
8 deletions.
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
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