Skip to content

Commit

Permalink
chore(deps): bump openapi-path-templating to 2.0.1 (#4622)
Browse files Browse the repository at this point in the history
Closes #4621
  • Loading branch information
char0n authored Dec 25, 2024
1 parent 8abb96c commit d736090
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 10 deletions.
9 changes: 5 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/apidom-ls/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
14 changes: 9 additions & 5 deletions packages/apidom-ls/src/services/validation/linter-functions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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;
},
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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][] = [];
Expand Down

0 comments on commit d736090

Please sign in to comment.