-
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): add rules for OpenAPI 2.0 Path Item Object (#3560)
Refs #3104
- Loading branch information
Showing
17 changed files
with
245 additions
and
37 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
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
24 changes: 19 additions & 5 deletions
24
packages/apidom-ls/src/config/openapi/path-item/documentation.ts
Large diffs are not rendered by default.
Oops, something went wrong.
19 changes: 19 additions & 0 deletions
19
packages/apidom-ls/src/config/openapi/path-item/lint/$ref--format-uri.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,19 @@ | ||
import { DiagnosticSeverity } from 'vscode-languageserver-types'; | ||
|
||
import ApilintCodes from '../../../codes'; | ||
import { LinterMeta } from '../../../../apidom-language-types'; | ||
import { OpenAPI2, OpenAPI3 } from '../../target-specs'; | ||
|
||
const $refFormatURILint: LinterMeta = { | ||
code: ApilintCodes.OPENAPI2_PATH_ITEM_FIELD_$REF_FORMAT_URI, | ||
source: 'apilint', | ||
message: "'$ref' value must be a valid URI-reference", | ||
severity: DiagnosticSeverity.Error, | ||
linterFunction: 'apilintValidURI', | ||
marker: 'value', | ||
target: '$ref', | ||
data: {}, | ||
targetSpecs: [...OpenAPI2, ...OpenAPI3], | ||
}; | ||
|
||
export default $refFormatURILint; |
33 changes: 33 additions & 0 deletions
33
packages/apidom-ls/src/config/openapi/path-item/lint/allowed-fields-2-0.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,33 @@ | ||
import { DiagnosticSeverity } from 'vscode-languageserver-types'; | ||
|
||
import ApilintCodes from '../../../codes'; | ||
import { LinterMeta } from '../../../../apidom-language-types'; | ||
import { OpenAPI2 } from '../../target-specs'; | ||
|
||
// eslint-disable-next-line @typescript-eslint/naming-convention | ||
const allowedFields2_0Lint: LinterMeta = { | ||
code: ApilintCodes.NOT_ALLOWED_FIELDS, | ||
source: 'apilint', | ||
message: 'Object includes not allowed fields', | ||
severity: DiagnosticSeverity.Error, | ||
linterFunction: 'allowedFields', | ||
linterParams: [ | ||
[ | ||
'$ref', | ||
'summary', | ||
'description', | ||
'get', | ||
'put', | ||
'post', | ||
'delete', | ||
'options', | ||
'head', | ||
'patch', | ||
'parameters', | ||
], | ||
'x-', | ||
], | ||
marker: 'key', | ||
targetSpecs: OpenAPI2, | ||
}; | ||
export default allowedFields2_0Lint; |
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
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
Oops, something went wrong.