-
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): provide OpenAPI 3.1.0 License lint rules (#2136)
- Loading branch information
Showing
9 changed files
with
101 additions
and
3 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
16 changes: 16 additions & 0 deletions
16
packages/apidom-ls/src/config/openapi/license/lint/allowed-fields-3-1.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,16 @@ | ||
import ApilintCodes from '../../../codes'; | ||
import { LinterMeta } from '../../../../apidom-language-types'; | ||
|
||
// eslint-disable-next-line @typescript-eslint/naming-convention | ||
const allowedFields3_1Lint: LinterMeta = { | ||
code: ApilintCodes.NOT_ALLOWED_FIELDS, | ||
source: 'apilint', | ||
message: 'Object includes not allowed fields', | ||
severity: 1, | ||
linterFunction: 'allowedFields', | ||
linterParams: [['name', 'url', 'identifier'], 'x-'], | ||
marker: 'key', | ||
targetSpecs: [{ namespace: 'openapi', version: '3.1.0' }], | ||
}; | ||
|
||
export default allowedFields3_1Lint; |
22 changes: 22 additions & 0 deletions
22
packages/apidom-ls/src/config/openapi/license/lint/identifier--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,22 @@ | ||
import ApilintCodes from '../../../codes'; | ||
import { LinterMeta } from '../../../../apidom-language-types'; | ||
|
||
const identifierMutuallyExclusiveLint: LinterMeta = { | ||
code: ApilintCodes.OPENAPI3_1_LICENSE_FIELD_IDENTIFIER_MUTUALLY_EXCLUSIVE, | ||
source: 'apilint', | ||
message: 'The identifier field and url field are mutually exclusive.', | ||
severity: 1, | ||
linterFunction: 'missingFields', | ||
linterParams: [['identifier']], | ||
marker: 'key', | ||
markerTarget: 'identifier', | ||
conditions: [ | ||
{ | ||
function: 'existFields', | ||
params: [['url']], | ||
}, | ||
], | ||
targetSpecs: [{ namespace: 'openapi', version: '3.1.0' }], | ||
}; | ||
|
||
export default identifierMutuallyExclusiveLint; |
Empty file.
11 changes: 10 additions & 1 deletion
11
packages/apidom-ls/src/config/openapi/license/lint/index.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 |
---|---|---|
@@ -1,8 +1,17 @@ | ||
import allowedFields3_0Lint from './allowed-fields-3-0'; | ||
import allowedFields3_1Lint from './allowed-fields-3-1'; | ||
import nameTypeLint from './name--type'; | ||
import nameRequiredLint from './name--required'; | ||
import identifierMutuallyExclusiveLint from './identifier--mutually-exclusive'; | ||
import urlFormatURILint from './url--format-uri'; | ||
|
||
const lints = [nameTypeLint, nameRequiredLint, urlFormatURILint, allowedFields3_0Lint]; | ||
const lints = [ | ||
nameTypeLint, | ||
nameRequiredLint, | ||
identifierMutuallyExclusiveLint, | ||
urlFormatURILint, | ||
allowedFields3_0Lint, | ||
allowedFields3_1Lint, | ||
]; | ||
|
||
export default lints; |
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
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
20a09d5
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 following PR against this commit: #2155
Things addressed:
email
completion rule as it's not part of License objectidentifierTypeLint