From 7b88bddcb5e3c9c23e10cdbd2d18324e3c2eef33 Mon Sep 17 00:00:00 2001 From: Krzysztof Kowalczyk Date: Fri, 15 Dec 2023 11:01:25 +0100 Subject: [PATCH] feat(apidom-ls): add reference test case --- .../oas/path-template-all-defined.yaml | 28 ++++++++++++++++--- packages/apidom-ls/test/validate.ts | 11 ++++++-- 2 files changed, 33 insertions(+), 6 deletions(-) diff --git a/packages/apidom-ls/test/fixtures/validation/oas/path-template-all-defined.yaml b/packages/apidom-ls/test/fixtures/validation/oas/path-template-all-defined.yaml index 295e6d3648..28a77c2dc4 100644 --- a/packages/apidom-ls/test/fixtures/validation/oas/path-template-all-defined.yaml +++ b/packages/apidom-ls/test/fixtures/validation/oas/path-template-all-defined.yaml @@ -2,12 +2,21 @@ openapi: 3.0.0 info: title: Foo version: 0.1.0 +components: + parameters: + test_id: + name: test_id + in: path + required: true + schema: + type: string + format: uuid + title: Foo Id paths: /foo/bar/{baz}/test/{foo_id}/baz/{bar_id}: delete: summary: Delete foo bar baz - operationId: >- - deleteFooBarBaz + operationId: deleteFooBarBaz parameters: - name: foo_id in: path @@ -32,8 +41,7 @@ paths: /test/{foo_id}/{bar_id}: get: summary: Get test foo bar - operationId: >- - getTestFooBar + operationId: getTestFooBar parameters: - name: foo_id in: path @@ -48,3 +56,15 @@ paths: content: application/json: schema: {} + /reference/{test_id}/{bar_id}: + get: + summary: Get test bar + operationId: getReferenceFooBar + parameters: + - $ref: '#/components/parameters/test_id' + responses: + '200': + description: Successful Response + content: + application/json: + schema: {} diff --git a/packages/apidom-ls/test/validate.ts b/packages/apidom-ls/test/validate.ts index 2f59e04be7..5ef6ddce19 100644 --- a/packages/apidom-ls/test/validate.ts +++ b/packages/apidom-ls/test/validate.ts @@ -3403,14 +3403,21 @@ describe('apidom-ls-validate', function () { const result = await languageService.doValidation(doc, validationContext); const expected: Diagnostic[] = [ { - range: { start: { line: 5, character: 2 }, end: { line: 5, character: 43 } }, + range: { start: { line: 15, character: 2 }, end: { line: 15, character: 43 } }, message: 'path template expressions is not matched with Parameter Object(s)', severity: 1, code: 3040101, source: 'apilint', }, { - range: { start: { line: 31, character: 2 }, end: { line: 31, character: 25 } }, + range: { start: { line: 40, character: 2 }, end: { line: 40, character: 25 } }, + message: 'path template expressions is not matched with Parameter Object(s)', + severity: 1, + code: 3040101, + source: 'apilint', + }, + { + range: { start: { line: 58, character: 2 }, end: { line: 58, character: 31 } }, message: 'path template expressions is not matched with Parameter Object(s)', severity: 1, code: 3040101,