Skip to content

Commit c35931d

Browse files
authored
fix(ls): recognize OpenAPI 2.0 root element (#3493)
Refs #3480
1 parent 71f0aa8 commit c35931d

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

packages/apidom-ls/src/services/validation/linter-functions.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,13 @@ import {
2323
import { FunctionItem } from '../../apidom-language-types';
2424

2525
const root = (el: Element): Element => {
26+
const rootElementTypes = ['swagger', 'openApi3_0', 'openApi3_1', 'asyncApi2'];
2627
let node = el;
27-
while (node.parent && !['openApi3_0', 'openApi3_1', 'asyncApi2'].includes(node.parent.element)) {
28+
29+
while (node.parent && !rootElementTypes.includes(node.parent.element)) {
2830
node = node.parent;
2931
}
32+
3033
return node.parent;
3134
};
3235

0 commit comments

Comments
 (0)