Skip to content

Commit f4b2e38

Browse files
authored
✨ Update the generator to work with external client packages (#78)
### Description Update the generator to support parsing functions from a specified client package Added optional '-c' / '--client_path' parameter to provide the path to an OpenAPI-generated client package. Removed replace directive to enable installing via 'go install' and explicitly set a client package path using the new parameter. <!-- Please add any detail or context that would be useful to a reviewer. --> - [ ] 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). --------- Co-authored-by: aorabdel <aorabdel@users.noreply.github.com>
1 parent 144bae2 commit f4b2e38

15 files changed

Lines changed: 196 additions & 138 deletions

.github/workflows/update-client.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ jobs:
9595
go mod tidy
9696
go run main.go -i ../all-service-definition/all-def-flat.yaml -o ../extensions/extension_entities.gen.go -t templates/entities.go.tmpl -g collections
9797
go run main.go -i ../all-service-definition/all-def-flat.yaml -o ../extensions/extension_jobs.gen.go -t templates/jobs.go.tmpl -g jobs
98-
go run main.go -i ../all-service-definition/all-def-flat.yaml -o ../extensions/extension_link_followers.gen.go -t templates/linkfollowers.go.tmpl -g links
98+
go run main.go -i ../all-service-definition/all-def-flat.yaml -o ../extensions/extension_link_followers.gen.go -t templates/linkfollowers.go.tmpl -g links -c ../client
9999
- name: Copy extensions to client
100100
run: |
101101
if [ -d ./extensions/ ] ; then cp -r extensions/. ${{ env.go_module }}/ ; fi

changes/20250401193344.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/20250401201356.feature

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
:sparkles: Update the generator to work with external client packages

changes/20250403121709.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

client/api_authorization.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

client/docs/AuthorizationAPI.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ import (
3333
)
3434

3535
func main() {
36-
permissionItem := *openapiclient.NewPermissionItem([]string{"Operations_example"}, "fpga-connection", "worker_1234-job-5678", "9c2d1b2f-3d4e-456a-a7fc-12b5d9c6e8a4", "GenericWorkJobItem", "b7f6c5d1-2a44-4f9a-9d77-6e5a8c9d4e1b", "arm_pat_HGfmzxFblhr6AXiTnyaUqd1pgA9waIiO") // PermissionItem | Data required to check permissions on a resource.
36+
permissionItem := *openapiclient.NewPermissionItem([]string{"Operations_example"}, "worker_1234-job-5678", "9c2d1b2f-3d4e-456a-a7fc-12b5d9c6e8a4", "GenericWorkJobItem", "b7f6c5d1-2a44-4f9a-9d77-6e5a8c9d4e1b", "arm_pat_HGfmzxFblhr6AXiTnyaUqd1pgA9waIiO") // PermissionItem | Data required to check permissions on a resource.
3737
acceptVersion := "1.0.0" // string | Versioning: Optional header to request a specific version of the API. While it is possible to specify a particular major, minor or patch version it is not recommended for production use cases. Only the major version number should be specified as minor and patch versions can be updated without warning. (optional)
3838

3939
configuration := openapiclient.NewConfiguration()

client/docs/PermissionItem.md

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ SPDX-License-Identifier: Apache-2.0
99
Name | Type | Description | Notes
1010
------------ | ------------- | ------------- | -------------
1111
**Operations** | **[]string** | The list of allowed CRUDL operations. |
12-
**Origin** | **string** | The function or service under which the permission is being evaluated. |
1312
**ResourceInstance** | **string** | The unique identifier of the resource instance. |
1413
**ResourceOwnerName** | **string** | The unique identifier of the user or system entity that owns the specified resource instance. |
1514
**ResourceType** | **string** | The type of resource for which permission is being checked. This should only refer to items and not collections. |
@@ -20,7 +19,7 @@ Name | Type | Description | Notes
2019

2120
### NewPermissionItem
2221

23-
`func NewPermissionItem(operations []string, origin string, resourceInstance string, resourceOwnerName string, resourceType string, userName string, userToken string, ) *PermissionItem`
22+
`func NewPermissionItem(operations []string, resourceInstance string, resourceOwnerName string, resourceType string, userName string, userToken string, ) *PermissionItem`
2423

2524
NewPermissionItem instantiates a new PermissionItem object
2625
This constructor will assign default values to properties that have it defined,
@@ -65,26 +64,6 @@ SetOperations sets Operations field to given value.
6564
`func (o *PermissionItem) UnsetOperations()`
6665

6766
UnsetOperations ensures that no value is present for Operations, not even an explicit nil
68-
### GetOrigin
69-
70-
`func (o *PermissionItem) GetOrigin() string`
71-
72-
GetOrigin returns the Origin field if non-nil, zero value otherwise.
73-
74-
### GetOriginOk
75-
76-
`func (o *PermissionItem) GetOriginOk() (*string, bool)`
77-
78-
GetOriginOk returns a tuple with the Origin field if it's non-nil, zero value otherwise
79-
and a boolean to check if the value has been set.
80-
81-
### SetOrigin
82-
83-
`func (o *PermissionItem) SetOrigin(v string)`
84-
85-
SetOrigin sets Origin field to given value.
86-
87-
8867
### GetResourceInstance
8968

9069
`func (o *PermissionItem) GetResourceInstance() string`

client/docs/VhtRunJobItemLinks.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ SPDX-License-Identifier: Apache-2.0
88

99
Name | Type | Description | Notes
1010
------------ | ------------- | ------------- | -------------
11+
**Artefacts** | Pointer to [**HalLinkData**](HalLinkData.md) | | [optional]
1112
**Cancel** | Pointer to [**HalLinkData**](HalLinkData.md) | | [optional]
1213
**Collection** | Pointer to [**HalLinkData**](HalLinkData.md) | | [optional]
1314
**Delete** | Pointer to [**HalLinkData**](HalLinkData.md) | | [optional]
@@ -34,6 +35,31 @@ NewVhtRunJobItemLinksWithDefaults instantiates a new VhtRunJobItemLinks object
3435
This constructor will only assign default values to properties that have it defined,
3536
but it doesn't guarantee that properties required by API are set
3637

38+
### GetArtefacts
39+
40+
`func (o *VhtRunJobItemLinks) GetArtefacts() HalLinkData`
41+
42+
GetArtefacts returns the Artefacts field if non-nil, zero value otherwise.
43+
44+
### GetArtefactsOk
45+
46+
`func (o *VhtRunJobItemLinks) GetArtefactsOk() (*HalLinkData, bool)`
47+
48+
GetArtefactsOk returns a tuple with the Artefacts field if it's non-nil, zero value otherwise
49+
and a boolean to check if the value has been set.
50+
51+
### SetArtefacts
52+
53+
`func (o *VhtRunJobItemLinks) SetArtefacts(v HalLinkData)`
54+
55+
SetArtefacts sets Artefacts field to given value.
56+
57+
### HasArtefacts
58+
59+
`func (o *VhtRunJobItemLinks) HasArtefacts() bool`
60+
61+
HasArtefacts returns a boolean if a field has been set.
62+
3763
### GetCancel
3864

3965
`func (o *VhtRunJobItemLinks) GetCancel() HalLinkData`

client/model_permission_item.go

Lines changed: 1 addition & 30 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

client/model_vht_run_job_item_links.go

Lines changed: 37 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)