diff --git a/package-lock.json b/package-lock.json index a737f89d50..2ec2565b34 100644 --- a/package-lock.json +++ b/package-lock.json @@ -20180,9 +20180,10 @@ } }, "node_modules/openapi-path-templating": { - "version": "1.7.0", - "resolved": "https://registry.npmjs.org/openapi-path-templating/-/openapi-path-templating-1.7.0.tgz", - "integrity": "sha512-PYYQdf4VRpzpXKMkV6qJK9eI6BO/dsE3i+8dYaaM7MFaL8jxK8xTXm+FS0M3GYobaFPYsMlPhZ0vTUJaKvXx/Q==", + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/openapi-path-templating/-/openapi-path-templating-2.0.1.tgz", + "integrity": "sha512-65TeAgRU9nl7ZZHJRKmfNLfPSXSG+BFc514rMTLotfkVBTUsmuCOo6XhgLUrDoPEuCIl0LJ38IKgvZK4mYGJeQ==", + "license": "Apache-2.0", "dependencies": { "apg-lite": "^1.0.4" }, @@ -25300,7 +25301,7 @@ "@swagger-api/apidom-parser-adapter-yaml-1-2": "^1.0.0-beta.5", "@swagger-api/apidom-reference": "^1.0.0-beta.5", "@types/ramda": "~0.30.0", - "openapi-path-templating": "^1.4.0", + "openapi-path-templating": "^2.0.1", "ramda": "~0.30.0", "ramda-adjunct": "^5.0.0", "vscode-languageserver-protocol": "^3.17.2", diff --git a/packages/apidom-ls/package.json b/packages/apidom-ls/package.json index 582cd898ef..d262621102 100644 --- a/packages/apidom-ls/package.json +++ b/packages/apidom-ls/package.json @@ -116,7 +116,7 @@ "@swagger-api/apidom-parser-adapter-yaml-1-2": "^1.0.0-beta.5", "@swagger-api/apidom-reference": "^1.0.0-beta.5", "@types/ramda": "~0.30.0", - "openapi-path-templating": "^1.4.0", + "openapi-path-templating": "^2.0.1", "ramda": "~0.30.0", "ramda-adjunct": "^5.0.0", "vscode-languageserver-protocol": "^3.17.2", diff --git a/packages/apidom-ls/src/services/validation/linter-functions.ts b/packages/apidom-ls/src/services/validation/linter-functions.ts index c2a2b99a55..196d248c27 100644 --- a/packages/apidom-ls/src/services/validation/linter-functions.ts +++ b/packages/apidom-ls/src/services/validation/linter-functions.ts @@ -12,7 +12,11 @@ import { includesClasses, } from '@swagger-api/apidom-core'; import { CompletionItem } from 'vscode-languageserver-types'; -import { test, resolve, parse } from 'openapi-path-templating'; +import { + test as testPathTemplate, + resolve as resolvePathTemplate, + parse as parsePathTemplate, +} from 'openapi-path-templating'; // eslint-disable-next-line import/no-cycle import { @@ -1018,7 +1022,7 @@ export const standardLinterfunctions: FunctionItem[] = [ function: (element: Element, strict = false) => { if (isStringElement(element)) { const pathTemplate = toValue(element); - return test(pathTemplate, { strict }); + return testPathTemplate(pathTemplate, { strict }); } return true; }, @@ -1076,8 +1080,8 @@ export const standardLinterfunctions: FunctionItem[] = [ }); const pathTemplate = toValue(element); - const resolvedPathTemplate = resolve(pathTemplate, pathTemplateResolveParams); - const includesTemplateExpression = test(resolvedPathTemplate, { strict: true }); + const resolvedPathTemplate = resolvePathTemplate(pathTemplate, pathTemplateResolveParams); + const includesTemplateExpression = testPathTemplate(resolvedPathTemplate, { strict: true }); return !includesTemplateExpression || oneOfParametersIsReferenceObject; } @@ -1116,7 +1120,7 @@ export const standardLinterfunctions: FunctionItem[] = [ const pathTemplate = toValue(pathItemElement.meta.get('path')); const parameterName = toValue((element as ObjectElement).get('name')); - const parseResult = parse(pathTemplate); + const parseResult = parsePathTemplate(pathTemplate); if (!parseResult.result.success) return true; const parts: [string, string][] = [];