From 64a81e9121bb582bc7f69261f77e67ce78778ad8 Mon Sep 17 00:00:00 2001 From: Vladimir Gorej Date: Tue, 16 Jan 2024 15:34:50 +0100 Subject: [PATCH] fix(ls): fix allowed fiedls lint rule for OpenAPI 2.0 Header Object --- .../src/config/openapi/header/lint/allowed-fields-2-0.ts | 1 + packages/apidom-ls/test/validate-valid.ts | 9 ++++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/packages/apidom-ls/src/config/openapi/header/lint/allowed-fields-2-0.ts b/packages/apidom-ls/src/config/openapi/header/lint/allowed-fields-2-0.ts index c0c6d6d1f..d0e0f95db 100644 --- a/packages/apidom-ls/src/config/openapi/header/lint/allowed-fields-2-0.ts +++ b/packages/apidom-ls/src/config/openapi/header/lint/allowed-fields-2-0.ts @@ -13,6 +13,7 @@ const allowedFields2_0Lint: LinterMeta = { linterFunction: 'allowedFields', linterParams: [ [ + 'description', 'type', 'format', 'items', diff --git a/packages/apidom-ls/test/validate-valid.ts b/packages/apidom-ls/test/validate-valid.ts index 0d1c1dad5..ae706895b 100644 --- a/packages/apidom-ls/test/validate-valid.ts +++ b/packages/apidom-ls/test/validate-valid.ts @@ -34,11 +34,18 @@ describe('apidom-ls-validate', function () { const oasPath = path.join(__dirname, 'fixtures', 'validation', 'oas', 'valid'); const asyncPath = path.join(__dirname, 'fixtures', 'validation', 'asyncapi', 'valid'); let dir = await fs.promises.opendir(oasPath); + try { for await (const dirent of dir) { console.log(`expecting ${path.join(dir.path, dirent.name)} to be valid`); + const pathToSpec = path.join(dir.path, dirent.name); const specString = fs.readFileSync(path.join(dir.path, dirent.name)).toString(); - const doc: TextDocument = TextDocument.create('foo://bar/doc.json', 'yaml', 0, specString); + const doc: TextDocument = TextDocument.create( + `foo://bar/${pathToSpec}`, + 'yaml', + 0, + specString, + ); const result = await languageService.doValidation(doc, validationContext); assert.deepEqual(result, [] as Diagnostic[]); }