-
-
Notifications
You must be signed in to change notification settings - Fork 97
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: create rule
asyncapi3-channel-no-query-nor-fragment
for v3 co…
…re ruleset (#1051)
- Loading branch information
Showing
4 changed files
with
82 additions
and
14 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@asyncapi/parser": minor | ||
--- | ||
|
||
feat: create rule `asyncapi3-channel-no-query-nor-fragment` for v3 core ruleset |
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
50 changes: 50 additions & 0 deletions
50
packages/parser/test/ruleset/rules/v3/asyncapi3-channel-no-query-nor-fragment.spec.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,50 @@ | ||
import { testRule, DiagnosticSeverity } from '../../tester'; | ||
|
||
testRule('asyncapi3-channel-no-query-nor-fragment', [ | ||
{ | ||
name: 'valid case', | ||
document: { | ||
asyncapi: '3.0.0', | ||
channels: { | ||
'users/{userId}/signedUp': {}, | ||
}, | ||
}, | ||
errors: [], | ||
}, | ||
|
||
{ | ||
name: 'channels.{channel} contains a query delimiter', | ||
document: { | ||
asyncapi: '3.0.0', | ||
channels: { | ||
'users/{userId}/signedUp': {}, | ||
'users/{userId}/signedOut?byMistake={didFatFingerTheSignOutButton}': {}, | ||
}, | ||
}, | ||
errors: [ | ||
{ | ||
message: 'Channel address should not include query ("?") or fragment ("#") delimiter.', | ||
path: ['channels', 'users/{userId}/signedOut?byMistake={didFatFingerTheSignOutButton}'], | ||
severity: DiagnosticSeverity.Error, | ||
}, | ||
], | ||
}, | ||
|
||
{ | ||
name: 'channels.{channel} contains a fragment delimiter', | ||
document: { | ||
asyncapi: '3.0.0', | ||
channels: { | ||
'users/{userId}/signedUp': {}, | ||
'users/{userId}/signedOut#onPurpose': {}, | ||
}, | ||
}, | ||
errors: [ | ||
{ | ||
message: 'Channel address should not include query ("?") or fragment ("#") delimiter.', | ||
path: ['channels', 'users/{userId}/signedOut#onPurpose'], | ||
severity: DiagnosticSeverity.Error, | ||
}, | ||
], | ||
}, | ||
]); |