mirror of
https://github.com/usebruno/bruno.git
synced 2024-11-22 07:53:34 +01:00
added validations for spec and ref (#2962)
Co-authored-by: Anusree Subash <anusree@usebruno.com>
This commit is contained in:
parent
ab8afed8f9
commit
c85d7b0c77
@ -229,7 +229,7 @@ const transformOpenapiRequestItem = (request) => {
|
|||||||
return brunoRequestItem;
|
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') {
|
if (!spec || typeof spec !== 'object') {
|
||||||
return spec;
|
return spec;
|
||||||
}
|
}
|
||||||
@ -253,7 +253,7 @@ const resolveRefs = (spec, components = spec.components, visitedItems = new Set(
|
|||||||
let ref = components;
|
let ref = components;
|
||||||
|
|
||||||
for (const key of refKeys) {
|
for (const key of refKeys) {
|
||||||
if (ref[key]) {
|
if (ref && ref[key]) {
|
||||||
ref = ref[key];
|
ref = ref[key];
|
||||||
} else {
|
} else {
|
||||||
// Handle invalid references gracefully?
|
// Handle invalid references gracefully?
|
||||||
|
Loading…
Reference in New Issue
Block a user