Skip to content

Commit

Permalink
Updated description of UID and simplified folder-id assignment
Browse files Browse the repository at this point in the history
  • Loading branch information
casey-tran committed Feb 14, 2025
1 parent 152eaa7 commit c459fc3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
9 changes: 3 additions & 6 deletions pkg/sources/postman/postman.go
Original file line number Diff line number Diff line change
Expand Up @@ -338,11 +338,6 @@ 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
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 @@ -354,6 +349,7 @@ func (s *Source) scanItem(ctx context.Context, chunksChan chan *sources.Chunk, c
if item.UID != "" {
metadata.FullID = item.UID
metadata.Link = LINK_BASE_URL + FOLDER_TYPE + "/" + metadata.FullID
metadata.FolderID = item.UID
}
// recurse through the folders
for _, subItem := range item.Items {
Expand All @@ -363,12 +359,13 @@ func (s *Source) scanItem(ctx context.Context, chunksChan chan *sources.Chunk, c
// 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 {
if parentItemId == "" {
metadata.FolderName = ""
metadata.FolderID = ""
}
metadata.RequestID = item.UID
metadata.RequestName = item.Name
metadata.FolderID = parentItemId
metadata.Type = REQUEST_TYPE
if item.UID != "" {
// Route to API endpoint
Expand Down
2 changes: 1 addition & 1 deletion pkg/sources/postman/postman_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ type Item struct {
Request Request `json:"request,omitempty"`
Response []Response `json:"response,omitempty"`
Description string `json:"description,omitempty"`
UID string `json:"uid,omitempty"` //Need to use this to get the collection via API
UID string `json:"uid,omitempty"` //Need to use this to get the collection via API. The UID is a concatenation of the ID and the user ID of whoever created the item.
}

type Auth struct {
Expand Down

0 comments on commit c459fc3

Please sign in to comment.