Skip to content

Commit

Permalink
fix(ls): fix allowed fiedls lint rule for OpenAPI 2.0 Header Object (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
char0n authored Jan 16, 2024
1 parent 20f440c commit adebd90
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ const allowedFields2_0Lint: LinterMeta = {
linterFunction: 'allowedFields',
linterParams: [
[
'description',
'type',
'format',
'items',
Expand Down
9 changes: 8 additions & 1 deletion packages/apidom-ls/test/validate-valid.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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[]);
}
Expand Down

0 comments on commit adebd90

Please sign in to comment.