-
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.
Merge branch 'main' into parameter-defined-within-path-template
- Loading branch information
Showing
34 changed files
with
608 additions
and
77 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
47 changes: 47 additions & 0 deletions
47
packages/apidom-ls/src/config/openapi/parameter/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,47 @@ | ||
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: [ | ||
[ | ||
'name', | ||
'in', | ||
'description', | ||
'required', | ||
'schema', | ||
'type', | ||
'format', | ||
'allowEmptyValue', | ||
'items', | ||
'collectionFormat', | ||
'default', | ||
'maximum', | ||
'exclusiveMaximum', | ||
'minimum', | ||
'exclusiveMinimum', | ||
'maxLength', | ||
'minLength', | ||
'pattern', | ||
'maxItems', | ||
'minItems', | ||
'uniqueItems', | ||
'enum', | ||
'multipleOf', | ||
'$ref', | ||
], | ||
'x-', | ||
], | ||
marker: 'key', | ||
targetSpecs: OpenAPI2, | ||
}; | ||
|
||
export default allowedFields2_0Lint; |
21 changes: 21 additions & 0 deletions
21
packages/apidom-ls/src/config/openapi/parameter/lint/collection-format--equals.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 { DiagnosticSeverity } from 'vscode-languageserver-types'; | ||
|
||
import ApilintCodes from '../../../codes'; | ||
import { LinterMeta } from '../../../../apidom-language-types'; | ||
import { OpenAPI2 } from '../../target-specs'; | ||
|
||
const collectionFormatEqualsLint: LinterMeta = { | ||
code: ApilintCodes.OPENAPI2_PARAMETER_FIELD_COLLECTION_FORMAT_EQUALS, | ||
source: 'apilint', | ||
message: | ||
"'collectionFormat' must be one of allowed values: 'csv', 'ssv', 'tsv', 'pipes', 'multi'", | ||
severity: DiagnosticSeverity.Error, | ||
linterFunction: 'apilintValueOrArray', | ||
linterParams: [['csv', 'ssv', 'tsv', 'pipes', 'multi']], | ||
marker: 'value', | ||
target: 'collectionFormat', | ||
data: {}, | ||
targetSpecs: OpenAPI2, | ||
}; | ||
|
||
export default collectionFormatEqualsLint; |
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
20 changes: 20 additions & 0 deletions
20
packages/apidom-ls/src/config/openapi/parameter/lint/enum--type.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,20 @@ | ||
import { DiagnosticSeverity } from 'vscode-languageserver-types'; | ||
|
||
import ApilintCodes from '../../../codes'; | ||
import { LinterMeta } from '../../../../apidom-language-types'; | ||
import { OpenAPI2 } from '../../target-specs'; | ||
|
||
const enumTypeLint: LinterMeta = { | ||
code: ApilintCodes.OPENAPI2_PARAMETER_FIELD_ENUM_TYPE, | ||
source: 'apilint', | ||
message: 'enum must be an array', | ||
severity: DiagnosticSeverity.Error, | ||
linterFunction: 'apilintType', | ||
linterParams: ['array'], | ||
marker: 'value', | ||
target: 'enum', | ||
data: {}, | ||
targetSpecs: OpenAPI2, | ||
}; | ||
|
||
export default enumTypeLint; |
20 changes: 20 additions & 0 deletions
20
packages/apidom-ls/src/config/openapi/parameter/lint/exclusive-maximum--type.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,20 @@ | ||
import { DiagnosticSeverity } from 'vscode-languageserver-types'; | ||
|
||
import ApilintCodes from '../../../codes'; | ||
import { LinterMeta } from '../../../../apidom-language-types'; | ||
import { OpenAPI2 } from '../../target-specs'; | ||
|
||
const exclusiveMaximumTypeLint: LinterMeta = { | ||
code: ApilintCodes.OPENAPI2_PARAMETER_FIELD_EXCLUSIVE_MAXIMUM_TYPE, | ||
source: 'apilint', | ||
message: 'exclusiveMaximum must be a boolean', | ||
severity: DiagnosticSeverity.Error, | ||
linterFunction: 'apilintType', | ||
linterParams: ['boolean'], | ||
marker: 'value', | ||
target: 'exclusiveMaximum', | ||
data: {}, | ||
targetSpecs: OpenAPI2, | ||
}; | ||
|
||
export default exclusiveMaximumTypeLint; |
20 changes: 20 additions & 0 deletions
20
packages/apidom-ls/src/config/openapi/parameter/lint/exclusive-minimum--type.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,20 @@ | ||
import { DiagnosticSeverity } from 'vscode-languageserver-types'; | ||
|
||
import ApilintCodes from '../../../codes'; | ||
import { LinterMeta } from '../../../../apidom-language-types'; | ||
import { OpenAPI2 } from '../../target-specs'; | ||
|
||
const exclusiveMinimumTypeLint: LinterMeta = { | ||
code: ApilintCodes.OPENAPI2_PARAMETER_FIELD_EXCLUSIVE_MINIMUM_TYPE, | ||
source: 'apilint', | ||
message: 'exclusiveMinimum must be a boolean', | ||
severity: DiagnosticSeverity.Error, | ||
linterFunction: 'apilintType', | ||
linterParams: ['boolean'], | ||
marker: 'value', | ||
target: 'exclusiveMinimum', | ||
data: {}, | ||
targetSpecs: OpenAPI2, | ||
}; | ||
|
||
export default exclusiveMinimumTypeLint; |
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/parameter/lint/in--equals-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,21 @@ | ||
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 inEquals2_0Lint: LinterMeta = { | ||
code: ApilintCodes.OPENAPI2_PARAMETER_FIELD_IN_EQUALS, | ||
source: 'apilint', | ||
message: "'in' must be one of allowed values: query, header, path, formData, body", | ||
severity: DiagnosticSeverity.Error, | ||
linterFunction: 'apilintValueOrArray', | ||
linterParams: [['query', 'header', 'path', 'formData', 'body']], | ||
marker: 'value', | ||
target: 'in', | ||
data: {}, | ||
targetSpecs: OpenAPI2, | ||
}; | ||
|
||
export default inEquals2_0Lint; |
21 changes: 21 additions & 0 deletions
21
packages/apidom-ls/src/config/openapi/parameter/lint/in--equals-3-0--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,21 @@ | ||
import { DiagnosticSeverity } from 'vscode-languageserver-types'; | ||
|
||
import ApilintCodes from '../../../codes'; | ||
import { LinterMeta } from '../../../../apidom-language-types'; | ||
import { OpenAPI3 } from '../../target-specs'; | ||
|
||
// eslint-disable-next-line @typescript-eslint/naming-convention | ||
const inEquals3_0__3_1Lint: LinterMeta = { | ||
code: ApilintCodes.OPENAPI3_0_PARAMETER_FIELD_IN_EQUALS, | ||
source: 'apilint', | ||
message: "'in' must be one of allowed values: query, header, path, cookie", | ||
severity: DiagnosticSeverity.Error, | ||
linterFunction: 'apilintValueOrArray', | ||
linterParams: [['query', 'header', 'path', 'cookie']], | ||
marker: 'value', | ||
target: 'in', | ||
data: {}, | ||
targetSpecs: OpenAPI3, | ||
}; | ||
|
||
export default inEquals3_0__3_1Lint; |
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
31 changes: 31 additions & 0 deletions
31
packages/apidom-ls/src/config/openapi/parameter/lint/in--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,31 @@ | ||
import { DiagnosticSeverity } from 'vscode-languageserver-types'; | ||
|
||
import ApilintCodes from '../../../codes'; | ||
import { LinterMeta } from '../../../../apidom-language-types'; | ||
import { OpenAPI2 } from '../../target-specs'; | ||
|
||
const inValidLint: LinterMeta = { | ||
code: ApilintCodes.OPENAPI2_PARAMETER_FIELD_IN_VALID, | ||
source: 'apilint', | ||
message: "'in' field must contain 'formData' value for 'type'=file", | ||
severity: DiagnosticSeverity.Error, | ||
linterFunction: 'apilintContainsValue', | ||
linterParams: ['formData'], | ||
marker: 'value', | ||
target: 'in', | ||
data: {}, | ||
conditions: [ | ||
{ | ||
targets: [{ path: 'type' }], | ||
function: 'apilintContainsValue', | ||
params: ['file'], | ||
}, | ||
{ | ||
function: 'missingField', | ||
params: ['$ref'], | ||
}, | ||
], | ||
targetSpecs: OpenAPI2, | ||
}; | ||
|
||
export default inValidLint; |
Oops, something went wrong.