OpenAPI spec #671

Closed
opened 2023-11-22 02:10:19 +00:00 by unrob · 9 comments
Contributor

Hi folks, would like to contribute some updates to the openapi spec so I can update https://git.deuxfleurs.fr/garage-sdk/garage-admin-sdk-generator and in turn my fork of the terraform provider. Before I dive into src/api/admin/{api_server,router}.rs and figure out if I can automate the generation, wanted to ask if there were already plans for this or if creating a new file and manually updating the docs would be most helpful. Let me know, and I'll get started!

Hi folks, would like to contribute some updates to the openapi spec so I can update https://git.deuxfleurs.fr/garage-sdk/garage-admin-sdk-generator and in turn my fork of the terraform provider. Before I dive into src/api/admin/{api_server,router}.rs and figure out if I can automate the generation, wanted to ask if there were already plans for this or if creating a new file and manually updating the docs would be most helpful. Let me know, and I'll get started!
Contributor

+1. I was just looking for a /v1 openapi spec. Will be watching...

+1. I was just looking for a /v1 openapi spec. Will be watching...
quentin self-assigned this 2023-11-22 07:49:25 +00:00
Owner

Hi all, I was quite busy during Garage 0.9 release and did not have time to update the OpenAPI spec and the SDKs. I will work on it this morning in #672, hope that progress on this issue will be quick!

Hi all, I was quite busy during Garage 0.9 release and did not have time to update the OpenAPI spec and the SDKs. I will work on it this morning in #672, hope that progress on this issue will be quick!
Owner

Can you try one of the following libraries and report potential bugs?

redacted as outdated.

For Python and Javascript, do not forget to change the endpoint from /v0 to /v1.

You can find the upgraded examples here: https://git.deuxfleurs.fr/garage-sdk/garage-admin-sdk-generator/src/branch/v0.9.x

You can browse the new API spec here: https://garagehq.deuxfleurs.fr/api/garage-admin-v1.html

If you have some questions about the new API iteration, we can discuss them here or on #672 directly.

Can you try one of the following libraries and report potential bugs? *redacted as outdated*. For Python and Javascript, do not forget to change the endpoint from `/v0` to `/v1`. You can find the upgraded examples here: https://git.deuxfleurs.fr/garage-sdk/garage-admin-sdk-generator/src/branch/v0.9.x You can browse the new API spec here: https://garagehq.deuxfleurs.fr/api/garage-admin-v1.html If you have some questions about the new API iteration, we can discuss them here or on #672 directly.
Contributor

Can you try one of the following libraries and report potential bugs?

For Golang:

go get git.deuxfleurs.fr/garage-sdk/garage-admin-sdk-golang@f442d10b102d92ec22cf2ab1bde5b8c6d78a1f62

This SDK is working fine so far after some moderate testing. I will add a comment if any problems appear later.

> Can you try one of the following libraries and report potential bugs? > > For Golang: > > ``` > go get git.deuxfleurs.fr/garage-sdk/garage-admin-sdk-golang@f442d10b102d92ec22cf2ab1bde5b8c6d78a1f62 > ``` This SDK is working fine so far after some moderate testing. I will add a comment if any problems appear later.
Owner

The testing continue here:

go get git.deuxfleurs.fr/garage-sdk/garage-admin-sdk-golang@ffd9578e975e886d9075a4f2e710117893de8ac7

npm install git+https://git.deuxfleurs.fr/garage-sdk/garage-admin-sdk-js.git#f7b4e20e4292883f1eaa5cd6cd5287aa550ff605

pip install git+https://git.deuxfleurs.fr/garage-sdk/garage-admin-sdk-python@8c3a7daa8a6d305dc0ee9082ce1f28682951e7b8

I think I will write examples that cover the full API before merging this new version to be sure that I will not break other people code: these example serve as unit tests.

In the meantime, you can use the commits above: the errors you report will help me shape my tests.

The testing continue here: ``` go get git.deuxfleurs.fr/garage-sdk/garage-admin-sdk-golang@ffd9578e975e886d9075a4f2e710117893de8ac7 npm install git+https://git.deuxfleurs.fr/garage-sdk/garage-admin-sdk-js.git#f7b4e20e4292883f1eaa5cd6cd5287aa550ff605 pip install git+https://git.deuxfleurs.fr/garage-sdk/garage-admin-sdk-python@8c3a7daa8a6d305dc0ee9082ce1f28682951e7b8 ``` I think I will write [examples that cover the full API](https://git.deuxfleurs.fr/garage-sdk/garage-admin-sdk-generator/src/branch/v0.9.x/example) before merging this new version to be sure that I will not break other people code: these example serve as unit tests. In the meantime, you can use the commits above: the errors you report will help me shape my tests.
Author
Contributor

Ran another set of tests and everything looks good to me, thanks again for the quick turnaround!

Ran another set of tests and everything looks good to me, thanks again for the quick turnaround!
Contributor

There is a problem in the golang SDK (at least) regarding updating keys.
It looks like URL parameters are not being created correctly so the update key post is being interpreted as a new key request. I will debug this soon. Just wanted to mention it.

There is a problem in the golang SDK (at least) regarding updating keys. It looks like URL parameters are not being created correctly so the update key post is being interpreted as a new key request. I will debug this soon. Just wanted to mention it.
Contributor

Delete key also doesn't work. It appears to be for the same reason.
Note that key updating and deleting appear to be the only API requests that include an id in the URL parameters in: path in the openapi specification.

Manually editing the generated go file for UpdateKeyExecute like this:

localVarPath := localBasePath + "/key?id=" + url.PathEscape(parameterToString(r.accessKey, ""))

makes it work. Guessing that changing the openapi file so the parameter name is id and placing in: query will fix these.

Delete key also doesn't work. It appears to be for the same reason. Note that key updating and deleting appear to be the only API requests that include an id in the URL parameters `in: path` in the openapi specification. Manually editing the generated go file for UpdateKeyExecute like this: ```go localVarPath := localBasePath + "/key?id=" + url.PathEscape(parameterToString(r.accessKey, "")) ``` makes it work. Guessing that changing the openapi file so the parameter name is `id` and placing `in: query` will fix these.
Owner

I am confident it is fixed in the re-generated SDK above, as it was also reported by unrob.
But to be sure, I will write extensive tests for the golang SDK this morning then merge.

I am confident it is fixed in the re-generated SDK above, as it was also reported by unrob. But to be sure, I will write extensive tests for the golang SDK this morning then merge.
lx closed this issue 2023-11-29 15:42:47 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
3 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: Deuxfleurs/garage#671
No description provided.