Skip to content

Commit

Permalink
added validations for spec and ref (usebruno#2962)
Browse files Browse the repository at this point in the history
Co-authored-by: Anusree Subash <[email protected]>
  • Loading branch information
2 people authored and Its-treason committed Sep 7, 2024
1 parent d7ed3b8 commit d1a7eee
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/bruno-app/src/utils/importers/openapi-collection.js
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ const transformOpenapiRequestItem = (request) => {
return brunoRequestItem;
};

const resolveRefs = (spec, components = spec.components, visitedItems = new Set()) => {
const resolveRefs = (spec, components = spec?.components, visitedItems = new Set()) => {
if (!spec || typeof spec !== 'object') {
return spec;
}
Expand All @@ -253,7 +253,7 @@ const resolveRefs = (spec, components = spec.components, visitedItems = new Set(
let ref = components;

for (const key of refKeys) {
if (ref[key]) {
if (ref && ref[key]) {
ref = ref[key];
} else {
// Handle invalid references gracefully?
Expand Down

0 comments on commit d1a7eee

Please sign in to comment.