From f1703be18f6e1a933a54292651406cb54bc54754 Mon Sep 17 00:00:00 2001 From: ShikhaSaboo Date: Wed, 19 Nov 2025 12:15:46 +0530 Subject: [PATCH 1/2] fix(apidom-ls): validation message for schema in openapi3.0/3.1 --- .../common/schema/lint/type--equals-openapi-3-1--asyncapi-2.ts | 2 +- .../apidom-ls/src/config/common/schema/lint/type--equals.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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 index 7224e8c7a2..8e19512f26 100644 --- 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 @@ -9,7 +9,7 @@ import { OpenAPI31 } from '../../../openapi/target-specs.ts'; const typeEqualsOpenAPI3_1__AsyncAPI2Lint: LinterMeta = { code: ApilintCodes.SCHEMA_TYPE, source: 'apilint', - message: 'type must be one of allowed values', + message: 'should be equal to one of the allowed values allowedValues: boolean, object, array, number, string, integer null', severity: DiagnosticSeverity.Error, linterFunction: 'apilintValueOrArray', linterParams: [['null', 'boolean', 'object', 'array', 'number', 'string', 'integer'], true], diff --git a/packages/apidom-ls/src/config/common/schema/lint/type--equals.ts b/packages/apidom-ls/src/config/common/schema/lint/type--equals.ts index 77c8d00b33..905cd7f76a 100644 --- a/packages/apidom-ls/src/config/common/schema/lint/type--equals.ts +++ b/packages/apidom-ls/src/config/common/schema/lint/type--equals.ts @@ -7,7 +7,7 @@ import { OpenAPI2, OpenAPI30 } from '../../../openapi/target-specs.ts'; const typeEqualsLint: LinterMeta = { code: ApilintCodes.SCHEMA_TYPE, source: 'apilint', - message: 'type must be one of allowed values', + message: 'should be equal to one of the allowed values allowedValues: boolean, object, array, number, string, integer', severity: DiagnosticSeverity.Error, linterFunction: 'apilintValueOrArray', linterParams: [['boolean', 'object', 'array', 'number', 'string', 'integer']], From 06637a4e7dba06a1d382013b96c212a8f0bc6224 Mon Sep 17 00:00:00 2001 From: ShikhaSaboo Date: Thu, 20 Nov 2025 18:21:38 +0530 Subject: [PATCH 2/2] chore: fix lint and test issues --- .../type--equals-openapi-3-1--asyncapi-2.ts | 3 +- .../config/common/schema/lint/type--equals.ts | 3 +- .../sample-api-async-validation-2.0.0.json | 2 +- packages/apidom-ls/test/validate.ts | 42 ++++++++++++------- 4 files changed, 33 insertions(+), 17 deletions(-) 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 index 8e19512f26..8bcac39a3c 100644 --- 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 @@ -9,7 +9,8 @@ import { OpenAPI31 } from '../../../openapi/target-specs.ts'; const typeEqualsOpenAPI3_1__AsyncAPI2Lint: LinterMeta = { code: ApilintCodes.SCHEMA_TYPE, source: 'apilint', - message: 'should be equal to one of the allowed values allowedValues: boolean, object, array, number, string, integer null', + message: + 'should be equal to one of the allowed values allowedValues: boolean, object, array, number, string, integer null', severity: DiagnosticSeverity.Error, linterFunction: 'apilintValueOrArray', linterParams: [['null', 'boolean', 'object', 'array', 'number', 'string', 'integer'], true], diff --git a/packages/apidom-ls/src/config/common/schema/lint/type--equals.ts b/packages/apidom-ls/src/config/common/schema/lint/type--equals.ts index 905cd7f76a..1958e355b6 100644 --- a/packages/apidom-ls/src/config/common/schema/lint/type--equals.ts +++ b/packages/apidom-ls/src/config/common/schema/lint/type--equals.ts @@ -7,7 +7,8 @@ import { OpenAPI2, OpenAPI30 } from '../../../openapi/target-specs.ts'; const typeEqualsLint: LinterMeta = { code: ApilintCodes.SCHEMA_TYPE, source: 'apilint', - message: 'should be equal to one of the allowed values allowedValues: boolean, object, array, number, string, integer', + message: + 'should be equal to one of the allowed values allowedValues: boolean, object, array, number, string, integer', severity: DiagnosticSeverity.Error, linterFunction: 'apilintValueOrArray', linterParams: [['boolean', 'object', 'array', 'number', 'string', 'integer']], diff --git a/packages/apidom-ls/test/fixtures/expected/apidom-ls-async/sample-api-async-validation-2.0.0.json b/packages/apidom-ls/test/fixtures/expected/apidom-ls-async/sample-api-async-validation-2.0.0.json index 74f2407b71..a9b46e99e8 100644 --- a/packages/apidom-ls/test/fixtures/expected/apidom-ls-async/sample-api-async-validation-2.0.0.json +++ b/packages/apidom-ls/test/fixtures/expected/apidom-ls-async/sample-api-async-validation-2.0.0.json @@ -68,7 +68,7 @@ "character": 29 } }, - "message": "type must be one of allowed values", + "message": "should be equal to one of the allowed values allowedValues: boolean, object, array, number, string, integer null", "severity": 1, "code": 10001, "source": "apilint", diff --git a/packages/apidom-ls/test/validate.ts b/packages/apidom-ls/test/validate.ts index 19008cfe97..5e38e3b95d 100644 --- a/packages/apidom-ls/test/validate.ts +++ b/packages/apidom-ls/test/validate.ts @@ -288,7 +288,8 @@ describe('apidom-ls-validate', function () { character: 35, }, }, - message: 'type must be one of allowed values', + message: + 'should be equal to one of the allowed values allowedValues: boolean, object, array, number, string, integer null', severity: 1, code: 10001, source: 'apilint', @@ -407,7 +408,8 @@ describe('apidom-ls-validate', function () { character: 29, }, }, - message: 'type must be one of allowed values', + message: + 'should be equal to one of the allowed values allowedValues: boolean, object, array, number, string, integer null', severity: 1, code: 10001, source: 'apilint', @@ -525,7 +527,8 @@ describe('apidom-ls-validate', function () { character: 23, }, }, - message: 'type must be one of allowed values', + message: + 'should be equal to one of the allowed values allowedValues: boolean, object, array, number, string, integer null', severity: 1, code: 10001, source: 'apilint', @@ -857,7 +860,8 @@ describe('apidom-ls-validate', function () { character: 35, }, }, - message: 'type must be one of allowed values', + message: + 'should be equal to one of the allowed values allowedValues: boolean, object, array, number, string, integer null', severity: 1, code: 10001, source: 'apilint', @@ -1061,7 +1065,8 @@ describe('apidom-ls-validate', function () { character: 23, }, }, - message: 'type must be one of allowed values', + message: + 'should be equal to one of the allowed values allowedValues: boolean, object, array, number, string, integer null', severity: 1, code: 10001, source: 'apilint', @@ -1198,7 +1203,8 @@ describe('apidom-ls-validate', function () { character: 23, }, }, - message: 'type must be one of allowed values', + message: + 'should be equal to one of the allowed values allowedValues: boolean, object, array, number, string, integer null', severity: 1, code: 10001, source: 'apilint', @@ -1462,7 +1468,8 @@ describe('apidom-ls-validate', function () { character: 23, }, }, - message: 'type must be one of allowed values', + message: + 'should be equal to one of the allowed values allowedValues: boolean, object, array, number, string, integer null', severity: 1, code: 10001, source: 'apilint', @@ -1628,7 +1635,8 @@ describe('apidom-ls-validate', function () { character: 23, }, }, - message: 'type must be one of allowed values', + message: + 'should be equal to one of the allowed values allowedValues: boolean, object, array, number, string, integer null', severity: 1, code: 10001, source: 'apilint', @@ -1708,7 +1716,8 @@ describe('apidom-ls-validate', function () { character: 23, }, }, - message: 'type must be one of allowed values', + message: + 'should be equal to one of the allowed values allowedValues: boolean, object, array, number, string, integer null', severity: 1, code: 10001, source: 'apilint', @@ -1788,7 +1797,8 @@ describe('apidom-ls-validate', function () { character: 23, }, }, - message: 'type must be one of allowed values', + message: + 'should be equal to one of the allowed values allowedValues: boolean, object, array, number, string, integer null', severity: 1, code: 10001, source: 'apilint', @@ -1868,7 +1878,8 @@ describe('apidom-ls-validate', function () { character: 23, }, }, - message: 'type must be one of allowed values', + message: + 'should be equal to one of the allowed values allowedValues: boolean, object, array, number, string, integer null', severity: 1, code: 10001, source: 'apilint', @@ -1948,7 +1959,8 @@ describe('apidom-ls-validate', function () { character: 23, }, }, - message: 'type must be one of allowed values', + message: + 'should be equal to one of the allowed values allowedValues: boolean, object, array, number, string, integer null', severity: 1, code: 10001, source: 'apilint', @@ -2028,7 +2040,8 @@ describe('apidom-ls-validate', function () { character: 23, }, }, - message: 'type must be one of allowed values', + message: + 'should be equal to one of the allowed values allowedValues: boolean, object, array, number, string, integer null', severity: 1, code: 10001, source: 'apilint', @@ -2108,7 +2121,8 @@ describe('apidom-ls-validate', function () { character: 23, }, }, - message: 'type must be one of allowed values', + message: + 'should be equal to one of the allowed values allowedValues: boolean, object, array, number, string, integer null', severity: 1, code: 10001, source: 'apilint',