-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(ls): OpenAPI 3.x.x mutually exclusive lint rule for Media Type (#…
- Loading branch information
Showing
3 changed files
with
30 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
21 changes: 21 additions & 0 deletions
21
packages/apidom-ls/src/config/openapi/media-type/lint/examples--mutually-exclusive.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,21 @@ | ||
import ApilintCodes from '../../../codes'; | ||
import { LinterMeta } from '../../../../apidom-language-types'; | ||
|
||
const examplesMutuallyExclusiveLint: LinterMeta = { | ||
code: ApilintCodes.OPENAPI3_0_MEDIA_TYPE_FIELD_EXAMPLES_MUTUALLY_EXCLUSIVE, | ||
source: 'apilint', | ||
message: 'The `example` field and `examples` field are mutually exclusive.', | ||
severity: 1, | ||
linterFunction: 'missingFields', | ||
linterParams: [['examples']], | ||
marker: 'key', | ||
markerTarget: 'examples', | ||
conditions: [ | ||
{ | ||
function: 'existFields', | ||
params: [['example']], | ||
}, | ||
], | ||
}; | ||
|
||
export default examplesMutuallyExclusiveLint; |
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
de53a13
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've issued a PR which fixes the assignment of the error code to
OPENAPI3_0_MEDIA_TYPE_FIELD_EXAMPLES_MUTUALLY_EXCLUSIVE
: #2177Reasoning: consistency + single field validations should be groups together