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
anusreesubash and anusree-bruno authored Sep 5, 2024
1 parent ab8afed commit c85d7b0
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 c85d7b0

Please sign in to comment.