Skip to content

Commit

Permalink
🐛 fix breaking changes (#62)
Browse files Browse the repository at this point in the history
<!--
Copyright (C) 2020-2022 Arm Limited or its affiliates and Contributors.
All rights reserved.
SPDX-License-Identifier: Proprietary
-->
### Description

Fix breaking changes

### Test Coverage

<!--
Please put an `x` in the correct box e.g. `[x]` to indicate the testing
coverage of this change.
-->

- [ ]  This change is covered by existing or additional automated tests.
- [ ] Manual testing has been performed (and evidence provided) as
automated testing was not feasible.
- [x] Additional tests are not required for this change (e.g.
documentation update).
  • Loading branch information
acabarbaye authored Oct 24, 2024
1 parent e716bcf commit 37935f9
Show file tree
Hide file tree
Showing 15 changed files with 95 additions and 74 deletions.
1 change: 1 addition & 0 deletions changes/20241024085441.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
:bug: Fix breaking changes
10 changes: 5 additions & 5 deletions client/extension_builders_link.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,13 @@ func (a *CMSISBuildersAPIService) FollowBuildersLink(r *ApiListCmsisBuildersRequ
localVarFormParams := url.Values{}

if r.embed != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "embed", r.embed, "")
wrapParameterAddToQuery(localVarQueryParams, "embed", r.embed, "")
}
if r.limit != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "limit", r.limit, "")
wrapParameterAddToQuery(localVarQueryParams, "limit", r.limit, "")
}
if r.offset != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "offset", r.offset, "")
wrapParameterAddToQuery(localVarQueryParams, "offset", r.offset, "")
}
// to determine the Content-Type header
localVarHTTPContentTypes := []string{}
Expand All @@ -72,10 +72,10 @@ func (a *CMSISBuildersAPIService) FollowBuildersLink(r *ApiListCmsisBuildersRequ
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
}
if r.acceptVersion != nil {
parameterAddToHeaderOrQuery(localVarHeaderParams, "Accept-Version", r.acceptVersion, "")
wrapParameterAddToHeader(localVarHeaderParams, "Accept-Version", r.acceptVersion, "")
}
if r.ifNoneMatch != nil {
parameterAddToHeaderOrQuery(localVarHeaderParams, "if-none-match", r.ifNoneMatch, "")
wrapParameterAddToHeader(localVarHeaderParams, "if-none-match", r.ifNoneMatch, "")
}
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
if err != nil {
Expand Down
10 changes: 5 additions & 5 deletions client/extension_buildjobs_link.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,13 @@ func (a *BuildJobsAPIService) FollowBuildJobLink(r *ApiListBuildJobRequest, link
localVarFormParams := url.Values{}

if r.embed != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "embed", r.embed, "")
wrapParameterAddToQuery(localVarQueryParams, "embed", r.embed, "")
}
if r.limit != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "limit", r.limit, "")
wrapParameterAddToQuery(localVarQueryParams, "limit", r.limit, "")
}
if r.offset != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "offset", r.offset, "")
wrapParameterAddToQuery(localVarQueryParams, "offset", r.offset, "")
}
// to determine the Content-Type header
localVarHTTPContentTypes := []string{}
Expand All @@ -72,10 +72,10 @@ func (a *BuildJobsAPIService) FollowBuildJobLink(r *ApiListBuildJobRequest, link
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
}
if r.acceptVersion != nil {
parameterAddToHeaderOrQuery(localVarHeaderParams, "Accept-Version", r.acceptVersion, "")
wrapParameterAddToHeader(localVarHeaderParams, "Accept-Version", r.acceptVersion, "")
}
if r.ifNoneMatch != nil {
parameterAddToHeaderOrQuery(localVarHeaderParams, "if-none-match", r.ifNoneMatch, "")
wrapParameterAddToHeader(localVarHeaderParams, "if-none-match", r.ifNoneMatch, "")
}
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
if err != nil {
Expand Down
10 changes: 10 additions & 0 deletions client/extension_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,13 @@ func (c *APIClient) PrepareRequest(
func (c *APIClient) CallAPI(request *http.Request) (*http.Response, error) {
return c.callAPI(request)
}

// wrapParameterAddToHeader wraps wrapParameterAddToHeaderOrQuery to avoid future breaking changes.
func wrapParameterAddToHeader(headerOrQueryParams interface{}, keyPrefix string, obj interface{}, collectionType string) {
parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefix, obj, "simple", collectionType)
}

// wrapParameterAddToQuery wraps wrapParameterAddToHeaderOrQuery to avoid future breaking changes.
func wrapParameterAddToQuery(headerOrQueryParams interface{}, keyPrefix string, obj interface{}, collectionType string) {
parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefix, obj, "form", collectionType)
}
10 changes: 5 additions & 5 deletions client/extension_generic_workjobs_link.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,13 @@ func (a *GenericWorkJobsAPIService) FollowGenericWorkJobLink(r *ApiListGenericWo
localVarFormParams := url.Values{}

if r.embed != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "embed", r.embed, "")
wrapParameterAddToQuery(localVarQueryParams, "embed", r.embed, "")
}
if r.limit != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "limit", r.limit, "")
wrapParameterAddToQuery(localVarQueryParams, "limit", r.limit, "")
}
if r.offset != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "offset", r.offset, "")
wrapParameterAddToQuery(localVarQueryParams, "offset", r.offset, "")
}
// to determine the Content-Type header
localVarHTTPContentTypes := []string{}
Expand All @@ -72,10 +72,10 @@ func (a *GenericWorkJobsAPIService) FollowGenericWorkJobLink(r *ApiListGenericWo
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
}
if r.acceptVersion != nil {
parameterAddToHeaderOrQuery(localVarHeaderParams, "Accept-Version", r.acceptVersion, "")
wrapParameterAddToHeader(localVarHeaderParams, "Accept-Version", r.acceptVersion, "")
}
if r.ifNoneMatch != nil {
parameterAddToHeaderOrQuery(localVarHeaderParams, "if-none-match", r.ifNoneMatch, "")
wrapParameterAddToHeader(localVarHeaderParams, "if-none-match", r.ifNoneMatch, "")
}
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
if err != nil {
Expand Down
24 changes: 12 additions & 12 deletions client/extension_messages_link.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,10 @@ func (a *BuildJobsAPIService) FollowMessageLink(r *ApiGetBuildMessagesRequest, l
localVarFormParams := url.Values{}

if r.limit != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "limit", r.limit, "")
wrapParameterAddToQuery(localVarQueryParams, "limit", r.limit, "")
}
if r.offset != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "offset", r.offset, "")
wrapParameterAddToQuery(localVarQueryParams, "offset", r.offset, "")
}
// to determine the Content-Type header
var localVarHTTPContentTypes []string
Expand All @@ -70,10 +70,10 @@ func (a *BuildJobsAPIService) FollowMessageLink(r *ApiGetBuildMessagesRequest, l
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
}
if r.acceptVersion != nil {
parameterAddToHeaderOrQuery(localVarHeaderParams, "Accept-Version", r.acceptVersion, "")
wrapParameterAddToHeader(localVarHeaderParams, "Accept-Version", r.acceptVersion, "")
}
if r.ifNoneMatch != nil {
parameterAddToHeaderOrQuery(localVarHeaderParams, "if-none-match", r.ifNoneMatch, "")
wrapParameterAddToHeader(localVarHeaderParams, "if-none-match", r.ifNoneMatch, "")
}
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
if err != nil {
Expand Down Expand Up @@ -195,10 +195,10 @@ func (a *VHTRunJobsAPIService) FollowMessageLink(r *ApiGetVhtRunJobMessagesReque
localVarFormParams := url.Values{}

if r.limit != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "limit", r.limit, "")
wrapParameterAddToQuery(localVarQueryParams, "limit", r.limit, "")
}
if r.offset != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "offset", r.offset, "")
wrapParameterAddToQuery(localVarQueryParams, "offset", r.offset, "")
}
// to determine the Content-Type header
var localVarHTTPContentTypes []string
Expand All @@ -218,10 +218,10 @@ func (a *VHTRunJobsAPIService) FollowMessageLink(r *ApiGetVhtRunJobMessagesReque
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
}
if r.acceptVersion != nil {
parameterAddToHeaderOrQuery(localVarHeaderParams, "Accept-Version", r.acceptVersion, "")
wrapParameterAddToHeader(localVarHeaderParams, "Accept-Version", r.acceptVersion, "")
}
if r.ifNoneMatch != nil {
parameterAddToHeaderOrQuery(localVarHeaderParams, "if-none-match", r.ifNoneMatch, "")
wrapParameterAddToHeader(localVarHeaderParams, "if-none-match", r.ifNoneMatch, "")
}
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
if err != nil {
Expand Down Expand Up @@ -343,10 +343,10 @@ func (a *GenericWorkJobsAPIService) FollowMessageLink(r *ApiGetGenericWorkJobMes
localVarFormParams := url.Values{}

if r.limit != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "limit", r.limit, "")
wrapParameterAddToQuery(localVarQueryParams, "limit", r.limit, "")
}
if r.offset != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "offset", r.offset, "")
wrapParameterAddToQuery(localVarQueryParams, "offset", r.offset, "")
}
// to determine the Content-Type header
var localVarHTTPContentTypes []string
Expand All @@ -366,10 +366,10 @@ func (a *GenericWorkJobsAPIService) FollowMessageLink(r *ApiGetGenericWorkJobMes
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
}
if r.acceptVersion != nil {
parameterAddToHeaderOrQuery(localVarHeaderParams, "Accept-Version", r.acceptVersion, "")
wrapParameterAddToHeader(localVarHeaderParams, "Accept-Version", r.acceptVersion, "")
}
if r.ifNoneMatch != nil {
parameterAddToHeaderOrQuery(localVarHeaderParams, "if-none-match", r.ifNoneMatch, "")
wrapParameterAddToHeader(localVarHeaderParams, "if-none-match", r.ifNoneMatch, "")
}
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
if err != nil {
Expand Down
10 changes: 5 additions & 5 deletions client/extension_virtual_hardware_targets_link.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,13 @@ func (a *VirtualHardwareTargetAPIService) FollowVirtualHardwareTargetsLink(r *Ap
localVarFormParams := url.Values{}

if r.embed != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "embed", r.embed, "")
wrapParameterAddToQuery(localVarQueryParams, "embed", r.embed, "")
}
if r.limit != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "limit", r.limit, "")
wrapParameterAddToQuery(localVarQueryParams, "limit", r.limit, "")
}
if r.offset != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "offset", r.offset, "")
wrapParameterAddToQuery(localVarQueryParams, "offset", r.offset, "")
}
// to determine the Content-Type header
localVarHTTPContentTypes := []string{}
Expand All @@ -72,10 +72,10 @@ func (a *VirtualHardwareTargetAPIService) FollowVirtualHardwareTargetsLink(r *Ap
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
}
if r.acceptVersion != nil {
parameterAddToHeaderOrQuery(localVarHeaderParams, "Accept-Version", r.acceptVersion, "")
wrapParameterAddToHeader(localVarHeaderParams, "Accept-Version", r.acceptVersion, "")
}
if r.ifNoneMatch != nil {
parameterAddToHeaderOrQuery(localVarHeaderParams, "if-none-match", r.ifNoneMatch, "")
wrapParameterAddToHeader(localVarHeaderParams, "if-none-match", r.ifNoneMatch, "")
}
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
if err != nil {
Expand Down
10 changes: 5 additions & 5 deletions client/extension_workspaces_link.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,13 @@ func (a *WorkspaceAPIService) FollowWorkspaceLink(r *ApiListWorkspacesRequest, l
localVarFormParams := url.Values{}

if r.embed != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "embed", r.embed, "")
wrapParameterAddToQuery(localVarQueryParams, "embed", r.embed, "")
}
if r.limit != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "limit", r.limit, "")
wrapParameterAddToQuery(localVarQueryParams, "limit", r.limit, "")
}
if r.offset != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "offset", r.offset, "")
wrapParameterAddToQuery(localVarQueryParams, "offset", r.offset, "")
}
// to determine the Content-Type header
localVarHTTPContentTypes := []string{}
Expand All @@ -72,10 +72,10 @@ func (a *WorkspaceAPIService) FollowWorkspaceLink(r *ApiListWorkspacesRequest, l
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
}
if r.acceptVersion != nil {
parameterAddToHeaderOrQuery(localVarHeaderParams, "Accept-Version", r.acceptVersion, "")
wrapParameterAddToHeader(localVarHeaderParams, "Accept-Version", r.acceptVersion, "")
}
if r.ifNoneMatch != nil {
parameterAddToHeaderOrQuery(localVarHeaderParams, "if-none-match", r.ifNoneMatch, "")
wrapParameterAddToHeader(localVarHeaderParams, "if-none-match", r.ifNoneMatch, "")
}
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
if err != nil {
Expand Down
10 changes: 5 additions & 5 deletions extensions/extension_builders_link.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,13 @@ func (a *CMSISBuildersAPIService) FollowBuildersLink(r *ApiListCmsisBuildersRequ
localVarFormParams := url.Values{}

if r.embed != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "embed", r.embed, "")
wrapParameterAddToQuery(localVarQueryParams, "embed", r.embed, "")
}
if r.limit != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "limit", r.limit, "")
wrapParameterAddToQuery(localVarQueryParams, "limit", r.limit, "")
}
if r.offset != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "offset", r.offset, "")
wrapParameterAddToQuery(localVarQueryParams, "offset", r.offset, "")
}
// to determine the Content-Type header
localVarHTTPContentTypes := []string{}
Expand All @@ -72,10 +72,10 @@ func (a *CMSISBuildersAPIService) FollowBuildersLink(r *ApiListCmsisBuildersRequ
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
}
if r.acceptVersion != nil {
parameterAddToHeaderOrQuery(localVarHeaderParams, "Accept-Version", r.acceptVersion, "")
wrapParameterAddToHeader(localVarHeaderParams, "Accept-Version", r.acceptVersion, "")
}
if r.ifNoneMatch != nil {
parameterAddToHeaderOrQuery(localVarHeaderParams, "if-none-match", r.ifNoneMatch, "")
wrapParameterAddToHeader(localVarHeaderParams, "if-none-match", r.ifNoneMatch, "")
}
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
if err != nil {
Expand Down
10 changes: 5 additions & 5 deletions extensions/extension_buildjobs_link.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,13 @@ func (a *BuildJobsAPIService) FollowBuildJobLink(r *ApiListBuildJobRequest, link
localVarFormParams := url.Values{}

if r.embed != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "embed", r.embed, "")
wrapParameterAddToQuery(localVarQueryParams, "embed", r.embed, "")
}
if r.limit != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "limit", r.limit, "")
wrapParameterAddToQuery(localVarQueryParams, "limit", r.limit, "")
}
if r.offset != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "offset", r.offset, "")
wrapParameterAddToQuery(localVarQueryParams, "offset", r.offset, "")
}
// to determine the Content-Type header
localVarHTTPContentTypes := []string{}
Expand All @@ -72,10 +72,10 @@ func (a *BuildJobsAPIService) FollowBuildJobLink(r *ApiListBuildJobRequest, link
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
}
if r.acceptVersion != nil {
parameterAddToHeaderOrQuery(localVarHeaderParams, "Accept-Version", r.acceptVersion, "")
wrapParameterAddToHeader(localVarHeaderParams, "Accept-Version", r.acceptVersion, "")
}
if r.ifNoneMatch != nil {
parameterAddToHeaderOrQuery(localVarHeaderParams, "if-none-match", r.ifNoneMatch, "")
wrapParameterAddToHeader(localVarHeaderParams, "if-none-match", r.ifNoneMatch, "")
}
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
if err != nil {
Expand Down
10 changes: 10 additions & 0 deletions extensions/extension_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,13 @@ func (c *APIClient) PrepareRequest(
func (c *APIClient) CallAPI(request *http.Request) (*http.Response, error) {
return c.callAPI(request)
}

// wrapParameterAddToHeader wraps wrapParameterAddToHeaderOrQuery to avoid future breaking changes.
func wrapParameterAddToHeader(headerOrQueryParams interface{}, keyPrefix string, obj interface{}, collectionType string) {
parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefix, obj, "simple", collectionType)
}

// wrapParameterAddToQuery wraps wrapParameterAddToHeaderOrQuery to avoid future breaking changes.
func wrapParameterAddToQuery(headerOrQueryParams interface{}, keyPrefix string, obj interface{}, collectionType string) {
parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefix, obj, "form", collectionType)
}
10 changes: 5 additions & 5 deletions extensions/extension_generic_workjobs_link.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,13 @@ func (a *GenericWorkJobsAPIService) FollowGenericWorkJobLink(r *ApiListGenericWo
localVarFormParams := url.Values{}

if r.embed != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "embed", r.embed, "")
wrapParameterAddToQuery(localVarQueryParams, "embed", r.embed, "")
}
if r.limit != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "limit", r.limit, "")
wrapParameterAddToQuery(localVarQueryParams, "limit", r.limit, "")
}
if r.offset != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "offset", r.offset, "")
wrapParameterAddToQuery(localVarQueryParams, "offset", r.offset, "")
}
// to determine the Content-Type header
localVarHTTPContentTypes := []string{}
Expand All @@ -72,10 +72,10 @@ func (a *GenericWorkJobsAPIService) FollowGenericWorkJobLink(r *ApiListGenericWo
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
}
if r.acceptVersion != nil {
parameterAddToHeaderOrQuery(localVarHeaderParams, "Accept-Version", r.acceptVersion, "")
wrapParameterAddToHeader(localVarHeaderParams, "Accept-Version", r.acceptVersion, "")
}
if r.ifNoneMatch != nil {
parameterAddToHeaderOrQuery(localVarHeaderParams, "if-none-match", r.ifNoneMatch, "")
wrapParameterAddToHeader(localVarHeaderParams, "if-none-match", r.ifNoneMatch, "")
}
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
if err != nil {
Expand Down
Loading

0 comments on commit 37935f9

Please sign in to comment.