-
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: allow linting OpenAPI path templates (#3532)
Refs #3517
- Loading branch information
Showing
22 changed files
with
1,011 additions
and
28 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
6 changes: 6 additions & 0 deletions
6
packages/apidom-ls/src/config/openapi/path-template/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 |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import valueWellFormedLint from './value--well-formed'; | ||
import valueValidLint from './value--valid'; | ||
|
||
const lints = [valueWellFormedLint, valueValidLint]; | ||
|
||
export default lints; |
23 changes: 23 additions & 0 deletions
23
packages/apidom-ls/src/config/openapi/path-template/lint/value--valid.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,23 @@ | ||
import { DiagnosticSeverity } from 'vscode-languageserver-types'; | ||
|
||
import ApilintCodes from '../../../codes'; | ||
import { LinterMeta } from '../../../../apidom-language-types'; | ||
import { OpenAPI } from '../../target-specs'; | ||
|
||
const valueValidLint: LinterMeta = { | ||
code: ApilintCodes.OPENAPI2_PATH_TEMPLATE_VALUE_VALID, | ||
source: 'apilint', | ||
message: 'path template expressions is not matched with Parameter Object(s)', | ||
severity: DiagnosticSeverity.Error, | ||
linterFunction: 'apilintOpenAPIPathTemplateValid', | ||
marker: 'value', | ||
targetSpecs: OpenAPI, | ||
conditions: [ | ||
{ | ||
function: 'apilintOpenAPIPathTemplateWellFormed', | ||
params: [true], | ||
}, | ||
], | ||
}; | ||
|
||
export default valueValidLint; |
18 changes: 18 additions & 0 deletions
18
packages/apidom-ls/src/config/openapi/path-template/lint/value--well-formed.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,18 @@ | ||
import { DiagnosticSeverity } from 'vscode-languageserver-types'; | ||
|
||
import ApilintCodes from '../../../codes'; | ||
import { LinterMeta } from '../../../../apidom-language-types'; | ||
import { OpenAPI } from '../../target-specs'; | ||
|
||
const valueWellFormedLint: LinterMeta = { | ||
code: ApilintCodes.OPENAPI2_PATH_TEMPLATE_VALUE_WELL_FORMED, | ||
source: 'apilint', | ||
message: "'path' must begin with '/' and be relative to an individual endpoint", | ||
severity: DiagnosticSeverity.Error, | ||
linterFunction: 'apilintOpenAPIPathTemplateWellFormed', | ||
linterParams: [false], | ||
marker: 'value', | ||
targetSpecs: OpenAPI, | ||
}; | ||
|
||
export default valueWellFormedLint; |
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,8 @@ | ||
import lint from './lint'; | ||
import { FormatMeta } from '../../../apidom-language-types'; | ||
|
||
const meta: FormatMeta = { | ||
lint, | ||
}; | ||
|
||
export default meta; |
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,6 +1,5 @@ | ||
import keysPatternLint from './keys--pattern'; | ||
import valuesTypeLint from './values--type'; | ||
|
||
const lints = [valuesTypeLint, keysPatternLint]; | ||
const lints = [valuesTypeLint]; | ||
|
||
export default lints; |
19 changes: 0 additions & 19 deletions
19
packages/apidom-ls/src/config/openapi/paths/lint/keys--pattern.ts
This file was deleted.
Oops, something went wrong.
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.