-
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.1.0 lint rules for components object (#2118)
- Loading branch information
Showing
4 changed files
with
53 additions
and
0 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
30 changes: 30 additions & 0 deletions
30
packages/apidom-ls/src/config/openapi/components/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,30 @@ | ||
import ApilintCodes from '../../../codes'; | ||
import { LinterMeta } from '../../../../apidom-language-types'; | ||
|
||
// eslint-disable-next-line @typescript-eslint/naming-convention | ||
const allowedFieldsLint3_1: LinterMeta = { | ||
code: ApilintCodes.NOT_ALLOWED_FIELDS, | ||
source: 'apilint', | ||
message: 'Object includes not allowed fields', | ||
severity: 1, | ||
linterFunction: 'allowedFields', | ||
linterParams: [ | ||
[ | ||
'schemas', | ||
'responses', | ||
'parameters', | ||
'examples', | ||
'requestBodies', | ||
'headers', | ||
'securitySchemes', | ||
'links', | ||
'callbacks', | ||
'pathItems', | ||
], | ||
'x-', | ||
], | ||
marker: 'key', | ||
targetSpecs: [{ namespace: 'openapi', version: '3.1.0' }], | ||
}; | ||
|
||
export default allowedFieldsLint3_1; |
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
17 changes: 17 additions & 0 deletions
17
packages/apidom-ls/src/config/openapi/components/lint/path-items--values-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,17 @@ | ||
import ApilintCodes from '../../../codes'; | ||
import { LinterMeta } from '../../../../apidom-language-types'; | ||
|
||
const pathItemsValuesTypeLint: LinterMeta = { | ||
code: ApilintCodes.OPENAPI3_1_COMPONENTS_FIELD_PATH_ITEMS_VALUES_TYPE, | ||
source: 'apilint', | ||
message: '"pathItems" members must be Path Item Object', | ||
severity: 1, | ||
linterFunction: 'apilintChildrenOfElementsOrClasses', | ||
linterParams: [['pathItem']], | ||
marker: 'key', | ||
markerTarget: 'pathItems', | ||
target: 'pathItems', | ||
data: {}, | ||
}; | ||
|
||
export default pathItemsValuesTypeLint; |