Skip to content
This repository has been archived by the owner on Dec 27, 2024. It is now read-only.

Commit

Permalink
feat: support empty folders Close #89
Browse files Browse the repository at this point in the history
  • Loading branch information
joolfe committed Mar 27, 2021
1 parent 56d00df commit 6397d7c
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ async function postmanToOpenApi (input, output, { info = {}, defaultTag = 'defau
const tagged = item.map(e => ({ ...e, tag }))
tags[tag] = tagDesc
items.splice(i, 1, ...tagged)
element = tagged.shift()
// Empty folders will have tagged empty
element = (tagged.length > 0) ? tagged.shift() : items[i]
}
const {
request: { url, method, body, description: rawDesc, header },
Expand Down
5 changes: 5 additions & 0 deletions test/resources/input/v2/FolderCollection.json
Original file line number Diff line number Diff line change
Expand Up @@ -449,6 +449,11 @@
],
"protocolProfileBehavior": {}
},
{
"name": "Empty Folder",
"item": [],
"protocolProfileBehavior": {}
},
{
"name": "Create a info",
"request": {
Expand Down
5 changes: 5 additions & 0 deletions test/resources/input/v21/FolderCollection.json
Original file line number Diff line number Diff line change
Expand Up @@ -543,6 +543,11 @@
],
"protocolProfileBehavior": {}
},
{
"name": "Empty Folder",
"item": [],
"protocolProfileBehavior": {}
},
{
"name": "Create a info",
"request": {
Expand Down
1 change: 1 addition & 0 deletions test/resources/output/Folders.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ tags:
description: Folder 4 description
- name: Folder 1 > Folder 2 > Folder 3 > Folder 4 > Folder 5
description: Folder 5 description
- name: Empty Folder
paths:
/users/admin/roles:
get:
Expand Down

0 comments on commit 6397d7c

Please sign in to comment.