Skip to content

Commit

Permalink
fix(ls): recognize OpenAPI 2.0 root element (#3493)
Browse files Browse the repository at this point in the history
Refs #3480
  • Loading branch information
char0n committed Dec 4, 2023
1 parent 71f0aa8 commit c35931d
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,13 @@ import {
import { FunctionItem } from '../../apidom-language-types';

const root = (el: Element): Element => {
const rootElementTypes = ['swagger', 'openApi3_0', 'openApi3_1', 'asyncApi2'];
let node = el;
while (node.parent && !['openApi3_0', 'openApi3_1', 'asyncApi2'].includes(node.parent.element)) {

while (node.parent && !rootElementTypes.includes(node.parent.element)) {
node = node.parent;
}

return node.parent;
};

Expand Down

0 comments on commit c35931d

Please sign in to comment.