Skip to content

Commit f31c997

Browse files
Bugfix/openapispec empty tag (usebruno#2935)
* test: added test for self closing tags in xml-json parser * fix: allows import of openapispec with empty string as tags --------- Co-authored-by: Anusree Subash <[email protected]>
1 parent 3dfb27d commit f31c997

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

Diff for: packages/bruno-app/src/utils/importers/openapi-collection.js

+9-4
Original file line numberDiff line numberDiff line change
@@ -283,11 +283,16 @@ const groupRequestsByTags = (requests) => {
283283
each(requests, (request) => {
284284
let tags = request.operationObject.tags || [];
285285
if (tags.length > 0) {
286-
let tag = tags[0]; // take first tag
287-
if (!_groups[tag]) {
288-
_groups[tag] = [];
286+
let tag = tags[0].trim(); // take first tag and trim whitespace
287+
288+
if (tag) {
289+
if (!_groups[tag]) {
290+
_groups[tag] = [];
291+
}
292+
_groups[tag].push(request);
293+
} else {
294+
ungrouped.push(request);
289295
}
290-
_groups[tag].push(request);
291296
} else {
292297
ungrouped.push(request);
293298
}

0 commit comments

Comments
 (0)