Skip to content

Commit 02f1279

Browse files
authored
fix: resolve swagger 500 error from swag v1/v2 registry mismatch (#1265)
This is a very minor fix The `docs.json` endpoint returned HTTP 500 because `swaggo/swag` v2 is incompatible with `gin-swagger` v1. ### Changes - Pin `swaggo/swag` to v1.16.x in `go.mod` and regenrate docs - Pin the `swag` cli in `scripts/swag-gen.sh` to prevent future drift **before** <img width="1559" height="512" alt="Screenshot 2026-07-09 at 12 28 25 AM" src="https://github.com/user-attachments/assets/45ee087d-66ab-47ec-b384-f48f4ddf383d" /> **after** <img width="1466" height="1249" alt="Screenshot 2026-07-09 at 12 27 11 AM" src="https://github.com/user-attachments/assets/611e8d01-0dd2-47c2-8889-161b37a0c6e6" /> related issue - #1260 Signed-off-by: JoonsooWon <wonjs0116@gmail.com>
1 parent e9cf576 commit 02f1279

6 files changed

Lines changed: 3325 additions & 18 deletions

File tree

docs/apis/docs.go

Lines changed: 1631 additions & 4 deletions
Large diffs are not rendered by default.

docs/apis/swagger.json

Lines changed: 1629 additions & 1 deletion
Large diffs are not rendered by default.

docs/apis/swagger.yaml

Lines changed: 61 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -252,11 +252,19 @@ definitions:
252252
properties:
253253
boardID:
254254
type: integer
255+
busID:
256+
description: |-
257+
BusID is the GPU bus ID from the nvml API.
258+
e.g., "0000:0f:00.0"
259+
type: string
255260
minorID:
256261
type: string
257262
sn:
258263
type: string
259264
uuid:
265+
description: |-
266+
UUID is the GPU UUID from the nvml API.
267+
e.g., "GPU-46a3bbe2-3e87-3dde-b464-a03eba0c21d7"
260268
type: string
261269
type: object
262270
github_com_leptonai_gpud_api_v1.MachineInfo:
@@ -318,6 +326,10 @@ definitions:
318326
systemUUID:
319327
description: SystemUUID comes from https://github.com/google/cadvisor/blob/master/utils/sysfs/sysfs.go#L442
320328
type: string
329+
tailscaleVersion:
330+
description: TailscaleVersion represents the version of the tailscale client
331+
binary (e.g. 1.76.6).
332+
type: string
321333
uptime:
322334
description: Uptime represents when the machine up
323335
type: string
@@ -558,8 +570,6 @@ definitions:
558570
description: |-
559571
Timeout is the timeout for the script execution.
560572
If zero, it uses the default timeout (1-minute).
561-
type:
562-
type: string
563573
type: object
564574
github_com_leptonai_gpud_pkg_custom-plugins.Step:
565575
properties:
@@ -628,6 +638,21 @@ definitions:
628638
version:
629639
type: string
630640
type: object
641+
pkg_server.SetHealthyStatesResponse:
642+
properties:
643+
code:
644+
type: integer
645+
failed:
646+
additionalProperties:
647+
type: string
648+
type: object
649+
message:
650+
type: string
651+
successful:
652+
items:
653+
type: string
654+
type: array
655+
type: object
631656
v1.Duration:
632657
properties:
633658
time.Duration:
@@ -640,6 +665,7 @@ definitions:
640665
- 1000000000
641666
- 60000000000
642667
- 3600000000000
668+
format: int64
643669
type: integer
644670
x-enum-varnames:
645671
- minDuration
@@ -965,6 +991,39 @@ paths:
965991
summary: Get component events
966992
tags:
967993
- components
994+
/v1/health-states/set-healthy:
995+
post:
996+
consumes:
997+
- application/json
998+
description: Sets specified components to healthy state if they implement the
999+
HealthSettable interface. If no components specified, attempts to set all
1000+
components to healthy.
1001+
operationId: setHealthyStates
1002+
parameters:
1003+
- description: Comma-separated list of component names to set healthy (if empty,
1004+
sets all components)
1005+
in: query
1006+
name: components
1007+
type: string
1008+
produces:
1009+
- application/json
1010+
responses:
1011+
"200":
1012+
description: Components successfully set to healthy state
1013+
schema:
1014+
$ref: '#/definitions/pkg_server.SetHealthyStatesResponse'
1015+
"400":
1016+
description: Bad request - component does not support setting healthy state
1017+
or failed to parse components
1018+
schema:
1019+
$ref: '#/definitions/pkg_server.SetHealthyStatesResponse'
1020+
"404":
1021+
description: Component not found
1022+
schema:
1023+
$ref: '#/definitions/pkg_server.SetHealthyStatesResponse'
1024+
summary: Set components to healthy state
1025+
tags:
1026+
- components
9681027
/v1/info:
9691028
get:
9701029
consumes:

go.mod

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ require (
2929
github.com/stretchr/testify v1.11.1
3030
github.com/swaggo/files v1.0.1
3131
github.com/swaggo/gin-swagger v1.6.0
32-
github.com/swaggo/swag/v2 v2.0.0-rc4
32+
github.com/swaggo/swag v1.16.6
3333
github.com/urfave/cli v1.22.16
3434
go.uber.org/zap v1.27.0
3535
golang.org/x/crypto v0.51.0
@@ -120,8 +120,6 @@ require (
120120
github.com/smartystreets/assertions v1.2.0 // indirect
121121
github.com/smartystreets/goconvey v1.7.2 // indirect
122122
github.com/stretchr/objx v0.5.2 // indirect
123-
github.com/sv-tools/openapi v0.2.1 // indirect
124-
github.com/swaggo/swag v1.8.12 // indirect
125123
github.com/tailscale/go-winio v0.0.0-20231025203758-c4f33415bf55 // indirect
126124
github.com/tailscale/goupnp v1.0.1-0.20210804011211-c64d0f06ea05 // indirect
127125
github.com/tailscale/netlink v1.1.1-0.20240822203006-4d49adab4de7 // indirect
@@ -156,7 +154,6 @@ require (
156154
google.golang.org/genproto/googleapis/rpc v0.0.0-20251202230838-ff82c1b0f217 // indirect
157155
google.golang.org/protobuf v1.36.10 // indirect
158156
gopkg.in/inf.v0 v0.9.1 // indirect
159-
gopkg.in/yaml.v2 v2.4.0 // indirect
160157
gopkg.in/yaml.v3 v3.0.1 // indirect
161158
gotest.tools/v3 v3.5.1 // indirect
162159
k8s.io/klog/v2 v2.130.1 // indirect

go.sum

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -285,16 +285,12 @@ github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8
285285
github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
286286
github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U=
287287
github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U=
288-
github.com/sv-tools/openapi v0.2.1 h1:ES1tMQMJFGibWndMagvdoo34T1Vllxr1Nlm5wz6b1aA=
289-
github.com/sv-tools/openapi v0.2.1/go.mod h1:k5VuZamTw1HuiS9p2Wl5YIDWzYnHG6/FgPOSFXLAhGg=
290288
github.com/swaggo/files v1.0.1 h1:J1bVJ4XHZNq0I46UU90611i9/YzdrF7x92oX1ig5IdE=
291289
github.com/swaggo/files v1.0.1/go.mod h1:0qXmMNH6sXNf+73t65aKeB+ApmgxdnkQzVTAj2uaMUg=
292290
github.com/swaggo/gin-swagger v1.6.0 h1:y8sxvQ3E20/RCyrXeFfg60r6H0Z+SwpTjMYsMm+zy8M=
293291
github.com/swaggo/gin-swagger v1.6.0/go.mod h1:BG00cCEy294xtVpyIAHG6+e2Qzj/xKlRdOqDkvq0uzo=
294-
github.com/swaggo/swag v1.8.12 h1:pctzkNPu0AlQP2royqX3apjKCQonAnf7KGoxeO4y64w=
295-
github.com/swaggo/swag v1.8.12/go.mod h1:lNfm6Gg+oAq3zRJQNEMBE66LIJKM44mxFqhEEgy2its=
296-
github.com/swaggo/swag/v2 v2.0.0-rc4 h1:SZ8cK68gcV6cslwrJMIOqPkJELRwq4gmjvk77MrvHvY=
297-
github.com/swaggo/swag/v2 v2.0.0-rc4/go.mod h1:Ow7Y8gF16BTCDn8YxZbyKn8FkMLRUHekv1kROJZpbvE=
292+
github.com/swaggo/swag v1.16.6 h1:qBNcx53ZaX+M5dxVyTrgQ0PJ/ACK+NzhwcbieTt+9yI=
293+
github.com/swaggo/swag v1.16.6/go.mod h1:ngP2etMK5a0P3QBizic5MEwpRmluJZPHjXcMoj4Xesg=
298294
github.com/tailscale/go-winio v0.0.0-20231025203758-c4f33415bf55 h1:Gzfnfk2TWrk8Jj4P4c1a3CtQyMaTVCznlkLZI++hok4=
299295
github.com/tailscale/go-winio v0.0.0-20231025203758-c4f33415bf55/go.mod h1:4k4QO+dQ3R5FofL+SanAUZe+/QfeK0+OIuwDIRu2vSg=
300296
github.com/tailscale/goupnp v1.0.1-0.20210804011211-c64d0f06ea05 h1:4chzWmimtJPxRs2O36yuGRW3f9SYV+bMTTvMBI0EKio=

scripts/swag-gen.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ set -o nounset
1111
set -o errexit
1212

1313
# requires
14-
# go install github.com/swaggo/swag/v2/cmd/swag@latest
14+
# go install github.com/swaggo/swag/cmd/swag@1.16.6
1515

1616
# Generate swagger documentation
1717
# --dir . : Search from root directory to find all Go files

0 commit comments

Comments
 (0)