Skip to content

Commit d0f1230

Browse files
authored
✨ Inject empty string check into link followers (#86)
<!-- Copyright (C) 2020-2022 Arm Limited or its affiliates and Contributors. All rights reserved. SPDX-License-Identifier: Proprietary --> ### Description This change adds the following empty string check to the link followers functions ``` if link == "" { return nil, nil, errors.New("empty link") } ``` before the modified line: ``` localVarPath := localBasePath + link ``` - [X] This change is covered by existing or additional automated tests. - [ ] Manual testing has been performed (and evidence provided) as automated testing was not feasible. - [ ] Additional tests are not required for this change (e.g. documentation update). --------- Co-authored-by: aorabdel <[email protected]>
1 parent 92cba91 commit d0f1230

File tree

8 files changed

+289
-7
lines changed

8 files changed

+289
-7
lines changed

changes/20250409172526.feature

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Updated client due to schema changes

changes/20250409181749.feature

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
:sparkles: Inject empty string check into link followers

client/extension_link_followers.gen.go

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ package client
77

88
import (
99
"bytes"
10+
"errors"
1011
"io"
1112
"net/http"
1213
"net/url"
@@ -34,6 +35,9 @@ func (a *BuildJobsAPIService) FollowGetBuildMessagesLink(r *ApiGetBuildMessagesR
3435
if err != nil {
3536
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
3637
}
38+
if link == "" {
39+
return nil, nil, errors.New("empty link")
40+
}
3741

3842
localVarPath := localBasePath + link
3943
localVarPath = strings.Replace(localVarPath, "{"+"jobName"+"}", parameterValueToString(r.jobName, "jobName"), -1)
@@ -186,6 +190,9 @@ func (a *BuildJobsAPIService) FollowBuildJobLink(r *ApiListBuildJobRequest, link
186190
if err != nil {
187191
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
188192
}
193+
if link == "" {
194+
return nil, nil, errors.New("empty link")
195+
}
189196

190197
localVarPath := localBasePath + link
191198

@@ -332,6 +339,9 @@ func (a *BuildJobsAPIService) FollowBuildOutputManagersLink(r *ApiListBuildOutpu
332339
if err != nil {
333340
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
334341
}
342+
if link == "" {
343+
return nil, nil, errors.New("empty link")
344+
}
335345

336346
localVarPath := localBasePath + link
337347
localVarPath = strings.Replace(localVarPath, "{"+"jobName"+"}", parameterValueToString(r.jobName, "jobName"), -1)
@@ -490,6 +500,9 @@ func (a *CMSISBuildersAPIService) FollowCmsisBuildersLink(r *ApiListCmsisBuilder
490500
if err != nil {
491501
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
492502
}
503+
if link == "" {
504+
return nil, nil, errors.New("empty link")
505+
}
493506

494507
localVarPath := localBasePath + link
495508

@@ -636,6 +649,9 @@ func (a *CMSISIntellisenseBuildersAPIService) FollowCmsisIntellisenseLink(r *Api
636649
if err != nil {
637650
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
638651
}
652+
if link == "" {
653+
return nil, nil, errors.New("empty link")
654+
}
639655

640656
localVarPath := localBasePath + link
641657

@@ -782,6 +798,9 @@ func (a *FPGAConnectionAPIService) FollowFpgaConnectionsLink(r *ApiListFpgaConne
782798
if err != nil {
783799
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
784800
}
801+
if link == "" {
802+
return nil, nil, errors.New("empty link")
803+
}
785804

786805
localVarPath := localBasePath + link
787806

@@ -928,6 +947,9 @@ func (a *FPGAJobsAPIService) FollowGetFpgaJobMessagesLink(r *ApiGetFpgaJobMessag
928947
if err != nil {
929948
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
930949
}
950+
if link == "" {
951+
return nil, nil, errors.New("empty link")
952+
}
931953

932954
localVarPath := localBasePath + link
933955
localVarPath = strings.Replace(localVarPath, "{"+"jobName"+"}", parameterValueToString(r.jobName, "jobName"), -1)
@@ -1080,6 +1102,9 @@ func (a *FPGAJobsAPIService) FollowFpgaJobArtefactManagersLink(r *ApiListFpgaJob
10801102
if err != nil {
10811103
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
10821104
}
1105+
if link == "" {
1106+
return nil, nil, errors.New("empty link")
1107+
}
10831108

10841109
localVarPath := localBasePath + link
10851110
localVarPath = strings.Replace(localVarPath, "{"+"jobName"+"}", parameterValueToString(r.jobName, "jobName"), -1)
@@ -1238,6 +1263,9 @@ func (a *FPGAPayloadsAPIService) FollowPayloadsLink(r *ApiListPayloadsRequest, l
12381263
if err != nil {
12391264
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
12401265
}
1266+
if link == "" {
1267+
return nil, nil, errors.New("empty link")
1268+
}
12411269

12421270
localVarPath := localBasePath + link
12431271

@@ -1384,6 +1412,9 @@ func (a *GenericWorkJobsAPIService) FollowGetGenericWorkJobMessagesLink(r *ApiGe
13841412
if err != nil {
13851413
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
13861414
}
1415+
if link == "" {
1416+
return nil, nil, errors.New("empty link")
1417+
}
13871418

13881419
localVarPath := localBasePath + link
13891420
localVarPath = strings.Replace(localVarPath, "{"+"jobName"+"}", parameterValueToString(r.jobName, "jobName"), -1)
@@ -1536,6 +1567,9 @@ func (a *GenericWorkJobsAPIService) FollowGenericWorkJobArtefactManagersLink(r *
15361567
if err != nil {
15371568
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
15381569
}
1570+
if link == "" {
1571+
return nil, nil, errors.New("empty link")
1572+
}
15391573

15401574
localVarPath := localBasePath + link
15411575
localVarPath = strings.Replace(localVarPath, "{"+"jobName"+"}", parameterValueToString(r.jobName, "jobName"), -1)
@@ -1694,6 +1728,9 @@ func (a *GenericWorkJobsAPIService) FollowGenericWorkJobsLink(r *ApiListGenericW
16941728
if err != nil {
16951729
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
16961730
}
1731+
if link == "" {
1732+
return nil, nil, errors.New("empty link")
1733+
}
16971734

16981735
localVarPath := localBasePath + link
16991736

@@ -1840,6 +1877,9 @@ func (a *GenericWorkersAPIService) FollowGenericWorkersLink(r *ApiListGenericWor
18401877
if err != nil {
18411878
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
18421879
}
1880+
if link == "" {
1881+
return nil, nil, errors.New("empty link")
1882+
}
18431883

18441884
localVarPath := localBasePath + link
18451885

@@ -1986,6 +2026,9 @@ func (a *IntellisenseJobsAPIService) FollowGetIntellisenseMessagesLink(r *ApiGet
19862026
if err != nil {
19872027
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
19882028
}
2029+
if link == "" {
2030+
return nil, nil, errors.New("empty link")
2031+
}
19892032

19902033
localVarPath := localBasePath + link
19912034
localVarPath = strings.Replace(localVarPath, "{"+"jobName"+"}", parameterValueToString(r.jobName, "jobName"), -1)
@@ -2138,6 +2181,9 @@ func (a *IntellisenseJobsAPIService) FollowIntellisenseJobLink(r *ApiListIntelli
21382181
if err != nil {
21392182
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
21402183
}
2184+
if link == "" {
2185+
return nil, nil, errors.New("empty link")
2186+
}
21412187

21422188
localVarPath := localBasePath + link
21432189

@@ -2284,6 +2330,9 @@ func (a *IntellisenseJobsAPIService) FollowIntellisenseOutputManagersLink(r *Api
22842330
if err != nil {
22852331
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
22862332
}
2333+
if link == "" {
2334+
return nil, nil, errors.New("empty link")
2335+
}
22872336

22882337
localVarPath := localBasePath + link
22892338
localVarPath = strings.Replace(localVarPath, "{"+"jobName"+"}", parameterValueToString(r.jobName, "jobName"), -1)
@@ -2442,6 +2491,9 @@ func (a *VHTRunJobsAPIService) FollowGetVhtRunJobMessagesLink(r *ApiGetVhtRunJob
24422491
if err != nil {
24432492
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
24442493
}
2494+
if link == "" {
2495+
return nil, nil, errors.New("empty link")
2496+
}
24452497

24462498
localVarPath := localBasePath + link
24472499
localVarPath = strings.Replace(localVarPath, "{"+"jobName"+"}", parameterValueToString(r.jobName, "jobName"), -1)
@@ -2594,6 +2646,9 @@ func (a *VHTRunJobsAPIService) FollowVhtRunJobsLink(r *ApiListVhtRunJobsRequest,
25942646
if err != nil {
25952647
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
25962648
}
2649+
if link == "" {
2650+
return nil, nil, errors.New("empty link")
2651+
}
25972652

25982653
localVarPath := localBasePath + link
25992654

@@ -2740,6 +2795,9 @@ func (a *VirtualHardwareTargetAPIService) FollowFilteredVhtInstancesLink(r *ApiL
27402795
if err != nil {
27412796
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
27422797
}
2798+
if link == "" {
2799+
return nil, nil, errors.New("empty link")
2800+
}
27432801

27442802
localVarPath := localBasePath + link
27452803
localVarPath = strings.Replace(localVarPath, "{"+"vhtName"+"}", parameterValueToString(r.vhtName, "vhtName"), -1)
@@ -2887,6 +2945,9 @@ func (a *VirtualHardwareTargetAPIService) FollowVhtsLink(r *ApiListVhtsRequest,
28872945
if err != nil {
28882946
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
28892947
}
2948+
if link == "" {
2949+
return nil, nil, errors.New("empty link")
2950+
}
28902951

28912952
localVarPath := localBasePath + link
28922953

@@ -3033,6 +3094,9 @@ func (a *VirtualHardwareTargetInstanceAPIService) FollowGetVhtInstanceMessagesLi
30333094
if err != nil {
30343095
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
30353096
}
3097+
if link == "" {
3098+
return nil, nil, errors.New("empty link")
3099+
}
30363100

30373101
localVarPath := localBasePath + link
30383102
localVarPath = strings.Replace(localVarPath, "{"+"instanceName"+"}", parameterValueToString(r.instanceName, "instanceName"), -1)
@@ -3185,6 +3249,9 @@ func (a *VirtualHardwareTargetInstanceAPIService) FollowVhtInstanceArtefactManag
31853249
if err != nil {
31863250
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
31873251
}
3252+
if link == "" {
3253+
return nil, nil, errors.New("empty link")
3254+
}
31883255

31893256
localVarPath := localBasePath + link
31903257
localVarPath = strings.Replace(localVarPath, "{"+"instanceName"+"}", parameterValueToString(r.instanceName, "instanceName"), -1)
@@ -3343,6 +3410,9 @@ func (a *VirtualHardwareTargetInstanceAPIService) FollowVhtInstancesLink(r *ApiL
33433410
if err != nil {
33443411
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
33453412
}
3413+
if link == "" {
3414+
return nil, nil, errors.New("empty link")
3415+
}
33463416

33473417
localVarPath := localBasePath + link
33483418

@@ -3489,6 +3559,9 @@ func (a *WorkspaceAPIService) FollowWorkspacesLink(r *ApiListWorkspacesRequest,
34893559
if err != nil {
34903560
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
34913561
}
3562+
if link == "" {
3563+
return nil, nil, errors.New("empty link")
3564+
}
34923565

34933566
localVarPath := localBasePath + link
34943567

@@ -3635,6 +3708,9 @@ func (a *WorkspaceSourceAPIService) FollowWorkspaceSourcesLink(r *ApiListWorkspa
36353708
if err != nil {
36363709
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
36373710
}
3711+
if link == "" {
3712+
return nil, nil, errors.New("empty link")
3713+
}
36383714

36393715
localVarPath := localBasePath + link
36403716

client/go.mod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ module github.com/ARM-software/embedded-development-services-client/client
33
go 1.24
44

55
require (
6-
github.com/ARM-software/golang-utils/utils v1.89.0
6+
github.com/ARM-software/golang-utils/utils v1.91.0
77
github.com/stretchr/testify v1.10.0
88
)
99

@@ -14,6 +14,6 @@ require (
1414
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
1515
github.com/sasha-s/go-deadlock v0.3.5 // indirect
1616
go.uber.org/atomic v1.11.0 // indirect
17-
golang.org/x/text v0.23.0 // indirect
17+
golang.org/x/text v0.24.0 // indirect
1818
gopkg.in/yaml.v3 v3.0.1 // indirect
1919
)

client/go.sum

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
github.com/ARM-software/golang-utils/utils v1.89.0 h1:WyrZiTkzzHemZ4oqS/LbkjukDYyV7TCS1efAT9rmB4A=
2-
github.com/ARM-software/golang-utils/utils v1.89.0/go.mod h1:hbOnHpp3NKGQlSwI8YhIBLH5TrlPnFP3OE0HphMNqVI=
1+
github.com/ARM-software/golang-utils/utils v1.91.0 h1:aVIeyPLPX4kEJEkse1JA4F2eXUO6n91WPJOYup2kZcQ=
2+
github.com/ARM-software/golang-utils/utils v1.91.0/go.mod h1:plsOQHwkMemjNf874kEBJyWXtVldm9KNZHQ2M/i03pQ=
33
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM=
44
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
55
github.com/go-faker/faker/v4 v4.6.0 h1:6aOPzNptRiDwD14HuAnEtlTa+D1IfFuEHO8+vEFwjTs=
@@ -16,8 +16,8 @@ go.uber.org/atomic v1.11.0 h1:ZvwS0R+56ePWxUNi+Atn9dWONBPp/AUETXlHW0DxSjE=
1616
go.uber.org/atomic v1.11.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0=
1717
go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto=
1818
go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE=
19-
golang.org/x/text v0.23.0 h1:D71I7dUrlY+VX0gQShAThNGHFxZ13dGLBHQLVl1mJlY=
20-
golang.org/x/text v0.23.0/go.mod h1:/BLNzu4aZCJ1+kcD0DNRotWKage4q2rGVAg4o22unh4=
19+
golang.org/x/text v0.24.0 h1:dd5Bzh4yt5KYA8f9CJHCP4FB4D51c2c6JvN37xJJkJ0=
20+
golang.org/x/text v0.24.0/go.mod h1:L8rBsPeo2pSS+xqN0d5u2ikmjtmoJbDBT1b7nHvFCdU=
2121
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
2222
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
2323
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=

0 commit comments

Comments
 (0)