Skip to content

Commit

Permalink
Use UID for parent ID and request ID for consistency
Browse files Browse the repository at this point in the history
  • Loading branch information
casey-tran committed Feb 13, 2025
1 parent c60e4e7 commit 152eaa7
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions pkg/sources/postman/postman.go
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,11 @@ func (s *Source) scanItem(ctx context.Context, chunksChan chan *sources.Chunk, c
s.attemptToAddKeyword(item.Name)

// override the base collection metadata with item-specific metadata
metadata.FolderID = parentItemId
if parentItemId != "" {
metadata.FolderID = parentItemId
} else {
metadata.FolderID = item.UID
}
metadata.Type = FOLDER_TYPE
if metadata.FolderName != "" {
// keep track of the folder hierarchy
Expand All @@ -353,16 +357,17 @@ func (s *Source) scanItem(ctx context.Context, chunksChan chan *sources.Chunk, c
}
// recurse through the folders
for _, subItem := range item.Items {
s.scanItem(ctx, chunksChan, collection, metadata, subItem, item.ID)
s.scanItem(ctx, chunksChan, collection, metadata, subItem, item.UID)
}

// check if there are any requests in the folder
if item.Request.Method != "" {
metadata.FolderName = strings.Replace(metadata.FolderName, (" > " + item.Name), "", -1)
if metadata.FolderName == item.Name {
metadata.FolderName = ""
metadata.FolderID = ""
}
metadata.RequestID = item.ID
metadata.RequestID = item.UID
metadata.RequestName = item.Name
metadata.Type = REQUEST_TYPE
if item.UID != "" {
Expand Down

0 comments on commit 152eaa7

Please sign in to comment.