From e4cd7ae13e2d0d56ca6b9ea6cee4a8b03693ea92 Mon Sep 17 00:00:00 2001 From: Calem Roelofs <96050034+CalemRoelofsSB@users.noreply.github.com> Date: Wed, 20 Dec 2023 12:19:10 +0100 Subject: [PATCH 1/2] fix(ls): Fix regex in Swagger 2.0 basePath linting rule --- .../src/config/openapi/swagger/lint/base-path--pattern.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/apidom-ls/src/config/openapi/swagger/lint/base-path--pattern.ts b/packages/apidom-ls/src/config/openapi/swagger/lint/base-path--pattern.ts index ebb1402f43..981500318d 100644 --- a/packages/apidom-ls/src/config/openapi/swagger/lint/base-path--pattern.ts +++ b/packages/apidom-ls/src/config/openapi/swagger/lint/base-path--pattern.ts @@ -10,7 +10,7 @@ const basePathPatternLint: LinterMeta = { message: '"basePath" value MUST be a relative URI Referencing starting with a leading slash (/).', severity: DiagnosticSeverity.Error, linterFunction: 'apilintValueRegex', - linterParams: ['^/(?:[^/s][^s]*)?$'], + linterParams: ['^/(?:[^/\s][^\s]*)?$'], target: 'basePath', marker: 'value', data: {}, From 6f7e673b6f72ce338277db8c8d8e361f2e5df755 Mon Sep 17 00:00:00 2001 From: Calem Roelofs Date: Wed, 20 Dec 2023 14:34:02 +0100 Subject: [PATCH 2/2] fix(ls): properly escape backslashes --- .../src/config/openapi/swagger/lint/base-path--pattern.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/apidom-ls/src/config/openapi/swagger/lint/base-path--pattern.ts b/packages/apidom-ls/src/config/openapi/swagger/lint/base-path--pattern.ts index 981500318d..828a7798d4 100644 --- a/packages/apidom-ls/src/config/openapi/swagger/lint/base-path--pattern.ts +++ b/packages/apidom-ls/src/config/openapi/swagger/lint/base-path--pattern.ts @@ -10,7 +10,7 @@ const basePathPatternLint: LinterMeta = { message: '"basePath" value MUST be a relative URI Referencing starting with a leading slash (/).', severity: DiagnosticSeverity.Error, linterFunction: 'apilintValueRegex', - linterParams: ['^/(?:[^/\s][^\s]*)?$'], + linterParams: ['^/(?:[^/\\s][^\\s]*)?$'], target: 'basePath', marker: 'value', data: {},