diff --git a/packages/apidom-ls/src/config/codes.ts b/packages/apidom-ls/src/config/codes.ts index 3e401209a6..7d152d1fc3 100644 --- a/packages/apidom-ls/src/config/codes.ts +++ b/packages/apidom-ls/src/config/codes.ts @@ -723,8 +723,27 @@ enum ApilintCodes { OPENAPI3_1_OPENAPI_VALUE_PATTERN_3_1_0 = 7000100, - OPENAPI3_1_INFO = 7010000, - OPENAPI3_1_INFO_FIELD_SUMMARY_TYPE = 7010100, + OPENAPI3_1_OPEN_API = 7010000, + OPENAPI3_1_OPEN_API_REQUIRED_FIELDS = 7010010, + OPENAPI3_1_OPEN_API_FIELD_INFO_TYPE = 7010100, + OPENAPI3_1_OPEN_API_FIELD_INFO_TYPE_REQUIRED, + OPENAPI3_1_OPEN_API_FIELD_SERVERS_TYPE = 7010200, + OPENAPI3_1_OPEN_API_FIELD_SERVERS_ITEMS_TYPE, + OPENAPI3_1_OPEN_API_FIELD_PATHS_TYPE = 7010300, + OPENAPI3_1_OPEN_API_FIELD_PATHS_REQUIRED, + OPENAPI3_1_OPEN_API_FIELD_COMPONENTS_TYPE = 7010400, + OPENAPI3_1_OPEN_API_FIELD_COMPONENTS_REQUIRED, + OPENAPI3_1_OPEN_API_FIELD_SECURITY_TYPE = 7010500, + OPENAPI3_1_OPEN_API_FIELD_SECURITY_ITEMS_TYPE, + OPENAPI3_1_OPEN_API_FIELD_TAGS_TYPE = 7010600, + OPENAPI3_1_OPEN_API_FIELD_TAGS_ITEMS_TYPE, + OPENAPI3_1_OPEN_API_FIELD_EXTERNAL_DOCS_TYPE = 7010700, + OPENAPI3_1_OPEN_API_FIELD_WEBHOOKS_TYPE = 7010800, + OPENAPI3_1_OPEN_API_FIELD_WEBHOOKS_REQUIRED, + OPENAPI3_1_OPEN_API_FIELD_JSON_SCHEMA_FORMAT_URI = 7010900, + + OPENAPI3_1_INFO = 7020000, + OPENAPI3_1_INFO_FIELD_SUMMARY_TYPE = 7020100, ADS = 8000000, ADS_INFO = 8010000, diff --git a/packages/apidom-ls/src/config/openapi/info/documentation.ts b/packages/apidom-ls/src/config/openapi/info/documentation.ts index 07af02cb32..a4d06b0454 100644 --- a/packages/apidom-ls/src/config/openapi/info/documentation.ts +++ b/packages/apidom-ls/src/config/openapi/info/documentation.ts @@ -1,6 +1,6 @@ /** * Omitted fixed fields: - * - context + * - contact * - license * * Field omission reason: omitted fields do have a non-union type. Thus, diff --git a/packages/apidom-ls/src/config/openapi/openapi3_1/completion.ts b/packages/apidom-ls/src/config/openapi/openapi3_1/completion.ts new file mode 100644 index 0000000000..91a09fcf35 --- /dev/null +++ b/packages/apidom-ls/src/config/openapi/openapi3_1/completion.ts @@ -0,0 +1,140 @@ +import { + ApidomCompletionItem, + CompletionFormat, + CompletionType, +} from '../../../apidom-language-types'; + +const completion: ApidomCompletionItem[] = [ + { + label: 'openapi', + insertText: 'openapi', + kind: 14, + format: CompletionFormat.QUOTED, + type: CompletionType.PROPERTY, + insertTextFormat: 2, + documentation: { + kind: 'markdown', + value: + '**REQUIRED**. This string MUST be the [semantic version number](https://semver.org/spec/v2.0.0.html) of the [OpenAPI Specification version](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#versions) that the OpenAPI document uses. The `openapi` field SHOULD be used by tooling specifications and clients to interpret the OpenAPI document. This is *not* related to the API [`info.version`](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#infoVersion) string', + }, + }, + { + label: 'info', + insertText: 'info', + kind: 14, + format: CompletionFormat.OBJECT, + type: CompletionType.PROPERTY, + insertTextFormat: 2, + documentation: { + kind: 'markdown', + value: + '[Info Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#infoObject)\n\\\n\\\n**REQUIRED**. Provides metadata about the API. The metadata MAY be used by tooling as required.', + }, + }, + { + label: 'servers', + insertText: 'servers', + kind: 14, + format: CompletionFormat.ARRAY, + type: CompletionType.PROPERTY, + insertTextFormat: 2, + documentation: { + kind: 'markdown', + value: + '[[Server Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#serverObject)]\n\\\n\\\nAn array of Server Objects, which provide connectivity information to a target server. If the `servers` property is not provided, or is an empty array, the default value would be a [Server Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#serverObject) with a [url](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#serverUrl) value of `/`.', + }, + }, + { + label: 'paths', + insertText: 'paths', + kind: 14, + format: CompletionFormat.OBJECT, + type: CompletionType.PROPERTY, + insertTextFormat: 2, + documentation: { + kind: 'markdown', + value: + '[Paths Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#pathsObject)\n\\\n\\\n**REQUIRED**. The available paths and operations for the API.', + }, + }, + { + label: 'components', + insertText: 'components', + kind: 14, + format: CompletionFormat.OBJECT, + type: CompletionType.PROPERTY, + insertTextFormat: 2, + documentation: { + kind: 'markdown', + value: + '[Components Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#componentsObject)\n\\\n\\\nAn element to hold various schemas for the specification.', + }, + }, + { + label: 'security', + insertText: 'security', + kind: 14, + format: CompletionFormat.ARRAY, + type: CompletionType.PROPERTY, + insertTextFormat: 2, + documentation: { + kind: 'markdown', + value: + '[[Security Requirement Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#securityRequirementObject)]\n\\\n\\\nA declaration of which security mechanisms can be used across the API. The list of values includes alternative security requirement objects that can be used. Only one of the security requirement objects need to be satisfied to authorize a request. Individual operations can override this definition. To make security optional, an empty security requirement (`{}`) can be included in the array.', + }, + }, + { + label: 'tags', + insertText: 'tags', + kind: 14, + format: CompletionFormat.ARRAY, + type: CompletionType.PROPERTY, + insertTextFormat: 2, + documentation: { + kind: 'markdown', + value: + "[[Tag Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#tagObject)]\n\\\n\\\nA list of tags used by the specification with additional metadata. The order of the tags can be used to reflect on their order by the parsing tools. Not all tags that are used by the [Operation Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#operationObject) must be declared. The tags that are not declared MAY be organized randomly or based on the tools' logic. Each tag name in the list MUST be unique.", + }, + }, + { + label: 'externalDocs', + insertText: 'externalDocs', + kind: 14, + format: CompletionFormat.OBJECT, + type: CompletionType.PROPERTY, + insertTextFormat: 2, + documentation: { + kind: 'markdown', + value: + '[External Documentation Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#externalDocumentationObject)\n\\\n\\\nAdditional external documentation.', + }, + }, + { + label: 'webhooks', + insertText: 'webhooks', + kind: 14, + format: CompletionFormat.OBJECT, + type: CompletionType.PROPERTY, + insertTextFormat: 2, + documentation: { + kind: 'markdown', + value: + 'Map[`string`, [Path Item Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#pathItemObject) | [Reference Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#referenceObject)]\n\\\n\\\nThe incoming webhooks that MAY be received as part of this API and that the API consumer MAY choose to implement. Closely related to the `callbacks` feature, this section describes requests initiated other than by an API call, for example by an out of band registration. The key name is a unique string to refer to each webhook, while the (optionally referenced) Path Item Object describes a request that may be initiated by the API provider and the expected responses. An [example](https://github.com/OAI/OpenAPI-Specification/blob/main/examples/v3.1/webhook-example.yaml) is available.', + }, + }, + { + label: 'jsonSchemaDialect', + insertText: 'jsonSchemaDialect', + kind: 14, + format: CompletionFormat.QUOTED, + type: CompletionType.PROPERTY, + insertTextFormat: 2, + documentation: { + kind: 'markdown', + value: + 'The default value for the `$schema` keyword within [Schema Objects](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#schemaObject) contained within this OAS document. This MUST be in the form of a URI.', + }, + }, +]; + +export default completion; diff --git a/packages/apidom-ls/src/config/openapi/openapi3_1/documentation.ts b/packages/apidom-ls/src/config/openapi/openapi3_1/documentation.ts index 241c4fab29..1823ccca7a 100644 --- a/packages/apidom-ls/src/config/openapi/openapi3_1/documentation.ts +++ b/packages/apidom-ls/src/config/openapi/openapi3_1/documentation.ts @@ -13,7 +13,7 @@ const documentation = [ { target: 'openapi', - docs: '`**REQUIRED**. This string MUST be the [version number](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#versions) of the OpenAPI Specification that the OpenAPI document uses. The `openapi` field SHOULD be used by tooling to interpret the OpenAPI document. This is *not* related to the API [`info.version`](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#infoVersion) string.', + docs: '**REQUIRED**. This string MUST be the [version number](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#versions) of the OpenAPI Specification that the OpenAPI document uses. The `openapi` field SHOULD be used by tooling to interpret the OpenAPI document. This is *not* related to the API [`info.version`](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#infoVersion) string.', }, { target: 'jsonSchemaDialect', diff --git a/packages/apidom-ls/src/config/openapi/openapi3_1/lint/allowed-fields.ts b/packages/apidom-ls/src/config/openapi/openapi3_1/lint/allowed-fields.ts new file mode 100644 index 0000000000..36c0b2e764 --- /dev/null +++ b/packages/apidom-ls/src/config/openapi/openapi3_1/lint/allowed-fields.ts @@ -0,0 +1,28 @@ +import ApilintCodes from '../../../codes'; +import { LinterMeta } from '../../../../apidom-language-types'; + +const allowedFieldsLint: LinterMeta = { + code: ApilintCodes.NOT_ALLOWED_FIELDS, + source: 'apilint', + message: 'Object includes not allowed fields', + severity: 1, + linterFunction: 'allowedFields', + linterParams: [ + [ + 'openapi', + 'info', + 'servers', + 'paths', + 'components', + 'security', + 'tags', + 'externalDocs', + 'jsonSchemaDialect', + 'webhooks', + ], + 'x-', + ], + marker: 'key', +}; + +export default allowedFieldsLint; diff --git a/packages/apidom-ls/src/config/openapi/openapi3_1/lint/components--type.ts b/packages/apidom-ls/src/config/openapi/openapi3_1/lint/components--type.ts new file mode 100644 index 0000000000..c03b83aacf --- /dev/null +++ b/packages/apidom-ls/src/config/openapi/openapi3_1/lint/components--type.ts @@ -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; diff --git a/packages/apidom-ls/src/config/openapi/openapi3_1/lint/external-docs--type.ts b/packages/apidom-ls/src/config/openapi/openapi3_1/lint/external-docs--type.ts new file mode 100644 index 0000000000..6b0726e3f1 --- /dev/null +++ b/packages/apidom-ls/src/config/openapi/openapi3_1/lint/external-docs--type.ts @@ -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; diff --git a/packages/apidom-ls/src/config/openapi/openapi3_1/lint/index.ts b/packages/apidom-ls/src/config/openapi/openapi3_1/lint/index.ts new file mode 100644 index 0000000000..ffabc87468 --- /dev/null +++ b/packages/apidom-ls/src/config/openapi/openapi3_1/lint/index.ts @@ -0,0 +1,35 @@ +import allowedFieldsLint from './allowed-fields'; +import requiredFieldsLint from './required-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, + requiredFieldsLint, + componentsTypeLint, + externalDocsTypeLint, + infoRequiredLint, + infoTypeLint, + jsonSchemaDialectFormatURILint, + pathsTypeLint, + securityItemsTypeLint, + securityTypeLint, + serversItemsTypeLint, + serversTypeLint, + tagsItemsTypeLint, + tagsTypeLint, + webhooksLint, +]; + +export default lints; diff --git a/packages/apidom-ls/src/config/openapi/openapi3_1/lint/info--required.ts b/packages/apidom-ls/src/config/openapi/openapi3_1/lint/info--required.ts new file mode 100644 index 0000000000..c10ce2d837 --- /dev/null +++ b/packages/apidom-ls/src/config/openapi/openapi3_1/lint/info--required.ts @@ -0,0 +1,24 @@ +import ApilintCodes from '../../../codes'; +import { LinterMeta } from '../../../../apidom-language-types'; + +const infoRequiredLint: LinterMeta = { + code: ApilintCodes.OPENAPI3_1_OPEN_API_FIELD_INFO_TYPE_REQUIRED, + source: 'apilint', + message: "should always have a 'info' section", + severity: 1, + linterFunction: 'hasRequiredField', + linterParams: ['info'], + marker: 'key', + data: { + quickFix: [ + { + message: "add 'info' section", + action: 'addChild', + snippetYaml: 'info: \n \n', + snippetJson: '"info": {\n \n },\n', + }, + ], + }, +}; + +export default infoRequiredLint; diff --git a/packages/apidom-ls/src/config/openapi/openapi3_1/lint/info--type.ts b/packages/apidom-ls/src/config/openapi/openapi3_1/lint/info--type.ts new file mode 100644 index 0000000000..82a0a641fe --- /dev/null +++ b/packages/apidom-ls/src/config/openapi/openapi3_1/lint/info--type.ts @@ -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; diff --git a/packages/apidom-ls/src/config/openapi/openapi3_1/lint/jsonSchemaDialect--format-uri.ts b/packages/apidom-ls/src/config/openapi/openapi3_1/lint/jsonSchemaDialect--format-uri.ts new file mode 100644 index 0000000000..d77912d4ab --- /dev/null +++ b/packages/apidom-ls/src/config/openapi/openapi3_1/lint/jsonSchemaDialect--format-uri.ts @@ -0,0 +1,15 @@ +import ApilintCodes from '../../../codes'; +import { LinterMeta } from '../../../../apidom-language-types'; + +const jsonSchemaDialectFormatURILint: LinterMeta = { + code: ApilintCodes.OPENAPI3_1_OPEN_API_FIELD_JSON_SCHEMA_FORMAT_URI, + source: 'apilint', + message: "'jsonSchemaDialect' value MUST be in the form of a URI.", + severity: 1, + linterFunction: 'apilintValidURI', + marker: 'value', + target: 'jsonSchemaDialect', + data: {}, +}; + +export default jsonSchemaDialectFormatURILint; diff --git a/packages/apidom-ls/src/config/openapi/openapi3_1/lint/paths--type.ts b/packages/apidom-ls/src/config/openapi/openapi3_1/lint/paths--type.ts new file mode 100644 index 0000000000..314e69547c --- /dev/null +++ b/packages/apidom-ls/src/config/openapi/openapi3_1/lint/paths--type.ts @@ -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; diff --git a/packages/apidom-ls/src/config/openapi/openapi3_1/lint/required-fields.ts b/packages/apidom-ls/src/config/openapi/openapi3_1/lint/required-fields.ts new file mode 100644 index 0000000000..da7edea25b --- /dev/null +++ b/packages/apidom-ls/src/config/openapi/openapi3_1/lint/required-fields.ts @@ -0,0 +1,31 @@ +import ApilintCodes from '../../../codes'; +import { LinterMeta } from '../../../../apidom-language-types'; + +const requiredFieldsLint: LinterMeta = { + code: ApilintCodes.OPENAPI3_1_OPEN_API_REQUIRED_FIELDS, + source: 'apilint', + message: 'OpenAPI Object must contain one the following fields: paths, components, webhooks', + severity: 1, + linterFunction: 'hasRequiredField', + linterParams: ['paths'], + marker: 'key', + conditions: [ + { + targets: [{ path: 'root' }], + function: 'missingFields', + params: [['paths', 'components', 'webhooks']], + }, + ], + data: { + quickFix: [ + { + message: "add 'paths' section", + action: 'addChild', + snippetYaml: 'paths: \n \n', + snippetJson: '"paths": {\n \n },\n', + }, + ], + }, +}; + +export default requiredFieldsLint; diff --git a/packages/apidom-ls/src/config/openapi/openapi3_1/lint/security--items-type.ts b/packages/apidom-ls/src/config/openapi/openapi3_1/lint/security--items-type.ts new file mode 100644 index 0000000000..808cc09e34 --- /dev/null +++ b/packages/apidom-ls/src/config/openapi/openapi3_1/lint/security--items-type.ts @@ -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; diff --git a/packages/apidom-ls/src/config/openapi/openapi3_1/lint/security--type.ts b/packages/apidom-ls/src/config/openapi/openapi3_1/lint/security--type.ts new file mode 100644 index 0000000000..a144cd700d --- /dev/null +++ b/packages/apidom-ls/src/config/openapi/openapi3_1/lint/security--type.ts @@ -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; diff --git a/packages/apidom-ls/src/config/openapi/openapi3_1/lint/servers--items-type.ts b/packages/apidom-ls/src/config/openapi/openapi3_1/lint/servers--items-type.ts new file mode 100644 index 0000000000..0a3f61766c --- /dev/null +++ b/packages/apidom-ls/src/config/openapi/openapi3_1/lint/servers--items-type.ts @@ -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; diff --git a/packages/apidom-ls/src/config/openapi/openapi3_1/lint/servers--type.ts b/packages/apidom-ls/src/config/openapi/openapi3_1/lint/servers--type.ts new file mode 100644 index 0000000000..5f4cef82c5 --- /dev/null +++ b/packages/apidom-ls/src/config/openapi/openapi3_1/lint/servers--type.ts @@ -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; diff --git a/packages/apidom-ls/src/config/openapi/openapi3_1/lint/tags--items-type.ts b/packages/apidom-ls/src/config/openapi/openapi3_1/lint/tags--items-type.ts new file mode 100644 index 0000000000..8c581e9cab --- /dev/null +++ b/packages/apidom-ls/src/config/openapi/openapi3_1/lint/tags--items-type.ts @@ -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; diff --git a/packages/apidom-ls/src/config/openapi/openapi3_1/lint/tags--type.ts b/packages/apidom-ls/src/config/openapi/openapi3_1/lint/tags--type.ts new file mode 100644 index 0000000000..0243ad12b0 --- /dev/null +++ b/packages/apidom-ls/src/config/openapi/openapi3_1/lint/tags--type.ts @@ -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; diff --git a/packages/apidom-ls/src/config/openapi/openapi3_1/lint/webhooks--type.ts b/packages/apidom-ls/src/config/openapi/openapi3_1/lint/webhooks--type.ts new file mode 100644 index 0000000000..d80b4636b6 --- /dev/null +++ b/packages/apidom-ls/src/config/openapi/openapi3_1/lint/webhooks--type.ts @@ -0,0 +1,18 @@ +// OPENAPI3_1_WEBHOOKS_TYPE +import ApilintCodes from '../../../codes'; +import { LinterMeta } from '../../../../apidom-language-types'; + +const webhooksLint: LinterMeta = { + code: ApilintCodes.OPENAPI3_1_OPEN_API_FIELD_WEBHOOKS_TYPE, + source: 'apilint', + message: '"webhooks" members must be Path Item Object', + severity: 1, + linterFunction: 'apilintChildrenOfElementsOrClasses', + linterParams: [['pathItem']], + marker: 'key', + markerTarget: 'webhooks', + target: 'webhooks', + data: {}, +}; + +export default webhooksLint; diff --git a/packages/apidom-ls/src/config/openapi/openapi3_1/meta.ts b/packages/apidom-ls/src/config/openapi/openapi3_1/meta.ts index 33a6f79694..381bda653d 100644 --- a/packages/apidom-ls/src/config/openapi/openapi3_1/meta.ts +++ b/packages/apidom-ls/src/config/openapi/openapi3_1/meta.ts @@ -1,7 +1,11 @@ +import lint from './lint'; +import completion from './completion'; import documentation from './documentation'; import { FormatMeta } from '../../../apidom-language-types'; const meta: FormatMeta = { + lint, + completion, documentation, };