diff --git a/packages/apidom-ls/src/config/codes.ts b/packages/apidom-ls/src/config/codes.ts index 01980407c7..02d2738107 100644 --- a/packages/apidom-ls/src/config/codes.ts +++ b/packages/apidom-ls/src/config/codes.ts @@ -67,6 +67,7 @@ enum ApilintCodes { SCHEMA_TYPE_OPENAPI_3_0, SCHEMA_NULLABLE_NOT_RECOMMENDED, SCHEMA_MISSING_CORE_FIELDS, + SCHEMA_NULLABLE, DUPLICATE_KEYS = 14999, NOT_ALLOWED_FIELDS = 15000, diff --git a/packages/apidom-ls/src/config/common/schema/lint/$id--format-uri.ts b/packages/apidom-ls/src/config/common/schema/lint/$id--format-uri.ts index 6d8fa4c790..c2065556d3 100644 --- a/packages/apidom-ls/src/config/common/schema/lint/$id--format-uri.ts +++ b/packages/apidom-ls/src/config/common/schema/lint/$id--format-uri.ts @@ -2,6 +2,8 @@ import { DiagnosticSeverity } from 'vscode-languageserver-types'; import ApilintCodes from '../../../codes'; import { LinterMeta } from '../../../../apidom-language-types'; +import { AsyncAPI2 } from '../../../asyncapi/target-specs'; +import { OpenAPI3 } from '../../../openapi/target-specs'; const $idFormatURILint: LinterMeta = { code: ApilintCodes.SCHEMA_ID, @@ -12,6 +14,7 @@ const $idFormatURILint: LinterMeta = { marker: 'value', target: '$id', data: {}, + targetSpecs: [...AsyncAPI2, ...OpenAPI3], }; export default $idFormatURILint; diff --git a/packages/apidom-ls/src/config/common/schema/lint/$ref--no-siblings.ts b/packages/apidom-ls/src/config/common/schema/lint/$ref--no-siblings.ts index 349d714f5a..b3c3473530 100644 --- a/packages/apidom-ls/src/config/common/schema/lint/$ref--no-siblings.ts +++ b/packages/apidom-ls/src/config/common/schema/lint/$ref--no-siblings.ts @@ -2,6 +2,8 @@ import { DiagnosticSeverity } from 'vscode-languageserver-types'; import ApilintCodes from '../../../codes'; import { LinterMeta } from '../../../../apidom-language-types'; +import { AsyncAPI2 } from '../../../asyncapi/target-specs'; +import { OpenAPI2 } from '../../../openapi/target-specs'; const $refNoSiblingsLint: LinterMeta = { code: ApilintCodes.SCHEMA_REF_NOSIBLINGS, @@ -11,15 +13,6 @@ const $refNoSiblingsLint: LinterMeta = { linterFunction: 'allowedFields', linterParams: [['$ref']], marker: 'key', - targetSpecs: [ - { namespace: 'asyncapi', version: '2.0.0' }, - { namespace: 'asyncapi', version: '2.1.0' }, - { namespace: 'asyncapi', version: '2.2.0' }, - { namespace: 'asyncapi', version: '2.3.0' }, - { namespace: 'asyncapi', version: '2.4.0' }, - { namespace: 'asyncapi', version: '2.5.0' }, - { namespace: 'asyncapi', version: '2.6.0' }, - ], conditions: [ { function: 'existFields', @@ -36,6 +29,7 @@ const $refNoSiblingsLint: LinterMeta = { }, ], }, + targetSpecs: [...AsyncAPI2, ...OpenAPI2], }; export default $refNoSiblingsLint; diff --git a/packages/apidom-ls/src/config/common/schema/lint/$ref--valid.ts b/packages/apidom-ls/src/config/common/schema/lint/$ref--valid.ts index d2a182bdad..d245602e33 100644 --- a/packages/apidom-ls/src/config/common/schema/lint/$ref--valid.ts +++ b/packages/apidom-ls/src/config/common/schema/lint/$ref--valid.ts @@ -2,6 +2,8 @@ import { DiagnosticSeverity } from 'vscode-languageserver-types'; import ApilintCodes from '../../../codes'; import { LinterMeta } from '../../../../apidom-language-types'; +import { AsyncAPI2 } from '../../../asyncapi/target-specs'; +import { OpenAPI2, OpenAPI3 } from '../../../openapi/target-specs'; const $refValidLint: LinterMeta = { code: ApilintCodes.SCHEMA_REF, @@ -12,6 +14,7 @@ const $refValidLint: LinterMeta = { marker: 'value', target: '$ref', data: {}, + targetSpecs: [...AsyncAPI2, ...OpenAPI2, ...OpenAPI3], }; export default $refValidLint; diff --git a/packages/apidom-ls/src/config/common/schema/lint/additional-items--non-array.ts b/packages/apidom-ls/src/config/common/schema/lint/additional-items--non-array.ts index c3983535e3..7df021a903 100644 --- a/packages/apidom-ls/src/config/common/schema/lint/additional-items--non-array.ts +++ b/packages/apidom-ls/src/config/common/schema/lint/additional-items--non-array.ts @@ -2,6 +2,8 @@ import { DiagnosticSeverity } from 'vscode-languageserver-types'; import ApilintCodes from '../../../codes'; import { LinterMeta } from '../../../../apidom-language-types'; +import { AsyncAPI2 } from '../../../asyncapi/target-specs'; +import { OpenAPI3 } from '../../../openapi/target-specs'; const additionalItemsNonArrayLint: LinterMeta = { code: ApilintCodes.SCHEMA_ADDITIONALITEMS_NONARRAY, @@ -30,6 +32,7 @@ const additionalItemsNonArrayLint: LinterMeta = { }, ], }, + targetSpecs: [...AsyncAPI2, ...OpenAPI3], }; export default additionalItemsNonArrayLint; diff --git a/packages/apidom-ls/src/config/common/schema/lint/additional-items--type-openapi-3-1-asyncapi-2.ts b/packages/apidom-ls/src/config/common/schema/lint/additional-items--type-openapi-3-1--asyncapi-2.ts similarity index 85% rename from packages/apidom-ls/src/config/common/schema/lint/additional-items--type-openapi-3-1-asyncapi-2.ts rename to packages/apidom-ls/src/config/common/schema/lint/additional-items--type-openapi-3-1--asyncapi-2.ts index 7d43aebc33..41674d7d6e 100644 --- a/packages/apidom-ls/src/config/common/schema/lint/additional-items--type-openapi-3-1-asyncapi-2.ts +++ b/packages/apidom-ls/src/config/common/schema/lint/additional-items--type-openapi-3-1--asyncapi-2.ts @@ -6,7 +6,7 @@ import { AsyncAPI2 } from '../../../asyncapi/target-specs'; import { OpenAPI31 } from '../../../openapi/target-specs'; // eslint-disable-next-line @typescript-eslint/naming-convention -const additionalItemsTypeOpenAPI3_1_AsyncAPI2Lint: LinterMeta = { +const additionalItemsTypeOpenAPI3_1__AsyncAPI2Lint: LinterMeta = { code: ApilintCodes.SCHEMA_ADDITIONALITEMS, source: 'apilint', message: 'additionalItems must be a schema object or a boolean JSON schema', @@ -19,4 +19,4 @@ const additionalItemsTypeOpenAPI3_1_AsyncAPI2Lint: LinterMeta = { targetSpecs: [...OpenAPI31, ...AsyncAPI2], }; -export default additionalItemsTypeOpenAPI3_1_AsyncAPI2Lint; +export default additionalItemsTypeOpenAPI3_1__AsyncAPI2Lint; diff --git a/packages/apidom-ls/src/config/common/schema/lint/additional-items--type.ts b/packages/apidom-ls/src/config/common/schema/lint/additional-items--type.ts index 61ec4baee6..b041232f52 100644 --- a/packages/apidom-ls/src/config/common/schema/lint/additional-items--type.ts +++ b/packages/apidom-ls/src/config/common/schema/lint/additional-items--type.ts @@ -2,7 +2,7 @@ import { DiagnosticSeverity } from 'vscode-languageserver-types'; import ApilintCodes from '../../../codes'; import { LinterMeta } from '../../../../apidom-language-types'; -import { OpenAPI2, OpenAPI30 } from '../../../openapi/target-specs'; +import { OpenAPI30 } from '../../../openapi/target-specs'; const additionalItemsTypeLint: LinterMeta = { code: ApilintCodes.SCHEMA_ADDITIONALITEMS, @@ -14,7 +14,7 @@ const additionalItemsTypeLint: LinterMeta = { marker: 'value', target: 'additionalItems', data: {}, - targetSpecs: [...OpenAPI2, ...OpenAPI30], + targetSpecs: OpenAPI30, }; export default additionalItemsTypeLint; diff --git a/packages/apidom-ls/src/config/common/schema/lint/additional-properties--non-object.ts b/packages/apidom-ls/src/config/common/schema/lint/additional-properties--non-object.ts index 23cd214d6c..1ec3964058 100644 --- a/packages/apidom-ls/src/config/common/schema/lint/additional-properties--non-object.ts +++ b/packages/apidom-ls/src/config/common/schema/lint/additional-properties--non-object.ts @@ -2,6 +2,8 @@ import { DiagnosticSeverity } from 'vscode-languageserver-types'; import ApilintCodes from '../../../codes'; import { LinterMeta } from '../../../../apidom-language-types'; +import { AsyncAPI2 } from '../../../asyncapi/target-specs'; +import { OpenAPI2, OpenAPI3 } from '../../../openapi/target-specs'; const additionalPropertiesNonObjectLint: LinterMeta = { code: ApilintCodes.SCHEMA_ADDITIONALPROPERTIES_NONOBJECT, @@ -30,6 +32,7 @@ const additionalPropertiesNonObjectLint: LinterMeta = { }, ], }, + targetSpecs: [...AsyncAPI2, ...OpenAPI2, ...OpenAPI3], }; export default additionalPropertiesNonObjectLint; diff --git a/packages/apidom-ls/src/config/common/schema/lint/additional-properties--type.ts b/packages/apidom-ls/src/config/common/schema/lint/additional-properties--type.ts index b682722350..ec1438d794 100644 --- a/packages/apidom-ls/src/config/common/schema/lint/additional-properties--type.ts +++ b/packages/apidom-ls/src/config/common/schema/lint/additional-properties--type.ts @@ -2,6 +2,8 @@ import { DiagnosticSeverity } from 'vscode-languageserver-types'; import ApilintCodes from '../../../codes'; import { LinterMeta } from '../../../../apidom-language-types'; +import { AsyncAPI2 } from '../../../asyncapi/target-specs'; +import { OpenAPI2, OpenAPI3 } from '../../../openapi/target-specs'; const additionalPropertiesTypeLint: LinterMeta = { code: ApilintCodes.SCHEMA_ADDITIONALPROPERTIES, @@ -13,6 +15,7 @@ const additionalPropertiesTypeLint: LinterMeta = { marker: 'value', target: 'additionalProperties', data: {}, + targetSpecs: [...AsyncAPI2, ...OpenAPI2, ...OpenAPI3], }; export default additionalPropertiesTypeLint; diff --git a/packages/apidom-ls/src/config/common/schema/lint/all-of--type-openapi-3-1-asyncapi-2.ts b/packages/apidom-ls/src/config/common/schema/lint/all-of--type-openapi-3-1--asyncapi-2.ts similarity index 87% rename from packages/apidom-ls/src/config/common/schema/lint/all-of--type-openapi-3-1-asyncapi-2.ts rename to packages/apidom-ls/src/config/common/schema/lint/all-of--type-openapi-3-1--asyncapi-2.ts index ae38083bb8..211c72876b 100644 --- a/packages/apidom-ls/src/config/common/schema/lint/all-of--type-openapi-3-1-asyncapi-2.ts +++ b/packages/apidom-ls/src/config/common/schema/lint/all-of--type-openapi-3-1--asyncapi-2.ts @@ -6,7 +6,7 @@ import { AsyncAPI2 } from '../../../asyncapi/target-specs'; import { OpenAPI31 } from '../../../openapi/target-specs'; // eslint-disable-next-line @typescript-eslint/naming-convention -const allOfTypeOpenAPI3_1_AsyncAPI2Lint: LinterMeta = { +const allOfTypeOpenAPI3_1__AsyncAPI2Lint: LinterMeta = { code: ApilintCodes.SCHEMA_ALLOF, source: 'apilint', message: 'allOf must be a non-empty array of schema objects or boolean JSON schemas', @@ -19,4 +19,4 @@ const allOfTypeOpenAPI3_1_AsyncAPI2Lint: LinterMeta = { targetSpecs: [...OpenAPI31, ...AsyncAPI2], }; -export default allOfTypeOpenAPI3_1_AsyncAPI2Lint; +export default allOfTypeOpenAPI3_1__AsyncAPI2Lint; diff --git a/packages/apidom-ls/src/config/common/schema/lint/any-of--type-openapi-3-1-asyncapi-2.ts b/packages/apidom-ls/src/config/common/schema/lint/any-of--type-openapi-3-1--asyncapi-2.ts similarity index 87% rename from packages/apidom-ls/src/config/common/schema/lint/any-of--type-openapi-3-1-asyncapi-2.ts rename to packages/apidom-ls/src/config/common/schema/lint/any-of--type-openapi-3-1--asyncapi-2.ts index 6edca8283d..24dc63ee5d 100644 --- a/packages/apidom-ls/src/config/common/schema/lint/any-of--type-openapi-3-1-asyncapi-2.ts +++ b/packages/apidom-ls/src/config/common/schema/lint/any-of--type-openapi-3-1--asyncapi-2.ts @@ -6,7 +6,7 @@ import { AsyncAPI2 } from '../../../asyncapi/target-specs'; import { OpenAPI31 } from '../../../openapi/target-specs'; // eslint-disable-next-line @typescript-eslint/naming-convention -const anyOfTypeOpenAPI3_1_AsyncAPI2Lint: LinterMeta = { +const anyOfTypeOpenAPI3_1__AsyncAPI2Lint: LinterMeta = { code: ApilintCodes.SCHEMA_ANYOF, source: 'apilint', message: 'anyOf must be a non-empty array of schema objects or boolean JSON schemas', @@ -19,4 +19,4 @@ const anyOfTypeOpenAPI3_1_AsyncAPI2Lint: LinterMeta = { targetSpecs: [...OpenAPI31, ...AsyncAPI2], }; -export default anyOfTypeOpenAPI3_1_AsyncAPI2Lint; +export default anyOfTypeOpenAPI3_1__AsyncAPI2Lint; diff --git a/packages/apidom-ls/src/config/common/schema/lint/any-of--type.ts b/packages/apidom-ls/src/config/common/schema/lint/any-of--type.ts index 6862df6484..d2f592798b 100644 --- a/packages/apidom-ls/src/config/common/schema/lint/any-of--type.ts +++ b/packages/apidom-ls/src/config/common/schema/lint/any-of--type.ts @@ -2,7 +2,7 @@ import { DiagnosticSeverity } from 'vscode-languageserver-types'; import ApilintCodes from '../../../codes'; import { LinterMeta } from '../../../../apidom-language-types'; -import { OpenAPI2, OpenAPI30 } from '../../../openapi/target-specs'; +import { OpenAPI30 } from '../../../openapi/target-specs'; const anyOfTypeLint: LinterMeta = { code: ApilintCodes.SCHEMA_ANYOF, @@ -14,7 +14,7 @@ const anyOfTypeLint: LinterMeta = { marker: 'key', target: 'anyOf', data: {}, - targetSpecs: [...OpenAPI2, ...OpenAPI30], + targetSpecs: OpenAPI30, }; export default anyOfTypeLint; diff --git a/packages/apidom-ls/src/config/common/schema/lint/contains--non-array.ts b/packages/apidom-ls/src/config/common/schema/lint/contains--non-array.ts index be7c23cf3a..7eac997cef 100644 --- a/packages/apidom-ls/src/config/common/schema/lint/contains--non-array.ts +++ b/packages/apidom-ls/src/config/common/schema/lint/contains--non-array.ts @@ -2,6 +2,8 @@ import { DiagnosticSeverity } from 'vscode-languageserver-types'; import ApilintCodes from '../../../codes'; import { LinterMeta } from '../../../../apidom-language-types'; +import { OpenAPI3 } from '../../../openapi/target-specs'; +import { AsyncAPI2 } from '../../../asyncapi/target-specs'; const containsNonArrayLint: LinterMeta = { code: ApilintCodes.SCHEMA_CONTAINS_NONARRAY, @@ -30,6 +32,7 @@ const containsNonArrayLint: LinterMeta = { }, ], }, + targetSpecs: [...AsyncAPI2, ...OpenAPI3], }; export default containsNonArrayLint; diff --git a/packages/apidom-ls/src/config/common/schema/lint/contains--type-openapi-3-1-asyncapi-2.ts b/packages/apidom-ls/src/config/common/schema/lint/contains--type-openapi-3-1--asyncapi-2.ts similarity index 86% rename from packages/apidom-ls/src/config/common/schema/lint/contains--type-openapi-3-1-asyncapi-2.ts rename to packages/apidom-ls/src/config/common/schema/lint/contains--type-openapi-3-1--asyncapi-2.ts index 79d4867a81..5d0964d466 100644 --- a/packages/apidom-ls/src/config/common/schema/lint/contains--type-openapi-3-1-asyncapi-2.ts +++ b/packages/apidom-ls/src/config/common/schema/lint/contains--type-openapi-3-1--asyncapi-2.ts @@ -6,7 +6,7 @@ import { AsyncAPI2 } from '../../../asyncapi/target-specs'; import { OpenAPI31 } from '../../../openapi/target-specs'; // eslint-disable-next-line @typescript-eslint/naming-convention -const containsTypeOpenAPI3_1_AsyncAPI2Lint: LinterMeta = { +const containsTypeOpenAPI3_1__AsyncAPI2Lint: LinterMeta = { code: ApilintCodes.SCHEMA_CONTAINS, source: 'apilint', message: 'contains must be a schema object or a boolean JSON schema', @@ -19,4 +19,4 @@ const containsTypeOpenAPI3_1_AsyncAPI2Lint: LinterMeta = { targetSpecs: [...OpenAPI31, ...AsyncAPI2], }; -export default containsTypeOpenAPI3_1_AsyncAPI2Lint; +export default containsTypeOpenAPI3_1__AsyncAPI2Lint; diff --git a/packages/apidom-ls/src/config/common/schema/lint/contains--type.ts b/packages/apidom-ls/src/config/common/schema/lint/contains--type.ts index dd2f717bc6..96c3a98fb4 100644 --- a/packages/apidom-ls/src/config/common/schema/lint/contains--type.ts +++ b/packages/apidom-ls/src/config/common/schema/lint/contains--type.ts @@ -2,7 +2,7 @@ import { DiagnosticSeverity } from 'vscode-languageserver-types'; import ApilintCodes from '../../../codes'; import { LinterMeta } from '../../../../apidom-language-types'; -import { OpenAPI2, OpenAPI30 } from '../../../openapi/target-specs'; +import { OpenAPI30 } from '../../../openapi/target-specs'; const containsTypeLint: LinterMeta = { code: ApilintCodes.SCHEMA_CONTAINS, @@ -14,7 +14,7 @@ const containsTypeLint: LinterMeta = { marker: 'value', target: 'contains', data: {}, - targetSpecs: [...OpenAPI2, ...OpenAPI30], + targetSpecs: OpenAPI30, }; export default containsTypeLint; diff --git a/packages/apidom-ls/src/config/common/schema/lint/deprecated--type.ts b/packages/apidom-ls/src/config/common/schema/lint/deprecated--type.ts index 5b796b2dbc..ddf19458a4 100644 --- a/packages/apidom-ls/src/config/common/schema/lint/deprecated--type.ts +++ b/packages/apidom-ls/src/config/common/schema/lint/deprecated--type.ts @@ -2,6 +2,8 @@ import { DiagnosticSeverity } from 'vscode-languageserver-types'; import ApilintCodes from '../../../codes'; import { LinterMeta } from '../../../../apidom-language-types'; +import { AsyncAPI2 } from '../../../asyncapi/target-specs'; +import { OpenAPI3 } from '../../../openapi/target-specs'; const deprecatedTypeLint: LinterMeta = { code: ApilintCodes.SCHEMA_READONLY, @@ -12,15 +14,7 @@ const deprecatedTypeLint: LinterMeta = { linterParams: ['boolean'], marker: 'value', target: 'deprecated', - targetSpecs: [ - { namespace: 'asyncapi', version: '2.0.0' }, - { namespace: 'asyncapi', version: '2.1.0' }, - { namespace: 'asyncapi', version: '2.2.0' }, - { namespace: 'asyncapi', version: '2.3.0' }, - { namespace: 'asyncapi', version: '2.4.0' }, - { namespace: 'asyncapi', version: '2.5.0' }, - { namespace: 'asyncapi', version: '2.6.0' }, - ], + targetSpecs: [...AsyncAPI2, ...OpenAPI3], data: {}, }; diff --git a/packages/apidom-ls/src/config/common/schema/lint/description--type.ts b/packages/apidom-ls/src/config/common/schema/lint/description--type.ts index 31b2b1c0d9..bb57c48ae6 100644 --- a/packages/apidom-ls/src/config/common/schema/lint/description--type.ts +++ b/packages/apidom-ls/src/config/common/schema/lint/description--type.ts @@ -2,6 +2,8 @@ import { DiagnosticSeverity } from 'vscode-languageserver-types'; import ApilintCodes from '../../../codes'; import { LinterMeta } from '../../../../apidom-language-types'; +import { AsyncAPI2 } from '../../../asyncapi/target-specs'; +import { OpenAPI2, OpenAPI3 } from '../../../openapi/target-specs'; const descriptionTypeLint: LinterMeta = { code: ApilintCodes.SCHEMA_DESCRIPTION, @@ -13,6 +15,7 @@ const descriptionTypeLint: LinterMeta = { marker: 'value', target: 'description', data: {}, + targetSpecs: [...AsyncAPI2, ...OpenAPI2, ...OpenAPI3], }; export default descriptionTypeLint; diff --git a/packages/apidom-ls/src/config/common/schema/lint/discriminator--exist-in-required.ts b/packages/apidom-ls/src/config/common/schema/lint/discriminator--exist-in-required.ts index 0e8f60fba5..52c12764fa 100644 --- a/packages/apidom-ls/src/config/common/schema/lint/discriminator--exist-in-required.ts +++ b/packages/apidom-ls/src/config/common/schema/lint/discriminator--exist-in-required.ts @@ -2,6 +2,7 @@ import { DiagnosticSeverity } from 'vscode-languageserver-types'; import ApilintCodes from '../../../codes'; import { LinterMeta } from '../../../../apidom-language-types'; +import { AsyncAPI2 } from '../../../asyncapi/target-specs'; const discriminatorExistInRequiredLint: LinterMeta = { code: ApilintCodes.SCHEMA_DISCRIMINATOR_EXIST, @@ -11,15 +12,7 @@ const discriminatorExistInRequiredLint: LinterMeta = { linterFunction: 'apilintDiscriminator', marker: 'value', target: 'discriminator', - targetSpecs: [ - { namespace: 'asyncapi', version: '2.0.0' }, - { namespace: 'asyncapi', version: '2.1.0' }, - { namespace: 'asyncapi', version: '2.2.0' }, - { namespace: 'asyncapi', version: '2.3.0' }, - { namespace: 'asyncapi', version: '2.4.0' }, - { namespace: 'asyncapi', version: '2.5.0' }, - { namespace: 'asyncapi', version: '2.6.0' }, - ], + targetSpecs: AsyncAPI2, data: {}, }; diff --git a/packages/apidom-ls/src/config/common/schema/lint/discriminator--type-asyncapi-2-0--2-4.ts b/packages/apidom-ls/src/config/common/schema/lint/discriminator--type-openapi-2--asyncapi-2.ts similarity index 50% rename from packages/apidom-ls/src/config/common/schema/lint/discriminator--type-asyncapi-2-0--2-4.ts rename to packages/apidom-ls/src/config/common/schema/lint/discriminator--type-openapi-2--asyncapi-2.ts index 30cf8b42eb..0ec3635ea9 100644 --- a/packages/apidom-ls/src/config/common/schema/lint/discriminator--type-asyncapi-2-0--2-4.ts +++ b/packages/apidom-ls/src/config/common/schema/lint/discriminator--type-openapi-2--asyncapi-2.ts @@ -2,8 +2,11 @@ import { DiagnosticSeverity } from 'vscode-languageserver-types'; import ApilintCodes from '../../../codes'; import { LinterMeta } from '../../../../apidom-language-types'; +import { AsyncAPI2 } from '../../../asyncapi/target-specs'; +import { OpenAPI2 } from '../../../openapi/target-specs'; -const discriminatorTypeLint: LinterMeta = { +// eslint-disable-next-line @typescript-eslint/naming-convention +const discriminatorTypeOpenAPI2__AsyncAPI2Lint: LinterMeta = { code: ApilintCodes.SCHEMA_DISCRIMINATOR, source: 'apilint', message: "'discriminator' value must be a string", @@ -13,15 +16,7 @@ const discriminatorTypeLint: LinterMeta = { marker: 'value', target: 'discriminator', data: {}, - targetSpecs: [ - { namespace: 'asyncapi', version: '2.0.0' }, - { namespace: 'asyncapi', version: '2.1.0' }, - { namespace: 'asyncapi', version: '2.2.0' }, - { namespace: 'asyncapi', version: '2.3.0' }, - { namespace: 'asyncapi', version: '2.4.0' }, - { namespace: 'asyncapi', version: '2.5.0' }, - { namespace: 'asyncapi', version: '2.6.0' }, - ], + targetSpecs: [...AsyncAPI2, ...OpenAPI2], }; -export default discriminatorTypeLint; +export default discriminatorTypeOpenAPI2__AsyncAPI2Lint; diff --git a/packages/apidom-ls/src/config/common/schema/lint/discriminator--type-openapi-3.ts b/packages/apidom-ls/src/config/common/schema/lint/discriminator--type-openapi-3.ts new file mode 100644 index 0000000000..c3db7a4fca --- /dev/null +++ b/packages/apidom-ls/src/config/common/schema/lint/discriminator--type-openapi-3.ts @@ -0,0 +1,20 @@ +import { DiagnosticSeverity } from 'vscode-languageserver-types'; + +import ApilintCodes from '../../../codes'; +import { LinterMeta } from '../../../../apidom-language-types'; +import { OpenAPI3 } from '../../../openapi/target-specs'; + +const discriminatorTypeOpenAPI3Lint: LinterMeta = { + code: ApilintCodes.SCHEMA_DISCRIMINATOR, + source: 'apilint', + message: "'discriminator' value must be an object", + severity: DiagnosticSeverity.Error, + linterFunction: 'apilintType', + linterParams: ['discriminator'], + marker: 'value', + target: 'discriminator', + data: {}, + targetSpecs: OpenAPI3, +}; + +export default discriminatorTypeOpenAPI3Lint; diff --git a/packages/apidom-ls/src/config/common/schema/lint/else--non-if.ts b/packages/apidom-ls/src/config/common/schema/lint/else--non-if.ts index a741db98b8..5613df0bd7 100644 --- a/packages/apidom-ls/src/config/common/schema/lint/else--non-if.ts +++ b/packages/apidom-ls/src/config/common/schema/lint/else--non-if.ts @@ -2,6 +2,8 @@ import { DiagnosticSeverity } from 'vscode-languageserver-types'; import ApilintCodes from '../../../codes'; import { LinterMeta } from '../../../../apidom-language-types'; +import { AsyncAPI2 } from '../../../asyncapi/target-specs'; +import { OpenAPI31 } from '../../../openapi/target-specs'; const elseNonIfLint: LinterMeta = { code: ApilintCodes.SCHEMA_ELSE_NONIF, @@ -28,6 +30,7 @@ const elseNonIfLint: LinterMeta = { }, ], }, + targetSpecs: [...AsyncAPI2, ...OpenAPI31], }; export default elseNonIfLint; diff --git a/packages/apidom-ls/src/config/common/schema/lint/else--type-openapi-3-1-asyncapi-2.ts b/packages/apidom-ls/src/config/common/schema/lint/else--type-openapi-3-1-asyncapi-2.ts deleted file mode 100644 index 42e570ea49..0000000000 --- a/packages/apidom-ls/src/config/common/schema/lint/else--type-openapi-3-1-asyncapi-2.ts +++ /dev/null @@ -1,22 +0,0 @@ -import { DiagnosticSeverity } from 'vscode-languageserver-types'; - -import ApilintCodes from '../../../codes'; -import { LinterMeta } from '../../../../apidom-language-types'; -import { AsyncAPI2 } from '../../../asyncapi/target-specs'; -import { OpenAPI31 } from '../../../openapi/target-specs'; - -// eslint-disable-next-line @typescript-eslint/naming-convention -const elseTypeOpenAPI3_1_AsyncAPI2Lint: LinterMeta = { - code: ApilintCodes.SCHEMA_ELSE, - source: 'apilint', - message: '"else" must be a schema object or a boolean JSON schema', - severity: DiagnosticSeverity.Error, - linterFunction: 'apilintElementOrClass', - linterParams: ['schema', 'boolean'], - marker: 'value', - target: 'else', - data: {}, - targetSpecs: [...OpenAPI31, ...AsyncAPI2], -}; - -export default elseTypeOpenAPI3_1_AsyncAPI2Lint; diff --git a/packages/apidom-ls/src/config/common/schema/lint/else--type.ts b/packages/apidom-ls/src/config/common/schema/lint/else--type.ts index 403425ec7e..75bca02366 100644 --- a/packages/apidom-ls/src/config/common/schema/lint/else--type.ts +++ b/packages/apidom-ls/src/config/common/schema/lint/else--type.ts @@ -2,19 +2,20 @@ import { DiagnosticSeverity } from 'vscode-languageserver-types'; import ApilintCodes from '../../../codes'; import { LinterMeta } from '../../../../apidom-language-types'; -import { OpenAPI2, OpenAPI30 } from '../../../openapi/target-specs'; +import { AsyncAPI2 } from '../../../asyncapi/target-specs'; +import { OpenAPI31 } from '../../../openapi/target-specs'; const elseTypeLint: LinterMeta = { code: ApilintCodes.SCHEMA_ELSE, source: 'apilint', - message: '"else" must be a schema', + message: '"else" must be a schema object or a boolean JSON schema', severity: DiagnosticSeverity.Error, linterFunction: 'apilintElementOrClass', - linterParams: ['schema'], + linterParams: ['schema', 'boolean'], marker: 'value', target: 'else', data: {}, - targetSpecs: [...OpenAPI2, ...OpenAPI30], + targetSpecs: [...OpenAPI31, ...AsyncAPI2], }; export default elseTypeLint; diff --git a/packages/apidom-ls/src/config/common/schema/lint/enum--unique.ts b/packages/apidom-ls/src/config/common/schema/lint/enum--unique.ts index d9e35d0e9c..1cee080754 100644 --- a/packages/apidom-ls/src/config/common/schema/lint/enum--unique.ts +++ b/packages/apidom-ls/src/config/common/schema/lint/enum--unique.ts @@ -2,6 +2,8 @@ import { DiagnosticSeverity } from 'vscode-languageserver-types'; import ApilintCodes from '../../../codes'; import { LinterMeta } from '../../../../apidom-language-types'; +import { OpenAPI2, OpenAPI3 } from '../../../openapi/target-specs'; +import { AsyncAPI2 } from '../../../asyncapi/target-specs'; const enumUniqueLint: LinterMeta = { code: ApilintCodes.SCHEMA_ENUM, @@ -12,6 +14,7 @@ const enumUniqueLint: LinterMeta = { marker: 'value', target: 'enum', data: {}, + targetSpecs: [...AsyncAPI2, ...OpenAPI2, ...OpenAPI3], }; export default enumUniqueLint; diff --git a/packages/apidom-ls/src/config/common/schema/lint/example--deprecated.ts b/packages/apidom-ls/src/config/common/schema/lint/example--deprecated.ts index 709e4e20d0..e8e753f0d1 100644 --- a/packages/apidom-ls/src/config/common/schema/lint/example--deprecated.ts +++ b/packages/apidom-ls/src/config/common/schema/lint/example--deprecated.ts @@ -2,6 +2,7 @@ import { DiagnosticSeverity } from 'vscode-languageserver-types'; import ApilintCodes from '../../../codes'; import { LinterMeta } from '../../../../apidom-language-types'; +import { OpenAPI31 } from '../../../openapi/target-specs'; const exampleDeprecatedLint: LinterMeta = { code: ApilintCodes.SCHEMA_EXAMPLE_DEPRECATED, @@ -12,7 +13,6 @@ const exampleDeprecatedLint: LinterMeta = { linterParams: ['example'], marker: 'key', markerTarget: 'example', - targetSpecs: [{ namespace: 'openapi', version: '3.1.0' }], data: { quickFix: [ { @@ -29,6 +29,7 @@ const exampleDeprecatedLint: LinterMeta = { }, ], }, + targetSpecs: OpenAPI31, }; export default exampleDeprecatedLint; diff --git a/packages/apidom-ls/src/config/common/schema/lint/examples--type.ts b/packages/apidom-ls/src/config/common/schema/lint/examples--type.ts index 1e74d3a69e..d25aa05ce5 100644 --- a/packages/apidom-ls/src/config/common/schema/lint/examples--type.ts +++ b/packages/apidom-ls/src/config/common/schema/lint/examples--type.ts @@ -2,6 +2,8 @@ import { DiagnosticSeverity } from 'vscode-languageserver-types'; import ApilintCodes from '../../../codes'; import { LinterMeta } from '../../../../apidom-language-types'; +import { OpenAPI31 } from '../../../openapi/target-specs'; +import { AsyncAPI2 } from '../../../asyncapi/target-specs'; const examplesTypeLint: LinterMeta = { code: ApilintCodes.SCHEMA_EXAMPLES, @@ -12,6 +14,7 @@ const examplesTypeLint: LinterMeta = { marker: 'key', target: 'examples', data: {}, + targetSpecs: [...AsyncAPI2, ...OpenAPI31], }; export default examplesTypeLint; diff --git a/packages/apidom-ls/src/config/common/schema/lint/exclusive-maximum--pattern.ts b/packages/apidom-ls/src/config/common/schema/lint/exclusive-maximum--pattern.ts index 4488aba868..199f1d7f14 100644 --- a/packages/apidom-ls/src/config/common/schema/lint/exclusive-maximum--pattern.ts +++ b/packages/apidom-ls/src/config/common/schema/lint/exclusive-maximum--pattern.ts @@ -2,17 +2,20 @@ import { DiagnosticSeverity } from 'vscode-languageserver-types'; import ApilintCodes from '../../../codes'; import { LinterMeta } from '../../../../apidom-language-types'; +import { AsyncAPI2 } from '../../../asyncapi/target-specs'; +import { OpenAPI31 } from '../../../openapi/target-specs'; const exclusiveMaximumPatternLint: LinterMeta = { code: ApilintCodes.SCHEMA_EXCLUSIVEMAXIMUM, source: 'apilint', - message: "exclusiveMaximum' value must be a number", + message: 'exclusiveMaximum value must be a number', severity: DiagnosticSeverity.Error, linterFunction: 'apilintValueRegex', linterParams: ['^-?\\d*\\.{0,1}\\d+$', 'number'], marker: 'value', target: 'exclusiveMaximum', data: {}, + targetSpecs: [...AsyncAPI2, ...OpenAPI31], }; export default exclusiveMaximumPatternLint; diff --git a/packages/apidom-ls/src/config/common/schema/lint/exclusive-maximum--type.ts b/packages/apidom-ls/src/config/common/schema/lint/exclusive-maximum--type.ts new file mode 100644 index 0000000000..c6e1c43369 --- /dev/null +++ b/packages/apidom-ls/src/config/common/schema/lint/exclusive-maximum--type.ts @@ -0,0 +1,20 @@ +import { DiagnosticSeverity } from 'vscode-languageserver-types'; + +import ApilintCodes from '../../../codes'; +import { LinterMeta } from '../../../../apidom-language-types'; +import { OpenAPI2, OpenAPI30 } from '../../../openapi/target-specs'; + +const exclusiveMaximumTypeLint: LinterMeta = { + code: ApilintCodes.SCHEMA_EXCLUSIVEMAXIMUM, + source: 'apilint', + message: 'exclusiveMaximum value must be a boolean', + severity: DiagnosticSeverity.Error, + linterFunction: 'apilintType', + linterParams: ['boolean'], + marker: 'value', + target: 'exclusiveMaximum', + data: {}, + targetSpecs: [...OpenAPI2, ...OpenAPI30], +}; + +export default exclusiveMaximumTypeLint; diff --git a/packages/apidom-ls/src/config/common/schema/lint/exclusive-minimum--pattern.ts b/packages/apidom-ls/src/config/common/schema/lint/exclusive-minimum--pattern.ts index e3550043a1..f352892bea 100644 --- a/packages/apidom-ls/src/config/common/schema/lint/exclusive-minimum--pattern.ts +++ b/packages/apidom-ls/src/config/common/schema/lint/exclusive-minimum--pattern.ts @@ -2,17 +2,20 @@ import { DiagnosticSeverity } from 'vscode-languageserver-types'; import ApilintCodes from '../../../codes'; import { LinterMeta } from '../../../../apidom-language-types'; +import { AsyncAPI2 } from '../../../asyncapi/target-specs'; +import { OpenAPI31 } from '../../../openapi/target-specs'; const exclusiveMinimumPatternLint: LinterMeta = { code: ApilintCodes.SCHEMA_EXCLUSIVEMINUMUM, source: 'apilint', - message: "exclusiveMinimum' value must be a number", + message: 'exclusiveMinimum value must be a number', severity: DiagnosticSeverity.Error, linterFunction: 'apilintValueRegex', linterParams: ['^-?\\d*\\.{0,1}\\d+$', 'number'], marker: 'value', target: 'exclusiveMinimum', data: {}, + targetSpecs: [...AsyncAPI2, ...OpenAPI31], }; export default exclusiveMinimumPatternLint; diff --git a/packages/apidom-ls/src/config/common/schema/lint/exclusive-minimum--type.ts b/packages/apidom-ls/src/config/common/schema/lint/exclusive-minimum--type.ts new file mode 100644 index 0000000000..8bbbda0b97 --- /dev/null +++ b/packages/apidom-ls/src/config/common/schema/lint/exclusive-minimum--type.ts @@ -0,0 +1,20 @@ +import { DiagnosticSeverity } from 'vscode-languageserver-types'; + +import ApilintCodes from '../../../codes'; +import { LinterMeta } from '../../../../apidom-language-types'; +import { OpenAPI2, OpenAPI30 } from '../../../openapi/target-specs'; + +const exclusiveMinimumTypeLint: LinterMeta = { + code: ApilintCodes.SCHEMA_EXCLUSIVEMAXIMUM, + source: 'apilint', + message: 'exclusiveMinimum value must be a boolean', + severity: DiagnosticSeverity.Error, + linterFunction: 'apilintType', + linterParams: ['boolean'], + marker: 'value', + target: 'exclusiveMinimum', + data: {}, + targetSpecs: [...OpenAPI2, ...OpenAPI30], +}; + +export default exclusiveMinimumTypeLint; diff --git a/packages/apidom-ls/src/config/common/schema/lint/external-docs--type.ts b/packages/apidom-ls/src/config/common/schema/lint/external-docs--type.ts index 13b4ba3d1b..296811ed2d 100644 --- a/packages/apidom-ls/src/config/common/schema/lint/external-docs--type.ts +++ b/packages/apidom-ls/src/config/common/schema/lint/external-docs--type.ts @@ -2,6 +2,8 @@ import { DiagnosticSeverity } from 'vscode-languageserver-types'; import ApilintCodes from '../../../codes'; import { LinterMeta } from '../../../../apidom-language-types'; +import { AsyncAPI2 } from '../../../asyncapi/target-specs'; +import { OpenAPI2, OpenAPI3 } from '../../../openapi/target-specs'; const externalDocsTypeLint: LinterMeta = { code: ApilintCodes.SCHEMA_EXTERNAL_DOCS, @@ -13,6 +15,7 @@ const externalDocsTypeLint: LinterMeta = { marker: 'value', target: 'externalDocs', data: {}, + targetSpecs: [...AsyncAPI2, ...OpenAPI2, ...OpenAPI3], }; export default externalDocsTypeLint; diff --git a/packages/apidom-ls/src/config/common/schema/lint/format--type.ts b/packages/apidom-ls/src/config/common/schema/lint/format--type.ts index 9a5c0f7f87..2b99f8e7f8 100644 --- a/packages/apidom-ls/src/config/common/schema/lint/format--type.ts +++ b/packages/apidom-ls/src/config/common/schema/lint/format--type.ts @@ -2,6 +2,8 @@ import { DiagnosticSeverity } from 'vscode-languageserver-types'; import ApilintCodes from '../../../codes'; import { LinterMeta } from '../../../../apidom-language-types'; +import { AsyncAPI2 } from '../../../asyncapi/target-specs'; +import { OpenAPI2, OpenAPI3 } from '../../../openapi/target-specs'; const formatTypeLint: LinterMeta = { code: ApilintCodes.SCHEMA_FORMAT, @@ -13,6 +15,7 @@ const formatTypeLint: LinterMeta = { marker: 'value', target: 'format', data: {}, + targetSpecs: [...AsyncAPI2, ...OpenAPI2, ...OpenAPI3], }; export default formatTypeLint; diff --git a/packages/apidom-ls/src/config/common/schema/lint/if--non-then.ts b/packages/apidom-ls/src/config/common/schema/lint/if--non-then.ts index 34f458b74e..6e1197caf4 100644 --- a/packages/apidom-ls/src/config/common/schema/lint/if--non-then.ts +++ b/packages/apidom-ls/src/config/common/schema/lint/if--non-then.ts @@ -2,6 +2,8 @@ import { DiagnosticSeverity } from 'vscode-languageserver-types'; import ApilintCodes from '../../../codes'; import { LinterMeta } from '../../../../apidom-language-types'; +import { OpenAPI31 } from '../../../openapi/target-specs'; +import { AsyncAPI2 } from '../../../asyncapi/target-specs'; const ifNonThenLint: LinterMeta = { code: ApilintCodes.SCHEMA_IF_NONTHEN, @@ -28,6 +30,7 @@ const ifNonThenLint: LinterMeta = { }, ], }, + targetSpecs: [...AsyncAPI2, ...OpenAPI31], }; export default ifNonThenLint; diff --git a/packages/apidom-ls/src/config/common/schema/lint/if--type-openapi-3-1-asyncapi-2.ts b/packages/apidom-ls/src/config/common/schema/lint/if--type-openapi-3-1-asyncapi-2.ts deleted file mode 100644 index ac67cfb099..0000000000 --- a/packages/apidom-ls/src/config/common/schema/lint/if--type-openapi-3-1-asyncapi-2.ts +++ /dev/null @@ -1,22 +0,0 @@ -import { DiagnosticSeverity } from 'vscode-languageserver-types'; - -import ApilintCodes from '../../../codes'; -import { LinterMeta } from '../../../../apidom-language-types'; -import { AsyncAPI2 } from '../../../asyncapi/target-specs'; -import { OpenAPI31 } from '../../../openapi/target-specs'; - -// eslint-disable-next-line @typescript-eslint/naming-convention -const ifTypeOpenAPI3_1_AsyncAPI2Lint: LinterMeta = { - code: ApilintCodes.SCHEMA_IF, - source: 'apilint', - message: '"if" must be a schema object or a boolean JSON schema', - severity: DiagnosticSeverity.Error, - linterFunction: 'apilintElementOrClass', - linterParams: ['schema', 'boolean'], - marker: 'value', - target: 'if', - data: {}, - targetSpecs: [...OpenAPI31, ...AsyncAPI2], -}; - -export default ifTypeOpenAPI3_1_AsyncAPI2Lint; diff --git a/packages/apidom-ls/src/config/common/schema/lint/if--type.ts b/packages/apidom-ls/src/config/common/schema/lint/if--type.ts index 8224ad25e6..11b93935b0 100644 --- a/packages/apidom-ls/src/config/common/schema/lint/if--type.ts +++ b/packages/apidom-ls/src/config/common/schema/lint/if--type.ts @@ -2,19 +2,20 @@ import { DiagnosticSeverity } from 'vscode-languageserver-types'; import ApilintCodes from '../../../codes'; import { LinterMeta } from '../../../../apidom-language-types'; -import { OpenAPI2, OpenAPI30 } from '../../../openapi/target-specs'; +import { OpenAPI31 } from '../../../openapi/target-specs'; +import { AsyncAPI2 } from '../../../asyncapi/target-specs'; const ifTypeLint: LinterMeta = { code: ApilintCodes.SCHEMA_IF, source: 'apilint', - message: 'if must be a schema', + message: '"if" must be a schema object or a boolean JSON schema', severity: DiagnosticSeverity.Error, linterFunction: 'apilintElementOrClass', - linterParams: ['schema'], + linterParams: ['schema', 'boolean'], marker: 'value', target: 'if', data: {}, - targetSpecs: [...OpenAPI2, ...OpenAPI30], + targetSpecs: [...OpenAPI31, ...AsyncAPI2], }; export default ifTypeLint; diff --git a/packages/apidom-ls/src/config/common/schema/lint/index.ts b/packages/apidom-ls/src/config/common/schema/lint/index.ts index 9bc1e5760b..ecc3a771de 100644 --- a/packages/apidom-ls/src/config/common/schema/lint/index.ts +++ b/packages/apidom-ls/src/config/common/schema/lint/index.ts @@ -3,31 +3,32 @@ import $refValidLint from './$ref--valid'; import $refNoSiblingsLint from './$ref--no-siblings'; import additionalItemsNonArrayLint from './additional-items--non-array'; import additionalItemsTypeLint from './additional-items--type'; -import additionalItemsTypeOpenAPI3_1_AsyncAPI2Lint from './additional-items--type-openapi-3-1-asyncapi-2'; +import additionalItemsTypeOpenAPI3_1__AsyncAPI2Lint from './additional-items--type-openapi-3-1--asyncapi-2'; import additionalPropertiesNonObject from './additional-properties--non-object'; import additionalPropertiesTypeLint from './additional-properties--type'; import allOfTypeLint from './all-of--type'; -import allOfTypeOpenAPI3_1_AsyncAPI2Lint from './all-of--type-openapi-3-1-asyncapi-2'; +import allOfTypeOpenAPI3_1__AsyncAPI2Lint from './all-of--type-openapi-3-1--asyncapi-2'; import anyOfTypeLint from './any-of--type'; -import anyOfTypeOpenAPI3_1_AsyncAPI2Lint from './any-of--type-openapi-3-1-asyncapi-2'; +import anyOfTypeOpenAPI3_1__AsyncAPI2Lint from './any-of--type-openapi-3-1--asyncapi-2'; import containsNonArrayLint from './contains--non-array'; import containsTypeLint from './contains--type'; -import containsTypeOpenAPI3_1_AsyncAPI2Lint from './contains--type-openapi-3-1-asyncapi-2'; +import containsTypeOpenAPI3_1__AsyncAPI2Lint from './contains--type-openapi-3-1--asyncapi-2'; import descriptionTypeLint from './description--type'; import discriminatorExistInRequiredLint from './discriminator--exist-in-required'; -import discriminatorTypeLint from './discriminator--type-asyncapi-2-0--2-4'; +import discriminatorTypeOpenAPI2__AsyncAPI2Lint from './discriminator--type-openapi-2--asyncapi-2'; +import discriminatorTypeOpenAPI3Lint from './discriminator--type-openapi-3'; import elseNonIfLint from './else--non-if'; import elseTypeLint from './else--type'; -import elseTypeOpenAPI3_1_AsyncAPI2Lint from './else--type-openapi-3-1-asyncapi-2'; import enumUniqueLint from './enum--unique'; import examplesTypeLint from './examples--type'; import exclusiveMaximumPatternLint from './exclusive-maximum--pattern'; +import exclusiveMaximumTypeLint from './exclusive-maximum--type'; import exclusiveMinimumPatternLint from './exclusive-minimum--pattern'; +import exclusiveMinimumTypeLint from './exclusive-minimum--type'; import externalDocsTypeLint from './external-docs--type'; import formatTypeLint from './format--type'; import ifNonThenLint from './if--non-then'; import ifTypeLint from './if--type'; -import ifTypeOpenAPI3_1_AsyncAPI2Lint from './if--type-openapi-3-1-asyncapi-2'; import itemsNonArrayLint from './items--non-array'; import itemsTypeLint from './items--type'; import maxItemsNonArrayLint from './max-items--non-array'; @@ -49,9 +50,10 @@ import missingCoreFieldsAsyncAPI2Lint from './missing-core-fields-asyncapi-2'; import multipleOfTypeLint from './multiple-of--type'; import notTypeLint from './not--type'; import notTypeOpenAPI3_1_AsyncAPI2Lint from './not--type-openapi-3-1-asyncapi-2'; +import nullableTypeLint from './nullable--type'; import nullableNotRecommendedLint from './nullable--not-recommended'; import oneOfTypeLint from './one-of--type'; -import oneOfTypeOpenAPI3_1_AsyncAPI2Lint from './one-of--type-openapi-3-1-asyncapi-2'; +import oneOfTypeOpenAPI3_1__AsyncAPI2Lint from './one-of--type-openapi-3-1--asyncapi-2'; import patternTypeLint from './pattern--type'; import patternPropertiesKeysRegexpLint from './pattern-properties--keys-regexp'; import patternPropertiesNonObjectLint from './pattern-properties--non-object'; @@ -59,20 +61,19 @@ import patternPropertiesTypeLint from './pattern-properties--type'; import patternPropertiesValuesTypeLint from './pattern-properties--values-type'; import propertiesTypeLint from './properties--type'; import propertiesValuesTypeLint from './properties--values-type'; -import propertiesValuesTypeOpenAPI3_1_AsyncAPI2Lint from './properties--values-type-openapi-3-1-asyncapi-2'; +import propertiesValuesTypeOpenAPI3_1__AsyncAPI2Lint from './properties--values-type-openapi-3-1--asyncapi-2'; import propertyNamesNonObjectLint from './property-names--non-object'; import propertyNamesTypeLint from './property-names--type'; -import propertyNamesTypeOpenAPI3_1_AsyncAPI2Lint from './property-names--type-openapi-3-1-asyncapi-2'; import readOnlyTypeLint from './read-only--type'; import requiredDefinedLint from './required--defined'; import requiredNonObjectLint from './required--non-object'; import requiredTypeLint from './required--type'; import thenNonIfLint from './then--non-if'; import thenTypeLint from './then--type'; -import thenTypeOpenAPI3_1_AsyncAPI2Lint from './then--type-openapi-3-1-asyncapi-2'; import titleTypeLint from './title--type'; import typeTypeLint from './type--type'; -import typeTypeOpenAPI3_0Lint from './type--type-openapi-3-0'; +import typeEqualsLint from './type--equals'; +import typeEqualsOpenAPI3_1__AsyncAPI2Lint from './type--equals-openapi-3-1--asyncapi-2'; import uniqueItemsNonArrayLint from './unique-items--non-array'; import uniqueItemsTypeLint from './unique-items--type'; import writeOnlyTypeLint from './write-only--type'; @@ -84,31 +85,32 @@ const schemaLints = [ $refNoSiblingsLint, additionalItemsNonArrayLint, additionalItemsTypeLint, - additionalItemsTypeOpenAPI3_1_AsyncAPI2Lint, + additionalItemsTypeOpenAPI3_1__AsyncAPI2Lint, additionalPropertiesNonObject, additionalPropertiesTypeLint, allOfTypeLint, - allOfTypeOpenAPI3_1_AsyncAPI2Lint, - anyOfTypeOpenAPI3_1_AsyncAPI2Lint, + allOfTypeOpenAPI3_1__AsyncAPI2Lint, + anyOfTypeOpenAPI3_1__AsyncAPI2Lint, anyOfTypeLint, containsNonArrayLint, containsTypeLint, - containsTypeOpenAPI3_1_AsyncAPI2Lint, + containsTypeOpenAPI3_1__AsyncAPI2Lint, descriptionTypeLint, discriminatorExistInRequiredLint, - discriminatorTypeLint, + discriminatorTypeOpenAPI2__AsyncAPI2Lint, + discriminatorTypeOpenAPI3Lint, elseNonIfLint, elseTypeLint, - elseTypeOpenAPI3_1_AsyncAPI2Lint, enumUniqueLint, examplesTypeLint, exclusiveMaximumPatternLint, + exclusiveMaximumTypeLint, exclusiveMinimumPatternLint, + exclusiveMinimumTypeLint, externalDocsTypeLint, formatTypeLint, ifNonThenLint, ifTypeLint, - ifTypeOpenAPI3_1_AsyncAPI2Lint, itemsNonArrayLint, itemsTypeLint, maxItemsNonArrayLint, @@ -130,9 +132,10 @@ const schemaLints = [ multipleOfTypeLint, notTypeLint, notTypeOpenAPI3_1_AsyncAPI2Lint, + nullableTypeLint, nullableNotRecommendedLint, oneOfTypeLint, - oneOfTypeOpenAPI3_1_AsyncAPI2Lint, + oneOfTypeOpenAPI3_1__AsyncAPI2Lint, patternTypeLint, patternPropertiesKeysRegexpLint, patternPropertiesNonObjectLint, @@ -140,20 +143,19 @@ const schemaLints = [ patternPropertiesValuesTypeLint, propertiesTypeLint, propertiesValuesTypeLint, - propertiesValuesTypeOpenAPI3_1_AsyncAPI2Lint, + propertiesValuesTypeOpenAPI3_1__AsyncAPI2Lint, propertyNamesNonObjectLint, propertyNamesTypeLint, - propertyNamesTypeOpenAPI3_1_AsyncAPI2Lint, readOnlyTypeLint, requiredDefinedLint, requiredNonObjectLint, requiredTypeLint, thenNonIfLint, thenTypeLint, - thenTypeOpenAPI3_1_AsyncAPI2Lint, titleTypeLint, typeTypeLint, - typeTypeOpenAPI3_0Lint, + typeEqualsLint, + typeEqualsOpenAPI3_1__AsyncAPI2Lint, uniqueItemsNonArrayLint, uniqueItemsTypeLint, writeOnlyTypeLint, diff --git a/packages/apidom-ls/src/config/common/schema/lint/items--non-array.ts b/packages/apidom-ls/src/config/common/schema/lint/items--non-array.ts index 49366ac72b..9312e33056 100644 --- a/packages/apidom-ls/src/config/common/schema/lint/items--non-array.ts +++ b/packages/apidom-ls/src/config/common/schema/lint/items--non-array.ts @@ -2,6 +2,8 @@ import { DiagnosticSeverity } from 'vscode-languageserver-types'; import ApilintCodes from '../../../codes'; import { LinterMeta } from '../../../../apidom-language-types'; +import { AsyncAPI2 } from '../../../asyncapi/target-specs'; +import { OpenAPI2, OpenAPI3 } from '../../../openapi/target-specs'; const itemsNonArrayLint: LinterMeta = { code: ApilintCodes.SCHEMA_ITEMS_NONARRAY, @@ -30,6 +32,7 @@ const itemsNonArrayLint: LinterMeta = { }, ], }, + targetSpecs: [...AsyncAPI2, ...OpenAPI2, ...OpenAPI3], }; export default itemsNonArrayLint; diff --git a/packages/apidom-ls/src/config/common/schema/lint/items--type.ts b/packages/apidom-ls/src/config/common/schema/lint/items--type.ts index b3cb197896..165002f899 100644 --- a/packages/apidom-ls/src/config/common/schema/lint/items--type.ts +++ b/packages/apidom-ls/src/config/common/schema/lint/items--type.ts @@ -2,6 +2,8 @@ import { DiagnosticSeverity } from 'vscode-languageserver-types'; import ApilintCodes from '../../../codes'; import { LinterMeta } from '../../../../apidom-language-types'; +import { AsyncAPI2 } from '../../../asyncapi/target-specs'; +import { OpenAPI2, OpenAPI3 } from '../../../openapi/target-specs'; const itemsTypeLint: LinterMeta = { code: ApilintCodes.SCHEMA_ITEMS, @@ -13,6 +15,7 @@ const itemsTypeLint: LinterMeta = { marker: 'value', target: 'items', data: {}, + targetSpecs: [...AsyncAPI2, ...OpenAPI2, ...OpenAPI3], }; export default itemsTypeLint; diff --git a/packages/apidom-ls/src/config/common/schema/lint/max-items--non-array.ts b/packages/apidom-ls/src/config/common/schema/lint/max-items--non-array.ts index 2abda99c33..a7e3aedfa8 100644 --- a/packages/apidom-ls/src/config/common/schema/lint/max-items--non-array.ts +++ b/packages/apidom-ls/src/config/common/schema/lint/max-items--non-array.ts @@ -2,6 +2,8 @@ import { DiagnosticSeverity } from 'vscode-languageserver-types'; import ApilintCodes from '../../../codes'; import { LinterMeta } from '../../../../apidom-language-types'; +import { AsyncAPI2 } from '../../../asyncapi/target-specs'; +import { OpenAPI2, OpenAPI3 } from '../../../openapi/target-specs'; const maxItemsNonArrayLint: LinterMeta = { code: ApilintCodes.SCHEMA_MAXITEMS_NONARRAY, @@ -30,6 +32,7 @@ const maxItemsNonArrayLint: LinterMeta = { }, ], }, + targetSpecs: [...AsyncAPI2, ...OpenAPI2, ...OpenAPI3], }; export default maxItemsNonArrayLint; diff --git a/packages/apidom-ls/src/config/common/schema/lint/max-items--type.ts b/packages/apidom-ls/src/config/common/schema/lint/max-items--type.ts index dcbf4b46c6..7b57755989 100644 --- a/packages/apidom-ls/src/config/common/schema/lint/max-items--type.ts +++ b/packages/apidom-ls/src/config/common/schema/lint/max-items--type.ts @@ -2,6 +2,8 @@ import { DiagnosticSeverity } from 'vscode-languageserver-types'; import ApilintCodes from '../../../codes'; import { LinterMeta } from '../../../../apidom-language-types'; +import { AsyncAPI2 } from '../../../asyncapi/target-specs'; +import { OpenAPI2, OpenAPI3 } from '../../../openapi/target-specs'; const maxItemsTypeLint: LinterMeta = { code: ApilintCodes.SCHEMA_MAXITEMS, @@ -13,6 +15,7 @@ const maxItemsTypeLint: LinterMeta = { marker: 'value', target: 'maxItems', data: {}, + targetSpecs: [...AsyncAPI2, ...OpenAPI2, ...OpenAPI3], }; export default maxItemsTypeLint; diff --git a/packages/apidom-ls/src/config/common/schema/lint/max-length--non-string.ts b/packages/apidom-ls/src/config/common/schema/lint/max-length--non-string.ts index e0af520ec7..5d90095d7d 100644 --- a/packages/apidom-ls/src/config/common/schema/lint/max-length--non-string.ts +++ b/packages/apidom-ls/src/config/common/schema/lint/max-length--non-string.ts @@ -2,6 +2,8 @@ import { DiagnosticSeverity } from 'vscode-languageserver-types'; import ApilintCodes from '../../../codes'; import { LinterMeta } from '../../../../apidom-language-types'; +import { AsyncAPI2 } from '../../../asyncapi/target-specs'; +import { OpenAPI2, OpenAPI3 } from '../../../openapi/target-specs'; const maxLengthNonStringLint: LinterMeta = { code: ApilintCodes.SCHEMA_MAXLENGTH_NONSTRING, @@ -30,6 +32,7 @@ const maxLengthNonStringLint: LinterMeta = { }, ], }, + targetSpecs: [...AsyncAPI2, ...OpenAPI2, ...OpenAPI3], }; export default maxLengthNonStringLint; diff --git a/packages/apidom-ls/src/config/common/schema/lint/max-length--type.ts b/packages/apidom-ls/src/config/common/schema/lint/max-length--type.ts index 60d6eb5612..8f2ff28f25 100644 --- a/packages/apidom-ls/src/config/common/schema/lint/max-length--type.ts +++ b/packages/apidom-ls/src/config/common/schema/lint/max-length--type.ts @@ -2,6 +2,8 @@ import { DiagnosticSeverity } from 'vscode-languageserver-types'; import ApilintCodes from '../../../codes'; import { LinterMeta } from '../../../../apidom-language-types'; +import { AsyncAPI2 } from '../../../asyncapi/target-specs'; +import { OpenAPI2, OpenAPI3 } from '../../../openapi/target-specs'; const maxLengthTypeLint: LinterMeta = { code: ApilintCodes.SCHEMA_MAXLENGTH, @@ -13,6 +15,7 @@ const maxLengthTypeLint: LinterMeta = { marker: 'value', target: 'maxLength', data: {}, + targetSpecs: [...AsyncAPI2, ...OpenAPI2, ...OpenAPI3], }; export default maxLengthTypeLint; diff --git a/packages/apidom-ls/src/config/common/schema/lint/max-properties--non-object.ts b/packages/apidom-ls/src/config/common/schema/lint/max-properties--non-object.ts index 63d38d22e5..12d251f7d4 100644 --- a/packages/apidom-ls/src/config/common/schema/lint/max-properties--non-object.ts +++ b/packages/apidom-ls/src/config/common/schema/lint/max-properties--non-object.ts @@ -2,6 +2,8 @@ import { DiagnosticSeverity } from 'vscode-languageserver-types'; import ApilintCodes from '../../../codes'; import { LinterMeta } from '../../../../apidom-language-types'; +import { AsyncAPI2 } from '../../../asyncapi/target-specs'; +import { OpenAPI2, OpenAPI3 } from '../../../openapi/target-specs'; const maxPropertiesNonObjectLint: LinterMeta = { code: ApilintCodes.SCHEMA_MAXPROPERTIES_NONOBJECT, @@ -30,6 +32,7 @@ const maxPropertiesNonObjectLint: LinterMeta = { }, ], }, + targetSpecs: [...AsyncAPI2, ...OpenAPI2, ...OpenAPI3], }; export default maxPropertiesNonObjectLint; diff --git a/packages/apidom-ls/src/config/common/schema/lint/max-properties--type.ts b/packages/apidom-ls/src/config/common/schema/lint/max-properties--type.ts index 48dfe303af..c794baf239 100644 --- a/packages/apidom-ls/src/config/common/schema/lint/max-properties--type.ts +++ b/packages/apidom-ls/src/config/common/schema/lint/max-properties--type.ts @@ -2,6 +2,8 @@ import { DiagnosticSeverity } from 'vscode-languageserver-types'; import ApilintCodes from '../../../codes'; import { LinterMeta } from '../../../../apidom-language-types'; +import { AsyncAPI2 } from '../../../asyncapi/target-specs'; +import { OpenAPI2, OpenAPI3 } from '../../../openapi/target-specs'; const maxPropertiesTypeLint: LinterMeta = { code: ApilintCodes.SCHEMA_MAXPROPERTIES, @@ -13,6 +15,7 @@ const maxPropertiesTypeLint: LinterMeta = { marker: 'value', target: 'maxProperties', data: {}, + targetSpecs: [...AsyncAPI2, ...OpenAPI2, ...OpenAPI3], }; export default maxPropertiesTypeLint; diff --git a/packages/apidom-ls/src/config/common/schema/lint/maximum--pattern.ts b/packages/apidom-ls/src/config/common/schema/lint/maximum--pattern.ts index e08b8aaef0..efff645e5e 100644 --- a/packages/apidom-ls/src/config/common/schema/lint/maximum--pattern.ts +++ b/packages/apidom-ls/src/config/common/schema/lint/maximum--pattern.ts @@ -2,6 +2,8 @@ import { DiagnosticSeverity } from 'vscode-languageserver-types'; import ApilintCodes from '../../../codes'; import { LinterMeta } from '../../../../apidom-language-types'; +import { AsyncAPI2 } from '../../../asyncapi/target-specs'; +import { OpenAPI2, OpenAPI3 } from '../../../openapi/target-specs'; const maximumPatternLint: LinterMeta = { code: ApilintCodes.SCHEMA_MAXIMUM, @@ -13,6 +15,7 @@ const maximumPatternLint: LinterMeta = { marker: 'value', target: 'maximum', data: {}, + targetSpecs: [...AsyncAPI2, ...OpenAPI2, ...OpenAPI3], }; export default maximumPatternLint; diff --git a/packages/apidom-ls/src/config/common/schema/lint/min-items--non-array.ts b/packages/apidom-ls/src/config/common/schema/lint/min-items--non-array.ts index 8ca4618bf7..20dd491a3f 100644 --- a/packages/apidom-ls/src/config/common/schema/lint/min-items--non-array.ts +++ b/packages/apidom-ls/src/config/common/schema/lint/min-items--non-array.ts @@ -2,6 +2,8 @@ import { DiagnosticSeverity } from 'vscode-languageserver-types'; import ApilintCodes from '../../../codes'; import { LinterMeta } from '../../../../apidom-language-types'; +import { AsyncAPI2 } from '../../../asyncapi/target-specs'; +import { OpenAPI2, OpenAPI3 } from '../../../openapi/target-specs'; const minItemsNonArrayLint: LinterMeta = { code: ApilintCodes.SCHEMA_MINITEMS_NONARRAY, @@ -30,6 +32,7 @@ const minItemsNonArrayLint: LinterMeta = { }, ], }, + targetSpecs: [...AsyncAPI2, ...OpenAPI2, ...OpenAPI3], }; export default minItemsNonArrayLint; diff --git a/packages/apidom-ls/src/config/common/schema/lint/min-items--type.ts b/packages/apidom-ls/src/config/common/schema/lint/min-items--type.ts index b9b9abd262..1c9d482c0e 100644 --- a/packages/apidom-ls/src/config/common/schema/lint/min-items--type.ts +++ b/packages/apidom-ls/src/config/common/schema/lint/min-items--type.ts @@ -2,6 +2,8 @@ import { DiagnosticSeverity } from 'vscode-languageserver-types'; import ApilintCodes from '../../../codes'; import { LinterMeta } from '../../../../apidom-language-types'; +import { AsyncAPI2 } from '../../../asyncapi/target-specs'; +import { OpenAPI2, OpenAPI3 } from '../../../openapi/target-specs'; const minItemsTypeLint: LinterMeta = { code: ApilintCodes.SCHEMA_MINITEMS, @@ -13,6 +15,7 @@ const minItemsTypeLint: LinterMeta = { marker: 'value', target: 'minItems', data: {}, + targetSpecs: [...AsyncAPI2, ...OpenAPI2, ...OpenAPI3], }; export default minItemsTypeLint; diff --git a/packages/apidom-ls/src/config/common/schema/lint/min-length--non-string.ts b/packages/apidom-ls/src/config/common/schema/lint/min-length--non-string.ts index 6ac073addc..53fccd9060 100644 --- a/packages/apidom-ls/src/config/common/schema/lint/min-length--non-string.ts +++ b/packages/apidom-ls/src/config/common/schema/lint/min-length--non-string.ts @@ -2,6 +2,8 @@ import { DiagnosticSeverity } from 'vscode-languageserver-types'; import ApilintCodes from '../../../codes'; import { LinterMeta } from '../../../../apidom-language-types'; +import { AsyncAPI2 } from '../../../asyncapi/target-specs'; +import { OpenAPI2, OpenAPI3 } from '../../../openapi/target-specs'; const minLengthNonStringLint: LinterMeta = { code: ApilintCodes.SCHEMA_MINLENGTH_NONSTRING, @@ -30,6 +32,7 @@ const minLengthNonStringLint: LinterMeta = { }, ], }, + targetSpecs: [...AsyncAPI2, ...OpenAPI2, ...OpenAPI3], }; export default minLengthNonStringLint; diff --git a/packages/apidom-ls/src/config/common/schema/lint/min-length--type.ts b/packages/apidom-ls/src/config/common/schema/lint/min-length--type.ts index b37497ec07..39ac8c6ea2 100644 --- a/packages/apidom-ls/src/config/common/schema/lint/min-length--type.ts +++ b/packages/apidom-ls/src/config/common/schema/lint/min-length--type.ts @@ -2,6 +2,8 @@ import { DiagnosticSeverity } from 'vscode-languageserver-types'; import ApilintCodes from '../../../codes'; import { LinterMeta } from '../../../../apidom-language-types'; +import { AsyncAPI2 } from '../../../asyncapi/target-specs'; +import { OpenAPI2, OpenAPI3 } from '../../../openapi/target-specs'; const minLengthTypeLint: LinterMeta = { code: ApilintCodes.SCHEMA_MINLENGTH, @@ -13,6 +15,7 @@ const minLengthTypeLint: LinterMeta = { marker: 'value', target: 'minLength', data: {}, + targetSpecs: [...AsyncAPI2, ...OpenAPI2, ...OpenAPI3], }; export default minLengthTypeLint; diff --git a/packages/apidom-ls/src/config/common/schema/lint/min-properties--non-object.ts b/packages/apidom-ls/src/config/common/schema/lint/min-properties--non-object.ts index 0dd564d8c8..8b5e028c88 100644 --- a/packages/apidom-ls/src/config/common/schema/lint/min-properties--non-object.ts +++ b/packages/apidom-ls/src/config/common/schema/lint/min-properties--non-object.ts @@ -2,6 +2,8 @@ import { DiagnosticSeverity } from 'vscode-languageserver-types'; import ApilintCodes from '../../../codes'; import { LinterMeta } from '../../../../apidom-language-types'; +import { AsyncAPI2 } from '../../../asyncapi/target-specs'; +import { OpenAPI2, OpenAPI3 } from '../../../openapi/target-specs'; const minPropertiesNonObjectLint: LinterMeta = { code: ApilintCodes.SCHEMA_MINPROPERTIES_NONOBJECT, @@ -30,6 +32,7 @@ const minPropertiesNonObjectLint: LinterMeta = { }, ], }, + targetSpecs: [...AsyncAPI2, ...OpenAPI2, ...OpenAPI3], }; export default minPropertiesNonObjectLint; diff --git a/packages/apidom-ls/src/config/common/schema/lint/min-properties--type.ts b/packages/apidom-ls/src/config/common/schema/lint/min-properties--type.ts index 74d323e921..c7a4d7fa96 100644 --- a/packages/apidom-ls/src/config/common/schema/lint/min-properties--type.ts +++ b/packages/apidom-ls/src/config/common/schema/lint/min-properties--type.ts @@ -2,6 +2,8 @@ import { DiagnosticSeverity } from 'vscode-languageserver-types'; import ApilintCodes from '../../../codes'; import { LinterMeta } from '../../../../apidom-language-types'; +import { AsyncAPI2 } from '../../../asyncapi/target-specs'; +import { OpenAPI2, OpenAPI3 } from '../../../openapi/target-specs'; const minPropertiesTypeLint: LinterMeta = { code: ApilintCodes.SCHEMA_MINPROPERTIES, @@ -13,6 +15,7 @@ const minPropertiesTypeLint: LinterMeta = { marker: 'value', target: 'minProperties', data: {}, + targetSpecs: [...AsyncAPI2, ...OpenAPI2, ...OpenAPI3], }; export default minPropertiesTypeLint; diff --git a/packages/apidom-ls/src/config/common/schema/lint/minimum--pattern.ts b/packages/apidom-ls/src/config/common/schema/lint/minimum--pattern.ts index 307f4c5aca..0d95119363 100644 --- a/packages/apidom-ls/src/config/common/schema/lint/minimum--pattern.ts +++ b/packages/apidom-ls/src/config/common/schema/lint/minimum--pattern.ts @@ -2,6 +2,8 @@ import { DiagnosticSeverity } from 'vscode-languageserver-types'; import ApilintCodes from '../../../codes'; import { LinterMeta } from '../../../../apidom-language-types'; +import { AsyncAPI2 } from '../../../asyncapi/target-specs'; +import { OpenAPI2, OpenAPI3 } from '../../../openapi/target-specs'; const minimumPatternLint: LinterMeta = { code: ApilintCodes.SCHEMA_MINUMUM, @@ -13,6 +15,7 @@ const minimumPatternLint: LinterMeta = { marker: 'value', target: 'minimum', data: {}, + targetSpecs: [...AsyncAPI2, ...OpenAPI2, ...OpenAPI3], }; export default minimumPatternLint; diff --git a/packages/apidom-ls/src/config/common/schema/lint/missing-core-fields-asyncapi-2.ts b/packages/apidom-ls/src/config/common/schema/lint/missing-core-fields-asyncapi-2.ts index 2652cbfc9f..abad1be8ea 100644 --- a/packages/apidom-ls/src/config/common/schema/lint/missing-core-fields-asyncapi-2.ts +++ b/packages/apidom-ls/src/config/common/schema/lint/missing-core-fields-asyncapi-2.ts @@ -65,13 +65,13 @@ const missingCoreFieldsAsyncAPI2Lint: LinterMeta = { true, ], marker: 'key', - targetSpecs: [...AsyncAPI2], conditions: [ { function: 'apilintElementOrClass', params: [['schema']], }, ], + targetSpecs: AsyncAPI2, }; export default missingCoreFieldsAsyncAPI2Lint; diff --git a/packages/apidom-ls/src/config/common/schema/lint/missing-core-fields-openapi-2-0.ts b/packages/apidom-ls/src/config/common/schema/lint/missing-core-fields-openapi-2-0.ts index 2cc9b25c2b..ecea1bc1ca 100644 --- a/packages/apidom-ls/src/config/common/schema/lint/missing-core-fields-openapi-2-0.ts +++ b/packages/apidom-ls/src/config/common/schema/lint/missing-core-fields-openapi-2-0.ts @@ -47,13 +47,13 @@ const missingCoreFieldsOpenAPI2Lint: LinterMeta = { true, ], marker: 'key', - targetSpecs: [...OpenAPI2], conditions: [ { function: 'apilintElementOrClass', params: [['schema']], }, ], + targetSpecs: OpenAPI2, }; export default missingCoreFieldsOpenAPI2Lint; diff --git a/packages/apidom-ls/src/config/common/schema/lint/missing-core-fields-openapi-3-0.ts b/packages/apidom-ls/src/config/common/schema/lint/missing-core-fields-openapi-3-0.ts index 04b1666f98..c3a7259a37 100644 --- a/packages/apidom-ls/src/config/common/schema/lint/missing-core-fields-openapi-3-0.ts +++ b/packages/apidom-ls/src/config/common/schema/lint/missing-core-fields-openapi-3-0.ts @@ -54,13 +54,13 @@ const missingCoreFieldsOpenAPI3_0Lint: LinterMeta = { true, ], marker: 'key', - targetSpecs: OpenAPI30, conditions: [ { function: 'apilintElementOrClass', params: [['schema']], }, ], + targetSpecs: OpenAPI30, }; export default missingCoreFieldsOpenAPI3_0Lint; diff --git a/packages/apidom-ls/src/config/common/schema/lint/missing-core-fields-openapi-3-1.ts b/packages/apidom-ls/src/config/common/schema/lint/missing-core-fields-openapi-3-1.ts index d25d805f21..4c33556c37 100644 --- a/packages/apidom-ls/src/config/common/schema/lint/missing-core-fields-openapi-3-1.ts +++ b/packages/apidom-ls/src/config/common/schema/lint/missing-core-fields-openapi-3-1.ts @@ -80,13 +80,13 @@ const missingCoreFieldsOpenAPI3_1Lint: LinterMeta = { true, ], marker: 'key', - targetSpecs: OpenAPI31, conditions: [ { function: 'apilintElementOrClass', params: [['schema']], }, ], + targetSpecs: OpenAPI31, }; export default missingCoreFieldsOpenAPI3_1Lint; diff --git a/packages/apidom-ls/src/config/common/schema/lint/multiple-of--type.ts b/packages/apidom-ls/src/config/common/schema/lint/multiple-of--type.ts index 2a5129aa7b..299710d5ef 100644 --- a/packages/apidom-ls/src/config/common/schema/lint/multiple-of--type.ts +++ b/packages/apidom-ls/src/config/common/schema/lint/multiple-of--type.ts @@ -2,6 +2,8 @@ import { DiagnosticSeverity } from 'vscode-languageserver-types'; import ApilintCodes from '../../../codes'; import { LinterMeta } from '../../../../apidom-language-types'; +import { AsyncAPI2 } from '../../../asyncapi/target-specs'; +import { OpenAPI2, OpenAPI3 } from '../../../openapi/target-specs'; const multipleOfTypeLint: LinterMeta = { code: ApilintCodes.SCHEMA_MULTIPLEOF, @@ -13,6 +15,7 @@ const multipleOfTypeLint: LinterMeta = { marker: 'value', target: 'multipleOf', data: {}, + targetSpecs: [...AsyncAPI2, ...OpenAPI2, ...OpenAPI3], }; export default multipleOfTypeLint; diff --git a/packages/apidom-ls/src/config/common/schema/lint/nullable--not-recommended.ts b/packages/apidom-ls/src/config/common/schema/lint/nullable--not-recommended.ts index cfdb0834bc..ec97ffa993 100644 --- a/packages/apidom-ls/src/config/common/schema/lint/nullable--not-recommended.ts +++ b/packages/apidom-ls/src/config/common/schema/lint/nullable--not-recommended.ts @@ -2,6 +2,7 @@ import { DiagnosticSeverity } from 'vscode-languageserver-types'; import ApilintCodes from '../../../codes'; import { LinterMeta } from '../../../../apidom-language-types'; +import { OpenAPI31 } from '../../../openapi/target-specs'; const nullableNotRecommendedLint: LinterMeta = { code: ApilintCodes.SCHEMA_NULLABLE_NOT_RECOMMENDED, @@ -12,16 +13,6 @@ const nullableNotRecommendedLint: LinterMeta = { linterParams: ['nullable'], marker: 'key', markerTarget: 'nullable', - targetSpecs: [ - { namespace: 'asyncapi', version: '2.0.0' }, - { namespace: 'asyncapi', version: '2.1.0' }, - { namespace: 'asyncapi', version: '2.2.0' }, - { namespace: 'asyncapi', version: '2.3.0' }, - { namespace: 'asyncapi', version: '2.4.0' }, - { namespace: 'asyncapi', version: '2.5.0' }, - { namespace: 'asyncapi', version: '2.6.0' }, - { namespace: 'openapi', version: '3.1.0' }, - ], data: { quickFix: [ { @@ -32,6 +23,7 @@ const nullableNotRecommendedLint: LinterMeta = { }, ], }, + targetSpecs: OpenAPI31, }; export default nullableNotRecommendedLint; diff --git a/packages/apidom-ls/src/config/common/schema/lint/nullable--type.ts b/packages/apidom-ls/src/config/common/schema/lint/nullable--type.ts new file mode 100644 index 0000000000..500ccc72eb --- /dev/null +++ b/packages/apidom-ls/src/config/common/schema/lint/nullable--type.ts @@ -0,0 +1,20 @@ +import { DiagnosticSeverity } from 'vscode-languageserver-types'; + +import ApilintCodes from '../../../codes'; +import { LinterMeta } from '../../../../apidom-language-types'; +import { OpenAPI30 } from '../../../openapi/target-specs'; + +const nullableTypeLint: LinterMeta = { + code: ApilintCodes.SCHEMA_NULLABLE, + source: 'apilint', + message: 'nullable value must be a boolean', + severity: DiagnosticSeverity.Error, + linterFunction: 'apilintType', + linterParams: ['boolean'], + marker: 'value', + target: 'nullable', + data: {}, + targetSpecs: OpenAPI30, +}; + +export default nullableTypeLint; diff --git a/packages/apidom-ls/src/config/common/schema/lint/one-of--type-openapi-3-1-asyncapi-2.ts b/packages/apidom-ls/src/config/common/schema/lint/one-of--type-openapi-3-1--asyncapi-2.ts similarity index 87% rename from packages/apidom-ls/src/config/common/schema/lint/one-of--type-openapi-3-1-asyncapi-2.ts rename to packages/apidom-ls/src/config/common/schema/lint/one-of--type-openapi-3-1--asyncapi-2.ts index ce5a708304..e074aa1caf 100644 --- a/packages/apidom-ls/src/config/common/schema/lint/one-of--type-openapi-3-1-asyncapi-2.ts +++ b/packages/apidom-ls/src/config/common/schema/lint/one-of--type-openapi-3-1--asyncapi-2.ts @@ -6,7 +6,7 @@ import { AsyncAPI2 } from '../../../asyncapi/target-specs'; import { OpenAPI31 } from '../../../openapi/target-specs'; // eslint-disable-next-line @typescript-eslint/naming-convention -const oneOfTypeOpenAPI3_1_AsyncAPI2Lint: LinterMeta = { +const oneOfTypeOpenAPI3_1__AsyncAPI2Lint: LinterMeta = { code: ApilintCodes.SCHEMA_ONEOF, source: 'apilint', message: 'oneOf must be a non-empty array of schema objects or boolean JSON schemas', @@ -19,4 +19,4 @@ const oneOfTypeOpenAPI3_1_AsyncAPI2Lint: LinterMeta = { targetSpecs: [...OpenAPI31, ...AsyncAPI2], }; -export default oneOfTypeOpenAPI3_1_AsyncAPI2Lint; +export default oneOfTypeOpenAPI3_1__AsyncAPI2Lint; diff --git a/packages/apidom-ls/src/config/common/schema/lint/one-of--type.ts b/packages/apidom-ls/src/config/common/schema/lint/one-of--type.ts index eddacef046..e83b837999 100644 --- a/packages/apidom-ls/src/config/common/schema/lint/one-of--type.ts +++ b/packages/apidom-ls/src/config/common/schema/lint/one-of--type.ts @@ -2,7 +2,7 @@ import { DiagnosticSeverity } from 'vscode-languageserver-types'; import ApilintCodes from '../../../codes'; import { LinterMeta } from '../../../../apidom-language-types'; -import { OpenAPI2, OpenAPI30 } from '../../../openapi/target-specs'; +import { OpenAPI30 } from '../../../openapi/target-specs'; const oneOfTypeLint: LinterMeta = { code: ApilintCodes.SCHEMA_ONEOF, @@ -14,7 +14,7 @@ const oneOfTypeLint: LinterMeta = { marker: 'key', target: 'oneOf', data: {}, - targetSpecs: [...OpenAPI2, ...OpenAPI30], + targetSpecs: OpenAPI30, }; export default oneOfTypeLint; diff --git a/packages/apidom-ls/src/config/common/schema/lint/pattern--type.ts b/packages/apidom-ls/src/config/common/schema/lint/pattern--type.ts index 1d459d9d45..3d96904bf1 100644 --- a/packages/apidom-ls/src/config/common/schema/lint/pattern--type.ts +++ b/packages/apidom-ls/src/config/common/schema/lint/pattern--type.ts @@ -2,6 +2,8 @@ import { DiagnosticSeverity } from 'vscode-languageserver-types'; import ApilintCodes from '../../../codes'; import { LinterMeta } from '../../../../apidom-language-types'; +import { AsyncAPI2 } from '../../../asyncapi/target-specs'; +import { OpenAPI2, OpenAPI3 } from '../../../openapi/target-specs'; const patternTypeLint: LinterMeta = { code: ApilintCodes.SCHEMA_PATTERN, @@ -13,6 +15,7 @@ const patternTypeLint: LinterMeta = { marker: 'value', target: 'pattern', data: {}, + targetSpecs: [...AsyncAPI2, ...OpenAPI2, ...OpenAPI3], }; export default patternTypeLint; diff --git a/packages/apidom-ls/src/config/common/schema/lint/pattern-properties--keys-regexp.ts b/packages/apidom-ls/src/config/common/schema/lint/pattern-properties--keys-regexp.ts index 07519ad764..b64a0ef77b 100644 --- a/packages/apidom-ls/src/config/common/schema/lint/pattern-properties--keys-regexp.ts +++ b/packages/apidom-ls/src/config/common/schema/lint/pattern-properties--keys-regexp.ts @@ -2,6 +2,8 @@ import { DiagnosticSeverity } from 'vscode-languageserver-types'; import ApilintCodes from '../../../codes'; import { LinterMeta } from '../../../../apidom-language-types'; +import { AsyncAPI2 } from '../../../asyncapi/target-specs'; +import { OpenAPI31 } from '../../../openapi/target-specs'; const patternPropertiesKeysRegexpLint: LinterMeta = { code: ApilintCodes.SCHEMA_PATTERNPROPERTIES_KEY, @@ -13,6 +15,7 @@ const patternPropertiesKeysRegexpLint: LinterMeta = { target: 'patternProperties', markerTarget: 'patternProperties', data: {}, + targetSpecs: [...AsyncAPI2, ...OpenAPI31], }; export default patternPropertiesKeysRegexpLint; diff --git a/packages/apidom-ls/src/config/common/schema/lint/pattern-properties--non-object.ts b/packages/apidom-ls/src/config/common/schema/lint/pattern-properties--non-object.ts index 55cc5b9f3f..a93c43f59c 100644 --- a/packages/apidom-ls/src/config/common/schema/lint/pattern-properties--non-object.ts +++ b/packages/apidom-ls/src/config/common/schema/lint/pattern-properties--non-object.ts @@ -2,6 +2,8 @@ import { DiagnosticSeverity } from 'vscode-languageserver-types'; import ApilintCodes from '../../../codes'; import { LinterMeta } from '../../../../apidom-language-types'; +import { AsyncAPI2 } from '../../../asyncapi/target-specs'; +import { OpenAPI31 } from '../../../openapi/target-specs'; const patternPropertiesNonObjectLint: LinterMeta = { code: ApilintCodes.SCHEMA_PATTERNPROPERTIES_NONOBJECT, @@ -30,6 +32,7 @@ const patternPropertiesNonObjectLint: LinterMeta = { }, ], }, + targetSpecs: [...AsyncAPI2, ...OpenAPI31], }; export default patternPropertiesNonObjectLint; diff --git a/packages/apidom-ls/src/config/common/schema/lint/pattern-properties--type.ts b/packages/apidom-ls/src/config/common/schema/lint/pattern-properties--type.ts index 1ef2620880..284e276211 100644 --- a/packages/apidom-ls/src/config/common/schema/lint/pattern-properties--type.ts +++ b/packages/apidom-ls/src/config/common/schema/lint/pattern-properties--type.ts @@ -2,6 +2,8 @@ import { DiagnosticSeverity } from 'vscode-languageserver-types'; import ApilintCodes from '../../../codes'; import { LinterMeta } from '../../../../apidom-language-types'; +import { AsyncAPI2 } from '../../../asyncapi/target-specs'; +import { OpenAPI31 } from '../../../openapi/target-specs'; const patternPropertiesTypeLint: LinterMeta = { code: ApilintCodes.SCHEMA_PATTERNPROPERTIES_OBJECT, @@ -13,6 +15,7 @@ const patternPropertiesTypeLint: LinterMeta = { marker: 'value', target: 'patternProperties', data: {}, + targetSpecs: [...AsyncAPI2, ...OpenAPI31], }; export default patternPropertiesTypeLint; diff --git a/packages/apidom-ls/src/config/common/schema/lint/pattern-properties--values-type.ts b/packages/apidom-ls/src/config/common/schema/lint/pattern-properties--values-type.ts index 65ae3c74a5..fe01c6b652 100644 --- a/packages/apidom-ls/src/config/common/schema/lint/pattern-properties--values-type.ts +++ b/packages/apidom-ls/src/config/common/schema/lint/pattern-properties--values-type.ts @@ -2,6 +2,8 @@ import { DiagnosticSeverity } from 'vscode-languageserver-types'; import ApilintCodes from '../../../codes'; import { LinterMeta } from '../../../../apidom-language-types'; +import { AsyncAPI2 } from '../../../asyncapi/target-specs'; +import { OpenAPI31 } from '../../../openapi/target-specs'; const patternPropertiesValuesTypeLint: LinterMeta = { code: ApilintCodes.SCHEMA_PATTERNPROPERTIES, @@ -14,6 +16,7 @@ const patternPropertiesValuesTypeLint: LinterMeta = { markerTarget: 'patternProperties', target: 'patternProperties', data: {}, + targetSpecs: [...AsyncAPI2, ...OpenAPI31], }; export default patternPropertiesValuesTypeLint; diff --git a/packages/apidom-ls/src/config/common/schema/lint/properties--non-object.ts b/packages/apidom-ls/src/config/common/schema/lint/properties--non-object.ts index 8a55c62a87..5d197ff699 100644 --- a/packages/apidom-ls/src/config/common/schema/lint/properties--non-object.ts +++ b/packages/apidom-ls/src/config/common/schema/lint/properties--non-object.ts @@ -2,6 +2,8 @@ import { DiagnosticSeverity } from 'vscode-languageserver-types'; import ApilintCodes from '../../../codes'; import { LinterMeta } from '../../../../apidom-language-types'; +import { AsyncAPI2 } from '../../../asyncapi/target-specs'; +import { OpenAPI2, OpenAPI3 } from '../../../openapi/target-specs'; const propertiesNonObjectLint: LinterMeta = { code: ApilintCodes.SCHEMA_PROPERTIES_NONOBJECT, @@ -30,6 +32,7 @@ const propertiesNonObjectLint: LinterMeta = { }, ], }, + targetSpecs: [...AsyncAPI2, ...OpenAPI2, ...OpenAPI3], }; export default propertiesNonObjectLint; diff --git a/packages/apidom-ls/src/config/common/schema/lint/properties--type.ts b/packages/apidom-ls/src/config/common/schema/lint/properties--type.ts index f756aa8523..716be140f1 100644 --- a/packages/apidom-ls/src/config/common/schema/lint/properties--type.ts +++ b/packages/apidom-ls/src/config/common/schema/lint/properties--type.ts @@ -2,6 +2,8 @@ import { DiagnosticSeverity } from 'vscode-languageserver-types'; import ApilintCodes from '../../../codes'; import { LinterMeta } from '../../../../apidom-language-types'; +import { AsyncAPI2 } from '../../../asyncapi/target-specs'; +import { OpenAPI2, OpenAPI3 } from '../../../openapi/target-specs'; const propertiesTypeLint: LinterMeta = { code: ApilintCodes.SCHEMA_PROPERTIES_OBJECT, @@ -13,6 +15,7 @@ const propertiesTypeLint: LinterMeta = { marker: 'value', target: 'properties', data: {}, + targetSpecs: [...AsyncAPI2, ...OpenAPI2, ...OpenAPI3], }; export default propertiesTypeLint; diff --git a/packages/apidom-ls/src/config/common/schema/lint/properties--values-type-openapi-3-1-asyncapi-2.ts b/packages/apidom-ls/src/config/common/schema/lint/properties--values-type-openapi-3-1--asyncapi-2.ts similarity index 84% rename from packages/apidom-ls/src/config/common/schema/lint/properties--values-type-openapi-3-1-asyncapi-2.ts rename to packages/apidom-ls/src/config/common/schema/lint/properties--values-type-openapi-3-1--asyncapi-2.ts index ba0e0021f7..7ed7aff117 100644 --- a/packages/apidom-ls/src/config/common/schema/lint/properties--values-type-openapi-3-1-asyncapi-2.ts +++ b/packages/apidom-ls/src/config/common/schema/lint/properties--values-type-openapi-3-1--asyncapi-2.ts @@ -6,7 +6,7 @@ import { AsyncAPI2 } from '../../../asyncapi/target-specs'; import { OpenAPI31 } from '../../../openapi/target-specs'; // eslint-disable-next-line @typescript-eslint/naming-convention -const propertiesValuesTypeOpenAPI3_1_AsyncAPI2Lint: LinterMeta = { +const propertiesValuesTypeOpenAPI3_1__AsyncAPI2Lint: LinterMeta = { code: ApilintCodes.SCHEMA_PROPERTIES, source: 'apilint', message: 'properties members must be schemas', @@ -20,4 +20,4 @@ const propertiesValuesTypeOpenAPI3_1_AsyncAPI2Lint: LinterMeta = { targetSpecs: [...OpenAPI31, ...AsyncAPI2], }; -export default propertiesValuesTypeOpenAPI3_1_AsyncAPI2Lint; +export default propertiesValuesTypeOpenAPI3_1__AsyncAPI2Lint; diff --git a/packages/apidom-ls/src/config/common/schema/lint/property-names--non-object.ts b/packages/apidom-ls/src/config/common/schema/lint/property-names--non-object.ts index bd574c9198..fb38603962 100644 --- a/packages/apidom-ls/src/config/common/schema/lint/property-names--non-object.ts +++ b/packages/apidom-ls/src/config/common/schema/lint/property-names--non-object.ts @@ -2,6 +2,8 @@ import { DiagnosticSeverity } from 'vscode-languageserver-types'; import ApilintCodes from '../../../codes'; import { LinterMeta } from '../../../../apidom-language-types'; +import { AsyncAPI2 } from '../../../asyncapi/target-specs'; +import { OpenAPI31 } from '../../../openapi/target-specs'; const propertyNamesNonObjectLint: LinterMeta = { code: ApilintCodes.SCHEMA_PROPERTYNAMES_NONOBJECT, @@ -30,6 +32,7 @@ const propertyNamesNonObjectLint: LinterMeta = { }, ], }, + targetSpecs: [...AsyncAPI2, ...OpenAPI31], }; export default propertyNamesNonObjectLint; diff --git a/packages/apidom-ls/src/config/common/schema/lint/property-names--type-openapi-3-1-asyncapi-2.ts b/packages/apidom-ls/src/config/common/schema/lint/property-names--type-openapi-3-1-asyncapi-2.ts deleted file mode 100644 index 53265fdd2a..0000000000 --- a/packages/apidom-ls/src/config/common/schema/lint/property-names--type-openapi-3-1-asyncapi-2.ts +++ /dev/null @@ -1,22 +0,0 @@ -import { DiagnosticSeverity } from 'vscode-languageserver-types'; - -import ApilintCodes from '../../../codes'; -import { LinterMeta } from '../../../../apidom-language-types'; -import { AsyncAPI2 } from '../../../asyncapi/target-specs'; -import { OpenAPI31 } from '../../../openapi/target-specs'; - -// eslint-disable-next-line @typescript-eslint/naming-convention -const propertyNamesTypeOpenAPI3_1_AsyncAPI2Lint: LinterMeta = { - code: ApilintCodes.SCHEMA_PROPERTYNAMES, - source: 'apilint', - message: 'propertyNames must be a schema', - severity: DiagnosticSeverity.Error, - linterFunction: 'apilintElementOrClass', - linterParams: ['schema', 'boolean'], - marker: 'value', - target: 'propertyNames', - data: {}, - targetSpecs: [...OpenAPI31, ...AsyncAPI2], -}; - -export default propertyNamesTypeOpenAPI3_1_AsyncAPI2Lint; diff --git a/packages/apidom-ls/src/config/common/schema/lint/property-names--type.ts b/packages/apidom-ls/src/config/common/schema/lint/property-names--type.ts index 134add7b1b..809bcd9a84 100644 --- a/packages/apidom-ls/src/config/common/schema/lint/property-names--type.ts +++ b/packages/apidom-ls/src/config/common/schema/lint/property-names--type.ts @@ -2,19 +2,20 @@ import { DiagnosticSeverity } from 'vscode-languageserver-types'; import ApilintCodes from '../../../codes'; import { LinterMeta } from '../../../../apidom-language-types'; -import { OpenAPI2, OpenAPI30 } from '../../../openapi/target-specs'; +import { OpenAPI31 } from '../../../openapi/target-specs'; +import { AsyncAPI2 } from '../../../asyncapi/target-specs'; const propertyNamesTypeLint: LinterMeta = { code: ApilintCodes.SCHEMA_PROPERTYNAMES, source: 'apilint', - message: 'propertyNames must be a schema', + message: 'propertyNames must be a schema object or a boolean JSON schema', severity: DiagnosticSeverity.Error, linterFunction: 'apilintElementOrClass', - linterParams: ['schema'], + linterParams: ['schema', 'boolean'], marker: 'value', target: 'propertyNames', data: {}, - targetSpecs: [...OpenAPI2, ...OpenAPI30], + targetSpecs: [...OpenAPI31, ...AsyncAPI2], }; export default propertyNamesTypeLint; diff --git a/packages/apidom-ls/src/config/common/schema/lint/read-only--type.ts b/packages/apidom-ls/src/config/common/schema/lint/read-only--type.ts index da66412d65..f8e76e337f 100644 --- a/packages/apidom-ls/src/config/common/schema/lint/read-only--type.ts +++ b/packages/apidom-ls/src/config/common/schema/lint/read-only--type.ts @@ -2,6 +2,8 @@ import { DiagnosticSeverity } from 'vscode-languageserver-types'; import ApilintCodes from '../../../codes'; import { LinterMeta } from '../../../../apidom-language-types'; +import { AsyncAPI2 } from '../../../asyncapi/target-specs'; +import { OpenAPI2, OpenAPI3 } from '../../../openapi/target-specs'; const readOnlyTypeLint: LinterMeta = { code: ApilintCodes.SCHEMA_READONLY, @@ -13,6 +15,7 @@ const readOnlyTypeLint: LinterMeta = { marker: 'value', target: 'readOnly', data: {}, + targetSpecs: [...AsyncAPI2, ...OpenAPI2, ...OpenAPI3], }; export default readOnlyTypeLint; diff --git a/packages/apidom-ls/src/config/common/schema/lint/required--defined.ts b/packages/apidom-ls/src/config/common/schema/lint/required--defined.ts index ea1ff4e97b..5226483fb3 100644 --- a/packages/apidom-ls/src/config/common/schema/lint/required--defined.ts +++ b/packages/apidom-ls/src/config/common/schema/lint/required--defined.ts @@ -2,6 +2,8 @@ import { DiagnosticSeverity } from 'vscode-languageserver-types'; import ApilintCodes from '../../../codes'; import { LinterMeta } from '../../../../apidom-language-types'; +import { AsyncAPI2 } from '../../../asyncapi/target-specs'; +import { OpenAPI2, OpenAPI3 } from '../../../openapi/target-specs'; const requiredDefinedLint: LinterMeta = { code: ApilintCodes.SCHEMA_REQUIRED_WITHOUT_PROPERTIES, @@ -21,6 +23,7 @@ const requiredDefinedLint: LinterMeta = { }, ], data: {}, + targetSpecs: [...AsyncAPI2, ...OpenAPI2, ...OpenAPI3], }; export default requiredDefinedLint; diff --git a/packages/apidom-ls/src/config/common/schema/lint/required--non-object.ts b/packages/apidom-ls/src/config/common/schema/lint/required--non-object.ts index 1754964a6f..dc6c1ed4fd 100644 --- a/packages/apidom-ls/src/config/common/schema/lint/required--non-object.ts +++ b/packages/apidom-ls/src/config/common/schema/lint/required--non-object.ts @@ -2,6 +2,8 @@ import { DiagnosticSeverity } from 'vscode-languageserver-types'; import ApilintCodes from '../../../codes'; import { LinterMeta } from '../../../../apidom-language-types'; +import { AsyncAPI2 } from '../../../asyncapi/target-specs'; +import { OpenAPI2, OpenAPI3 } from '../../../openapi/target-specs'; const requiredNonObjectLint: LinterMeta = { code: ApilintCodes.SCHEMA_REQUIRED_NONOBJECT, @@ -30,6 +32,7 @@ const requiredNonObjectLint: LinterMeta = { }, ], }, + targetSpecs: [...AsyncAPI2, ...OpenAPI2, ...OpenAPI3], }; export default requiredNonObjectLint; diff --git a/packages/apidom-ls/src/config/common/schema/lint/required--type.ts b/packages/apidom-ls/src/config/common/schema/lint/required--type.ts index 2e730e2be5..943cd2509e 100644 --- a/packages/apidom-ls/src/config/common/schema/lint/required--type.ts +++ b/packages/apidom-ls/src/config/common/schema/lint/required--type.ts @@ -2,6 +2,8 @@ import { DiagnosticSeverity } from 'vscode-languageserver-types'; import ApilintCodes from '../../../codes'; import { LinterMeta } from '../../../../apidom-language-types'; +import { AsyncAPI2 } from '../../../asyncapi/target-specs'; +import { OpenAPI2, OpenAPI3 } from '../../../openapi/target-specs'; const requiredTypeLint: LinterMeta = { code: ApilintCodes.SCHEMA_REQUIRED, @@ -13,6 +15,7 @@ const requiredTypeLint: LinterMeta = { marker: 'key', target: 'required', data: {}, + targetSpecs: [...AsyncAPI2, ...OpenAPI2, ...OpenAPI3], }; export default requiredTypeLint; diff --git a/packages/apidom-ls/src/config/common/schema/lint/then--non-if.ts b/packages/apidom-ls/src/config/common/schema/lint/then--non-if.ts index 90359df4c9..5a542abafe 100644 --- a/packages/apidom-ls/src/config/common/schema/lint/then--non-if.ts +++ b/packages/apidom-ls/src/config/common/schema/lint/then--non-if.ts @@ -2,6 +2,8 @@ import { DiagnosticSeverity } from 'vscode-languageserver-types'; import ApilintCodes from '../../../codes'; import { LinterMeta } from '../../../../apidom-language-types'; +import { AsyncAPI2 } from '../../../asyncapi/target-specs'; +import { OpenAPI31 } from '../../../openapi/target-specs'; const thenNonIfLint: LinterMeta = { code: ApilintCodes.SCHEMA_THEN_NONIF, @@ -28,6 +30,7 @@ const thenNonIfLint: LinterMeta = { }, ], }, + targetSpecs: [...AsyncAPI2, ...OpenAPI31], }; export default thenNonIfLint; diff --git a/packages/apidom-ls/src/config/common/schema/lint/then--type-openapi-3-1-asyncapi-2.ts b/packages/apidom-ls/src/config/common/schema/lint/then--type-openapi-3-1-asyncapi-2.ts deleted file mode 100644 index 57369d420d..0000000000 --- a/packages/apidom-ls/src/config/common/schema/lint/then--type-openapi-3-1-asyncapi-2.ts +++ /dev/null @@ -1,22 +0,0 @@ -import { DiagnosticSeverity } from 'vscode-languageserver-types'; - -import ApilintCodes from '../../../codes'; -import { LinterMeta } from '../../../../apidom-language-types'; -import { AsyncAPI2 } from '../../../asyncapi/target-specs'; -import { OpenAPI31 } from '../../../openapi/target-specs'; - -// eslint-disable-next-line @typescript-eslint/naming-convention -const thenTypeOpenAPI3_1_AsyncAPI2Lint: LinterMeta = { - code: ApilintCodes.SCHEMA_THEN, - source: 'apilint', - message: '"then" must be a schema', - severity: DiagnosticSeverity.Error, - linterFunction: 'apilintElementOrClass', - linterParams: ['schema', 'boolean'], - marker: 'value', - target: 'then', - data: {}, - targetSpecs: [...OpenAPI31, ...AsyncAPI2], -}; - -export default thenTypeOpenAPI3_1_AsyncAPI2Lint; diff --git a/packages/apidom-ls/src/config/common/schema/lint/then--type.ts b/packages/apidom-ls/src/config/common/schema/lint/then--type.ts index 8575f16702..fa7d1e3f5b 100644 --- a/packages/apidom-ls/src/config/common/schema/lint/then--type.ts +++ b/packages/apidom-ls/src/config/common/schema/lint/then--type.ts @@ -2,19 +2,20 @@ import { DiagnosticSeverity } from 'vscode-languageserver-types'; import ApilintCodes from '../../../codes'; import { LinterMeta } from '../../../../apidom-language-types'; -import { OpenAPI2, OpenAPI30 } from '../../../openapi/target-specs'; +import { OpenAPI31 } from '../../../openapi/target-specs'; +import { AsyncAPI2 } from '../../../asyncapi/target-specs'; const thenTypeLint: LinterMeta = { code: ApilintCodes.SCHEMA_THEN, source: 'apilint', - message: '"then" must be a schema', + message: '"then" must be a schema object or a boolean JSON schema', severity: DiagnosticSeverity.Error, linterFunction: 'apilintElementOrClass', - linterParams: ['schema'], + linterParams: ['schema', 'boolean'], marker: 'value', target: 'then', data: {}, - targetSpecs: [...OpenAPI2, ...OpenAPI30], + targetSpecs: [...OpenAPI31, ...AsyncAPI2], }; export default thenTypeLint; diff --git a/packages/apidom-ls/src/config/common/schema/lint/title--type.ts b/packages/apidom-ls/src/config/common/schema/lint/title--type.ts index a69c2cc031..22de46bb75 100644 --- a/packages/apidom-ls/src/config/common/schema/lint/title--type.ts +++ b/packages/apidom-ls/src/config/common/schema/lint/title--type.ts @@ -2,6 +2,8 @@ import { DiagnosticSeverity } from 'vscode-languageserver-types'; import ApilintCodes from '../../../codes'; import { LinterMeta } from '../../../../apidom-language-types'; +import { AsyncAPI2 } from '../../../asyncapi/target-specs'; +import { OpenAPI2, OpenAPI3 } from '../../../openapi/target-specs'; const titleTypeLint: LinterMeta = { code: ApilintCodes.SCHEMA_TITLE, @@ -13,6 +15,7 @@ const titleTypeLint: LinterMeta = { marker: 'value', target: 'title', data: {}, + targetSpecs: [...AsyncAPI2, ...OpenAPI2, ...OpenAPI3], }; export default titleTypeLint; diff --git a/packages/apidom-ls/src/config/common/schema/lint/type--equals-openapi-3-1--asyncapi-2.ts b/packages/apidom-ls/src/config/common/schema/lint/type--equals-openapi-3-1--asyncapi-2.ts new file mode 100644 index 0000000000..126921d423 --- /dev/null +++ b/packages/apidom-ls/src/config/common/schema/lint/type--equals-openapi-3-1--asyncapi-2.ts @@ -0,0 +1,60 @@ +import { DiagnosticSeverity } from 'vscode-languageserver-types'; + +import ApilintCodes from '../../../codes'; +import { LinterMeta } from '../../../../apidom-language-types'; +import { AsyncAPI2 } from '../../../asyncapi/target-specs'; +import { OpenAPI31 } from '../../../openapi/target-specs'; + +// eslint-disable-next-line @typescript-eslint/naming-convention +const typeEqualsOpenAPI3_1__AsyncAPI2Lint: LinterMeta = { + code: ApilintCodes.SCHEMA_TYPE, + source: 'apilint', + message: 'type must be one of allowed values', + severity: DiagnosticSeverity.Error, + linterFunction: 'apilintValueOrArray', + linterParams: [['null', 'boolean', 'object', 'array', 'number', 'string', 'integer'], true], + marker: 'value', + target: 'type', + data: { + quickFix: [ + { + message: "update to 'null'", + action: 'updateValue', + functionParams: ['null'], + }, + { + message: "update to 'boolean'", + action: 'updateValue', + functionParams: ['boolean'], + }, + { + message: "update to 'object'", + action: 'updateValue', + functionParams: ['object'], + }, + { + message: "update to 'array'", + action: 'updateValue', + functionParams: ['array'], + }, + { + message: "update to 'number'", + action: 'updateValue', + functionParams: ['null'], + }, + { + message: "update to 'string'", + action: 'updateValue', + functionParams: ['string'], + }, + { + message: "update to 'integer'", + action: 'updateValue', + functionParams: ['integer'], + }, + ], + }, + targetSpecs: [...AsyncAPI2, ...OpenAPI31], +}; + +export default typeEqualsOpenAPI3_1__AsyncAPI2Lint; diff --git a/packages/apidom-ls/src/config/common/schema/lint/type--type-openapi-3-0.ts b/packages/apidom-ls/src/config/common/schema/lint/type--equals.ts similarity index 77% rename from packages/apidom-ls/src/config/common/schema/lint/type--type-openapi-3-0.ts rename to packages/apidom-ls/src/config/common/schema/lint/type--equals.ts index 3acc7268b7..6d67cbe154 100644 --- a/packages/apidom-ls/src/config/common/schema/lint/type--type-openapi-3-0.ts +++ b/packages/apidom-ls/src/config/common/schema/lint/type--equals.ts @@ -2,9 +2,9 @@ import { DiagnosticSeverity } from 'vscode-languageserver-types'; import ApilintCodes from '../../../codes'; import { LinterMeta } from '../../../../apidom-language-types'; +import { OpenAPI2, OpenAPI30 } from '../../../openapi/target-specs'; -// eslint-disable-next-line @typescript-eslint/naming-convention -const typeTypeOpenAPI3_0Lint: LinterMeta = { +const typeEqualsLint: LinterMeta = { code: ApilintCodes.SCHEMA_TYPE, source: 'apilint', message: 'type must be one of allowed values', @@ -13,12 +13,6 @@ const typeTypeOpenAPI3_0Lint: LinterMeta = { linterParams: [['boolean', 'object', 'array', 'number', 'string', 'integer'], true], marker: 'value', target: 'type', - targetSpecs: [ - { namespace: 'openapi', version: '3.0.0' }, - { namespace: 'openapi', version: '3.0.1' }, - { namespace: 'openapi', version: '3.0.2' }, - { namespace: 'openapi', version: '3.0.3' }, - ], data: { quickFix: [ { @@ -53,6 +47,7 @@ const typeTypeOpenAPI3_0Lint: LinterMeta = { }, ], }, + targetSpecs: [...OpenAPI2, ...OpenAPI30], }; -export default typeTypeOpenAPI3_0Lint; +export default typeEqualsLint; diff --git a/packages/apidom-ls/src/config/common/schema/lint/type--type.ts b/packages/apidom-ls/src/config/common/schema/lint/type--type.ts index 52bfc47149..166bf1f0dc 100644 --- a/packages/apidom-ls/src/config/common/schema/lint/type--type.ts +++ b/packages/apidom-ls/src/config/common/schema/lint/type--type.ts @@ -2,65 +2,19 @@ import { DiagnosticSeverity } from 'vscode-languageserver-types'; import ApilintCodes from '../../../codes'; import { LinterMeta } from '../../../../apidom-language-types'; +import { OpenAPI2, OpenAPI30 } from '../../../openapi/target-specs'; const typeTypeLint: LinterMeta = { code: ApilintCodes.SCHEMA_TYPE, source: 'apilint', - message: 'type must be one of allowed values', + message: 'type must be a string', severity: DiagnosticSeverity.Error, - linterFunction: 'apilintValueOrArray', - linterParams: [['null', 'boolean', 'object', 'array', 'number', 'string', 'integer'], true], + linterFunction: 'apilintType', + linterParams: ['string'], marker: 'value', target: 'type', - targetSpecs: [ - { namespace: 'asyncapi', version: '2.0.0' }, - { namespace: 'asyncapi', version: '2.1.0' }, - { namespace: 'asyncapi', version: '2.2.0' }, - { namespace: 'asyncapi', version: '2.3.0' }, - { namespace: 'asyncapi', version: '2.4.0' }, - { namespace: 'asyncapi', version: '2.5.0' }, - { namespace: 'asyncapi', version: '2.6.0' }, - { namespace: 'openapi', version: '3.1.0' }, - ], - data: { - quickFix: [ - { - message: "update to 'null'", - action: 'updateValue', - functionParams: ['null'], - }, - { - message: "update to 'boolean'", - action: 'updateValue', - functionParams: ['boolean'], - }, - { - message: "update to 'object'", - action: 'updateValue', - functionParams: ['object'], - }, - { - message: "update to 'array'", - action: 'updateValue', - functionParams: ['array'], - }, - { - message: "update to 'number'", - action: 'updateValue', - functionParams: ['null'], - }, - { - message: "update to 'string'", - action: 'updateValue', - functionParams: ['string'], - }, - { - message: "update to 'integer'", - action: 'updateValue', - functionParams: ['integer'], - }, - ], - }, + data: {}, + targetSpecs: [...OpenAPI2, ...OpenAPI30], }; export default typeTypeLint; diff --git a/packages/apidom-ls/src/config/common/schema/lint/unique-items--non-array.ts b/packages/apidom-ls/src/config/common/schema/lint/unique-items--non-array.ts index e5b43e0f26..21501ffc24 100644 --- a/packages/apidom-ls/src/config/common/schema/lint/unique-items--non-array.ts +++ b/packages/apidom-ls/src/config/common/schema/lint/unique-items--non-array.ts @@ -2,6 +2,8 @@ import { DiagnosticSeverity } from 'vscode-languageserver-types'; import ApilintCodes from '../../../codes'; import { LinterMeta } from '../../../../apidom-language-types'; +import { AsyncAPI2 } from '../../../asyncapi/target-specs'; +import { OpenAPI2, OpenAPI3 } from '../../../openapi/target-specs'; const uniqueItemsNonArrayLint: LinterMeta = { code: ApilintCodes.SCHEMA_UNIQUEITEMS_NONARRAY, @@ -30,6 +32,7 @@ const uniqueItemsNonArrayLint: LinterMeta = { }, ], }, + targetSpecs: [...AsyncAPI2, ...OpenAPI2, ...OpenAPI3], }; export default uniqueItemsNonArrayLint; diff --git a/packages/apidom-ls/src/config/common/schema/lint/unique-items--type.ts b/packages/apidom-ls/src/config/common/schema/lint/unique-items--type.ts index 7c4f45b476..b6fa9e1df5 100644 --- a/packages/apidom-ls/src/config/common/schema/lint/unique-items--type.ts +++ b/packages/apidom-ls/src/config/common/schema/lint/unique-items--type.ts @@ -2,6 +2,8 @@ import { DiagnosticSeverity } from 'vscode-languageserver-types'; import ApilintCodes from '../../../codes'; import { LinterMeta } from '../../../../apidom-language-types'; +import { AsyncAPI2 } from '../../../asyncapi/target-specs'; +import { OpenAPI2, OpenAPI3 } from '../../../openapi/target-specs'; const uniqueItemsTypeLint: LinterMeta = { code: ApilintCodes.SCHEMA_UNIQUEITEMS, @@ -13,6 +15,7 @@ const uniqueItemsTypeLint: LinterMeta = { marker: 'value', target: 'uniqueItems', data: {}, + targetSpecs: [...AsyncAPI2, ...OpenAPI2, ...OpenAPI3], }; export default uniqueItemsTypeLint; diff --git a/packages/apidom-ls/src/config/common/schema/lint/write-only--type.ts b/packages/apidom-ls/src/config/common/schema/lint/write-only--type.ts index 754b979f09..20694b5d5b 100644 --- a/packages/apidom-ls/src/config/common/schema/lint/write-only--type.ts +++ b/packages/apidom-ls/src/config/common/schema/lint/write-only--type.ts @@ -2,6 +2,8 @@ import { DiagnosticSeverity } from 'vscode-languageserver-types'; import ApilintCodes from '../../../codes'; import { LinterMeta } from '../../../../apidom-language-types'; +import { AsyncAPI2 } from '../../../asyncapi/target-specs'; +import { OpenAPI3 } from '../../../openapi/target-specs'; const writeOnlyTypeLint: LinterMeta = { code: ApilintCodes.SCHEMA_WRITEONLY, @@ -13,6 +15,7 @@ const writeOnlyTypeLint: LinterMeta = { marker: 'value', target: 'writeOnly', data: {}, + targetSpecs: [...AsyncAPI2, ...OpenAPI3], }; export default writeOnlyTypeLint; diff --git a/packages/apidom-ls/test/validate.ts b/packages/apidom-ls/test/validate.ts index 0b6ea95876..58502e3573 100644 --- a/packages/apidom-ls/test/validate.ts +++ b/packages/apidom-ls/test/validate.ts @@ -268,7 +268,7 @@ describe('apidom-ls-validate', function () { character: 42, }, }, - message: "exclusiveMaximum' value must be a number", + message: 'exclusiveMaximum value must be a number', severity: 1, code: 10016, source: 'apilint', @@ -837,7 +837,7 @@ describe('apidom-ls-validate', function () { character: 42, }, }, - message: "exclusiveMaximum' value must be a number", + message: 'exclusiveMaximum value must be a number', severity: 1, code: 10016, source: 'apilint',