-
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): additional oas31 lint rules
- Loading branch information
Showing
12 changed files
with
199 additions
and
4 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/openapi3_1/lint/components--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,16 @@ | ||
import ApilintCodes from '../../../codes'; | ||
import { LinterMeta } from '../../../../apidom-language-types'; | ||
|
||
const componentsTypeLint: LinterMeta = { | ||
code: ApilintCodes.OPENAPI3_1_OPEN_API_FIELD_COMPONENTS_TYPE, | ||
source: 'apilint', | ||
message: 'components must be an object', | ||
severity: 1, | ||
linterFunction: 'apilintElementOrClass', | ||
linterParams: ['components'], | ||
marker: 'value', | ||
target: 'components', | ||
data: {}, | ||
}; | ||
|
||
export default componentsTypeLint; |
16 changes: 16 additions & 0 deletions
16
packages/apidom-ls/src/config/openapi/openapi3_1/lint/external-docs--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,16 @@ | ||
import ApilintCodes from '../../../codes'; | ||
import { LinterMeta } from '../../../../apidom-language-types'; | ||
|
||
const externalDocsTypeLint: LinterMeta = { | ||
code: ApilintCodes.OPENAPI3_1_OPEN_API_FIELD_EXTERNAL_DOCS_TYPE, | ||
source: 'apilint', | ||
message: 'externalDocs must be an object', | ||
severity: 1, | ||
linterFunction: 'apilintElementOrClass', | ||
linterParams: ['externalDocumentation'], | ||
marker: 'value', | ||
target: 'externalDocs', | ||
data: {}, | ||
}; | ||
|
||
export default externalDocsTypeLint; |
27 changes: 26 additions & 1 deletion
27
packages/apidom-ls/src/config/openapi/openapi3_1/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,33 @@ | ||
import allowedFieldsLint from './allowed-fields'; | ||
import componentsTypeLint from './components--type'; | ||
import externalDocsTypeLint from './external-docs--type'; | ||
import infoRequiredLint from './info--required'; | ||
import infoTypeLint from './info--type'; | ||
import jsonSchemaDialectFormatURILint from './jsonSchemaDialect--format-uri'; | ||
import pathsTypeLint from './paths--type'; | ||
import securityItemsTypeLint from './security--items-type'; | ||
import securityTypeLint from './security--type'; | ||
import serversItemsTypeLint from './servers--items-type'; | ||
import serversTypeLint from './servers--type'; | ||
import tagsItemsTypeLint from './tags--items-type'; | ||
import tagsTypeLint from './tags--type'; | ||
import webhooksLint from './webhooks--type'; | ||
|
||
const lints = [allowedFieldsLint, infoRequiredLint, jsonSchemaDialectFormatURILint, webhooksLint]; | ||
const lints = [ | ||
allowedFieldsLint, | ||
componentsTypeLint, | ||
externalDocsTypeLint, | ||
infoRequiredLint, | ||
infoTypeLint, | ||
jsonSchemaDialectFormatURILint, | ||
pathsTypeLint, | ||
securityItemsTypeLint, | ||
securityTypeLint, | ||
serversItemsTypeLint, | ||
serversTypeLint, | ||
tagsItemsTypeLint, | ||
tagsTypeLint, | ||
webhooksLint, | ||
]; | ||
|
||
export default lints; |
16 changes: 16 additions & 0 deletions
16
packages/apidom-ls/src/config/openapi/openapi3_1/lint/info--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,16 @@ | ||
import ApilintCodes from '../../../codes'; | ||
import { LinterMeta } from '../../../../apidom-language-types'; | ||
|
||
const infoTypeLint: LinterMeta = { | ||
code: ApilintCodes.OPENAPI3_1_OPEN_API_FIELD_INFO_TYPE, | ||
source: 'apilint', | ||
message: 'info must be an object', | ||
severity: 1, | ||
linterFunction: 'apilintElementOrClass', | ||
linterParams: ['info'], | ||
marker: 'value', | ||
target: 'info', | ||
data: {}, | ||
}; | ||
|
||
export default infoTypeLint; |
16 changes: 16 additions & 0 deletions
16
packages/apidom-ls/src/config/openapi/openapi3_1/lint/paths--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,16 @@ | ||
import ApilintCodes from '../../../codes'; | ||
import { LinterMeta } from '../../../../apidom-language-types'; | ||
|
||
const pathsTypeLint: LinterMeta = { | ||
code: ApilintCodes.OPENAPI3_1_OPEN_API_FIELD_PATHS_TYPE, | ||
source: 'apilint', | ||
message: 'paths must be an object', | ||
severity: 1, | ||
linterFunction: 'apilintElementOrClass', | ||
linterParams: ['paths'], | ||
marker: 'value', | ||
target: 'paths', | ||
data: {}, | ||
}; | ||
|
||
export default pathsTypeLint; |
16 changes: 16 additions & 0 deletions
16
packages/apidom-ls/src/config/openapi/openapi3_1/lint/security--items-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,16 @@ | ||
import ApilintCodes from '../../../codes'; | ||
import { LinterMeta } from '../../../../apidom-language-types'; | ||
|
||
const securityItemsTypeLint: LinterMeta = { | ||
code: ApilintCodes.OPENAPI3_1_OPEN_API_FIELD_SECURITY_ITEMS_TYPE, | ||
source: 'apilint', | ||
message: 'security must be an array of Security Requirement Objects', | ||
severity: 1, | ||
linterFunction: 'apilintArrayOfElementsOrClasses', | ||
linterParams: [['securityRequirement']], | ||
marker: 'key', | ||
target: 'security', | ||
data: {}, | ||
}; | ||
|
||
export default securityItemsTypeLint; |
16 changes: 16 additions & 0 deletions
16
packages/apidom-ls/src/config/openapi/openapi3_1/lint/security--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,16 @@ | ||
import ApilintCodes from '../../../codes'; | ||
import { LinterMeta } from '../../../../apidom-language-types'; | ||
|
||
const securityTypeLint: LinterMeta = { | ||
code: ApilintCodes.OPENAPI3_1_OPEN_API_FIELD_SECURITY_TYPE, | ||
source: 'apilint', | ||
message: 'security must be an array', | ||
severity: 1, | ||
linterFunction: 'apilintElementOrClass', | ||
linterParams: ['security'], | ||
marker: 'value', | ||
target: 'security', | ||
data: {}, | ||
}; | ||
|
||
export default securityTypeLint; |
16 changes: 16 additions & 0 deletions
16
packages/apidom-ls/src/config/openapi/openapi3_1/lint/servers--items-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,16 @@ | ||
import ApilintCodes from '../../../codes'; | ||
import { LinterMeta } from '../../../../apidom-language-types'; | ||
|
||
const serverItemsTypeLint: LinterMeta = { | ||
code: ApilintCodes.OPENAPI3_1_OPEN_API_FIELD_SERVERS_ITEMS_TYPE, | ||
source: 'apilint', | ||
message: 'servers must be an array of Server Objects', | ||
severity: 1, | ||
linterFunction: 'apilintArrayOfElementsOrClasses', | ||
linterParams: [['server']], | ||
marker: 'key', | ||
target: 'servers', | ||
data: {}, | ||
}; | ||
|
||
export default serverItemsTypeLint; |
16 changes: 16 additions & 0 deletions
16
packages/apidom-ls/src/config/openapi/openapi3_1/lint/servers--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,16 @@ | ||
import ApilintCodes from '../../../codes'; | ||
import { LinterMeta } from '../../../../apidom-language-types'; | ||
|
||
const serversTypeLint: LinterMeta = { | ||
code: ApilintCodes.OPENAPI3_1_OPEN_API_FIELD_SERVERS_TYPE, | ||
source: 'apilint', | ||
message: 'servers must be an array', | ||
severity: 1, | ||
linterFunction: 'apilintElementOrClass', | ||
linterParams: ['servers'], | ||
marker: 'value', | ||
target: 'servers', | ||
data: {}, | ||
}; | ||
|
||
export default serversTypeLint; |
16 changes: 16 additions & 0 deletions
16
packages/apidom-ls/src/config/openapi/openapi3_1/lint/tags--items-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,16 @@ | ||
import ApilintCodes from '../../../codes'; | ||
import { LinterMeta } from '../../../../apidom-language-types'; | ||
|
||
const tagsItemsTypeLint: LinterMeta = { | ||
code: ApilintCodes.OPENAPI3_1_OPEN_API_FIELD_TAGS_ITEMS_TYPE, | ||
source: 'apilint', | ||
message: 'tags must be an array of Tag Objects', | ||
severity: 1, | ||
linterFunction: 'apilintArrayOfElementsOrClasses', | ||
linterParams: [['tag']], | ||
marker: 'key', | ||
target: 'tags', | ||
data: {}, | ||
}; | ||
|
||
export default tagsItemsTypeLint; |
16 changes: 16 additions & 0 deletions
16
packages/apidom-ls/src/config/openapi/openapi3_1/lint/tags--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,16 @@ | ||
import ApilintCodes from '../../../codes'; | ||
import { LinterMeta } from '../../../../apidom-language-types'; | ||
|
||
const tagsTypeLint: LinterMeta = { | ||
code: ApilintCodes.OPENAPI3_1_OPEN_API_FIELD_TAGS_TYPE, | ||
source: 'apilint', | ||
message: 'tags must be an array', | ||
severity: 1, | ||
linterFunction: 'apilintElementOrClass', | ||
linterParams: ['tags'], | ||
marker: 'value', | ||
target: 'tags', | ||
data: {}, | ||
}; | ||
|
||
export default tagsTypeLint; |