Skip to content

Commit 513d4ac

Browse files
postman_client.IDNameUUID becomes IdNameUid (#4123)
This is misleadingly named. This field actually represents a thing called `uid`, which is a field sometimes provided by the Postman API, and is usually a concatenation of a user id and an object ID. The object ID usually looks like a UUID, but this field is strictly never a UUID. So we rename the field and the struct to (which is named based on it's fields)
1 parent 1cdadf1 commit 513d4ac

File tree

2 files changed

+20
-20
lines changed

2 files changed

+20
-20
lines changed

pkg/sources/postman/postman.go

+7-7
Original file line numberDiff line numberDiff line change
@@ -266,18 +266,18 @@ func (s *Source) scanWorkspace(ctx context.Context, chunksChan chan *sources.Chu
266266

267267
// gather and scan environment variables
268268
for _, envID := range workspace.Environments {
269-
envVars, err := s.client.GetEnvironmentVariables(ctx, envID.UUID)
269+
envVars, err := s.client.GetEnvironmentVariables(ctx, envID.Uid)
270270
if err != nil {
271-
ctx.Logger().Error(err, "could not get env variables", "environment_uuid", envID.UUID)
271+
ctx.Logger().Error(err, "could not get env variables", "environment_uuid", envID.Uid)
272272
continue
273273
}
274-
if shouldSkip(envID.UUID, s.conn.IncludeEnvironments, s.conn.ExcludeEnvironments) {
274+
if shouldSkip(envID.Uid, s.conn.IncludeEnvironments, s.conn.ExcludeEnvironments) {
275275
continue
276276
}
277277
metadata.Type = ENVIRONMENT_TYPE
278-
metadata.Link = LINK_BASE_URL + "environments/" + envID.UUID
278+
metadata.Link = LINK_BASE_URL + "environments/" + envID.Uid
279279
metadata.FullID = envVars.ID
280-
metadata.EnvironmentID = envID.UUID
280+
metadata.EnvironmentID = envID.Uid
281281
metadata.EnvironmentName = envVars.Name
282282

283283
ctx.Logger().V(2).Info("scanning environment vars", "environment_uuid", metadata.FullID)
@@ -300,10 +300,10 @@ func (s *Source) scanWorkspace(ctx context.Context, chunksChan chan *sources.Chu
300300
// at this point we have all the possible
301301
// substitutions from Environment variables
302302
for _, collectionID := range workspace.Collections {
303-
if shouldSkip(collectionID.UUID, s.conn.IncludeCollections, s.conn.ExcludeCollections) {
303+
if shouldSkip(collectionID.Uid, s.conn.IncludeCollections, s.conn.ExcludeCollections) {
304304
continue
305305
}
306-
collection, err := s.client.GetCollection(ctx, collectionID.UUID)
306+
collection, err := s.client.GetCollection(ctx, collectionID.Uid)
307307
if err != nil {
308308
// Log and move on, because sometimes the Postman API seems to give us collection IDs
309309
// that we don't have access to, so we don't want to kill the scan because of it.

pkg/sources/postman/postman_client.go

+13-13
Original file line numberDiff line numberDiff line change
@@ -22,25 +22,25 @@ const (
2222
)
2323

2424
type Workspace struct {
25-
ID string `json:"id"`
26-
Name string `json:"name"`
27-
Type string `json:"type"`
28-
Description string `json:"description"`
29-
Visibility string `json:"visibility"`
30-
CreatedBy string `json:"createdBy"`
31-
UpdatedBy string `json:"updatedBy"`
32-
CreatedAt string `json:"createdAt"`
33-
UpdatedAt string `json:"updatedAt"`
34-
Collections []IDNameUUID `json:"collections"`
35-
Environments []IDNameUUID `json:"environments"`
25+
ID string `json:"id"`
26+
Name string `json:"name"`
27+
Type string `json:"type"`
28+
Description string `json:"description"`
29+
Visibility string `json:"visibility"`
30+
CreatedBy string `json:"createdBy"`
31+
UpdatedBy string `json:"updatedBy"`
32+
CreatedAt string `json:"createdAt"`
33+
UpdatedAt string `json:"updatedAt"`
34+
Collections []IdNameUid `json:"collections"`
35+
Environments []IdNameUid `json:"environments"`
3636
CollectionsRaw []Collection
3737
EnvironmentsRaw []VariableData
3838
}
3939

40-
type IDNameUUID struct {
40+
type IdNameUid struct {
4141
ID string `json:"id"`
4242
Name string `json:"name"`
43-
UUID string `json:"uid"`
43+
Uid string `json:"uid"`
4444
}
4545

4646
type KeyValue struct {

0 commit comments

Comments
 (0)