Postman collection programmatically generated does not contain an item in subfolder when imported in Postman

Hi ,

I have generated a postman collection using the postman SDK (postman-collection).When I import the programmatically generated collection into postman , my subfolder (my-folder-3) is missing the item , although I can clearly see that item in the generated JSON collection:

This is my code:

myCollection = new Collection({
  "item": [{
      "id": "my-folder-1",
      "name": "my-folder-1",
      "item": [\*] // blank array indicates this is a folder
  }]
}); 

myCollection.items.one("my-folder-1").items.add(new ItemGroup({
  "name": "my-folder-2",
  "id": "my-folder-2",
  }));



myCollection.items.one("my-folder-1").items.one("my-folder-2").items.add(new Item({
  "name": "Send a GET request in my folder 2",
  "id": "my-get-request",
  "request": {
      "url": "https://postman-echo.com/",
      "method": "POST"
  }
}));

myCollection.items.one("my-folder-1").items.add(new ItemGroup({
  "name": "my-folder-3",
  "id": "my-folder-3",
  }));

myCollection.items.one("my-folder-1").items.one("my-folder-3").items.add(new Item({
  "name": "Send a GET request in my folder 3",
  "id": "my-get-request",
  "request": {
      "url": "https://postman-echo.com/",
      "method": "POST"
  }
}));



fs.writeFileSync("../autogenerated_collections" + "/test1.json", JSON.stringify(myCollection))

This is the generated collection that I try to import in Postman:

{“item”:[{“id”:“my-folder-1”,“name”:“my-folder-1”,“item”:[{“id”:“my-folder-2”,“name”:“my-folder-2”,“item”:[{“id”:“my-get-request”,“name”:“Send a GET request in my folder 2”,“request”:{“url”:{“protocol”:“https”,“path”:[""],“host”:[“postman-echo”,“com”],“query”:,“variable”:},“method”:“POST”},“response”:,“event”:}],“event”:},{“id”:“my-folder-3”,“name”:“my-folder-3”,“item”:[{“id”:“my-get-request”,“name”:“Send a GET request in my folder 3”,“request”:{“url”:{“protocol”:“https”,“path”:[""],“host”:[“postman-echo”,“com”],“query”:,“variable”:},“method”:“POST”},“response”:,“event”:}],“event”:}],“event”:}],“event”:,“variable”:,“info”:{"_postman_id":“590db509-3aac-435e-982a-97ca754f4938”,“schema”:“https://schema.getpostman.com/json/collection/v2.1.0/collection.json”}}

Hello,

I figured out the issue:

The id used for the 2 items being added to seperate item groups was the same and that was causing the issue .