From f1703be18f6e1a933a54292651406cb54bc54754 Mon Sep 17 00:00:00 2001 From: ShikhaSaboo Date: Wed, 19 Nov 2025 12:15:46 +0530 Subject: [PATCH 1/6] 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/6] 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', From ff8f5a43e3125154a2a3fbc30672c85b0d29231c Mon Sep 17 00:00:00 2001 From: robert-hebel-sb Date: Mon, 24 Nov 2025 11:50:34 +0100 Subject: [PATCH 3/6] refactor: sort values alphabetically Co-authored-by: Oliwia Rogala --- .../apidom-ls/src/config/common/schema/lint/type--equals.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 1958e355b6..432b09ee2a 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 @@ -8,7 +8,7 @@ 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', + 'should be equal to one of the allowed values allowedValues: array, boolean, integer, number, object, string' severity: DiagnosticSeverity.Error, linterFunction: 'apilintValueOrArray', linterParams: [['boolean', 'object', 'array', 'number', 'string', 'integer']], From 6f2ace39f97b41e85b69359737d916af62b885c1 Mon Sep 17 00:00:00 2001 From: robert-hebel-sb Date: Mon, 24 Nov 2025 11:50:50 +0100 Subject: [PATCH 4/6] chore: add missing coma Co-authored-by: Oliwia Rogala --- .../common/schema/lint/type--equals-openapi-3-1--asyncapi-2.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 8bcac39a3c..81519316a9 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 @@ -10,7 +10,7 @@ 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', + '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], From fb32af7411897224246477fa5030d76c5ccd3b2c Mon Sep 17 00:00:00 2001 From: Robert Hebel Date: Mon, 24 Nov 2025 12:37:14 +0100 Subject: [PATCH 5/6] fix: typo --- .../apidom-ls/src/config/common/schema/lint/type--equals.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 432b09ee2a..860ca742bf 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 @@ -8,7 +8,7 @@ const typeEqualsLint: LinterMeta = { code: ApilintCodes.SCHEMA_TYPE, source: 'apilint', message: - 'should be equal to one of the allowed values allowedValues: array, boolean, integer, number, object, string' + 'should be equal to one of the allowed values allowedValues: array, boolean, integer, number, object, string', severity: DiagnosticSeverity.Error, linterFunction: 'apilintValueOrArray', linterParams: [['boolean', 'object', 'array', 'number', 'string', 'integer']], From 6c92d95421684adc9396a192be96f14e9beb1bdd Mon Sep 17 00:00:00 2001 From: Robert Hebel Date: Mon, 24 Nov 2025 13:14:19 +0100 Subject: [PATCH 6/6] test: update tests --- .../sample-api-async-validation-2.0.0.json | 30 +++++-------------- packages/apidom-ls/test/validate.ts | 28 ++++++++--------- 2 files changed, 22 insertions(+), 36 deletions(-) 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 a9b46e99e8..3f13415f29 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": "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": 1, "code": 10001, "source": "apilint", @@ -77,51 +77,37 @@ { "message": "update to 'null'", "action": "updateValue", - "functionParams": [ - "null" - ] + "functionParams": ["null"] }, { "message": "update to 'boolean'", "action": "updateValue", - "functionParams": [ - "boolean" - ] + "functionParams": ["boolean"] }, { "message": "update to 'object'", "action": "updateValue", - "functionParams": [ - "object" - ] + "functionParams": ["object"] }, { "message": "update to 'array'", "action": "updateValue", - "functionParams": [ - "array" - ] + "functionParams": ["array"] }, { "message": "update to 'number'", "action": "updateValue", - "functionParams": [ - "null" - ] + "functionParams": ["null"] }, { "message": "update to 'string'", "action": "updateValue", - "functionParams": [ - "string" - ] + "functionParams": ["string"] }, { "message": "update to 'integer'", "action": "updateValue", - "functionParams": [ - "integer" - ] + "functionParams": ["integer"] } ] } diff --git a/packages/apidom-ls/test/validate.ts b/packages/apidom-ls/test/validate.ts index 04369e6b56..f13245bd27 100644 --- a/packages/apidom-ls/test/validate.ts +++ b/packages/apidom-ls/test/validate.ts @@ -289,7 +289,7 @@ describe('apidom-ls-validate', function () { }, }, message: - 'should be equal to one of the allowed values allowedValues: boolean, object, array, number, string, integer null', + 'should be equal to one of the allowed values allowedValues: boolean, object, array, number, string, integer, null', severity: 1, code: 10001, source: 'apilint', @@ -409,7 +409,7 @@ describe('apidom-ls-validate', function () { }, }, message: - 'should be equal to one of the allowed values allowedValues: boolean, object, array, number, string, integer null', + 'should be equal to one of the allowed values allowedValues: boolean, object, array, number, string, integer, null', severity: 1, code: 10001, source: 'apilint', @@ -528,7 +528,7 @@ describe('apidom-ls-validate', function () { }, }, message: - 'should be equal to one of the allowed values allowedValues: boolean, object, array, number, string, integer null', + 'should be equal to one of the allowed values allowedValues: boolean, object, array, number, string, integer, null', severity: 1, code: 10001, source: 'apilint', @@ -861,7 +861,7 @@ describe('apidom-ls-validate', function () { }, }, message: - 'should be equal to one of the allowed values allowedValues: boolean, object, array, number, string, integer null', + 'should be equal to one of the allowed values allowedValues: boolean, object, array, number, string, integer, null', severity: 1, code: 10001, source: 'apilint', @@ -1066,7 +1066,7 @@ describe('apidom-ls-validate', function () { }, }, message: - 'should be equal to one of the allowed values allowedValues: boolean, object, array, number, string, integer null', + 'should be equal to one of the allowed values allowedValues: boolean, object, array, number, string, integer, null', severity: 1, code: 10001, source: 'apilint', @@ -1204,7 +1204,7 @@ describe('apidom-ls-validate', function () { }, }, message: - 'should be equal to one of the allowed values allowedValues: boolean, object, array, number, string, integer null', + 'should be equal to one of the allowed values allowedValues: boolean, object, array, number, string, integer, null', severity: 1, code: 10001, source: 'apilint', @@ -1469,7 +1469,7 @@ describe('apidom-ls-validate', function () { }, }, message: - 'should be equal to one of the allowed values allowedValues: boolean, object, array, number, string, integer null', + 'should be equal to one of the allowed values allowedValues: boolean, object, array, number, string, integer, null', severity: 1, code: 10001, source: 'apilint', @@ -1636,7 +1636,7 @@ describe('apidom-ls-validate', function () { }, }, message: - 'should be equal to one of the allowed values allowedValues: boolean, object, array, number, string, integer null', + 'should be equal to one of the allowed values allowedValues: boolean, object, array, number, string, integer, null', severity: 1, code: 10001, source: 'apilint', @@ -1717,7 +1717,7 @@ describe('apidom-ls-validate', function () { }, }, message: - 'should be equal to one of the allowed values allowedValues: boolean, object, array, number, string, integer null', + 'should be equal to one of the allowed values allowedValues: boolean, object, array, number, string, integer, null', severity: 1, code: 10001, source: 'apilint', @@ -1798,7 +1798,7 @@ describe('apidom-ls-validate', function () { }, }, message: - 'should be equal to one of the allowed values allowedValues: boolean, object, array, number, string, integer null', + 'should be equal to one of the allowed values allowedValues: boolean, object, array, number, string, integer, null', severity: 1, code: 10001, source: 'apilint', @@ -1879,7 +1879,7 @@ describe('apidom-ls-validate', function () { }, }, message: - 'should be equal to one of the allowed values allowedValues: boolean, object, array, number, string, integer null', + 'should be equal to one of the allowed values allowedValues: boolean, object, array, number, string, integer, null', severity: 1, code: 10001, source: 'apilint', @@ -1960,7 +1960,7 @@ describe('apidom-ls-validate', function () { }, }, message: - 'should be equal to one of the allowed values allowedValues: boolean, object, array, number, string, integer null', + 'should be equal to one of the allowed values allowedValues: boolean, object, array, number, string, integer, null', severity: 1, code: 10001, source: 'apilint', @@ -2041,7 +2041,7 @@ describe('apidom-ls-validate', function () { }, }, message: - 'should be equal to one of the allowed values allowedValues: boolean, object, array, number, string, integer null', + 'should be equal to one of the allowed values allowedValues: boolean, object, array, number, string, integer, null', severity: 1, code: 10001, source: 'apilint', @@ -2122,7 +2122,7 @@ describe('apidom-ls-validate', function () { }, }, message: - 'should be equal to one of the allowed values allowedValues: boolean, object, array, number, string, integer null', + 'should be equal to one of the allowed values allowedValues: boolean, object, array, number, string, integer, null', severity: 1, code: 10001, source: 'apilint',