Skip to content

Commit 62d1085

Browse files
committed
chore(ws): update swaggo dependency to v1.16.6 and add required fields in OpenAPI definitions
- Updated swaggo/swag from v1.16.4 to v1.16.6 in go.mod and Makefile. - Added required fields to various OpenAPI definitions in docs.go and swagger.json for better validation via `--requiredByDefault` flag - `swag` `v1.16.6` contains a commit we authored to treat `json:omitempty` as `required: false`. That, in conjunction with `--requiredByDefault` flag, allows us to generate models with proper _required-ness_ Signed-off-by: Andy Stoneberg <[email protected]>
1 parent 639c24e commit 62d1085

File tree

5 files changed

+465
-6
lines changed

5 files changed

+465
-6
lines changed

workspaces/backend/Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,15 +74,15 @@ SWAG_DIRS := cmd,$(ALL_GO_DIRS_NO_CMD)
7474
.PHONY: swag
7575
swag: SWAGGER
7676
$(SWAGGER) fmt -g main.go -d $(SWAG_DIRS)
77-
$(SWAGGER) init --parseDependency -q -g main.go -d $(SWAG_DIRS) --output openapi --outputTypes go,json
77+
$(SWAGGER) init --parseDependency -q -g main.go -d $(SWAG_DIRS) --output openapi --outputTypes go,json --requiredByDefault
7878

7979
##@ Build
8080

8181
.PHONY: build
8282
build: fmt vet swag ## Build backend binary.
8383
go build -o bin/backend cmd/main.go
8484

85-
.PHONY: run
85+
.PHONY: run
8686
run: fmt vet swag ## Run a backend from your host.
8787
go run ./cmd/main.go --port=$(PORT)
8888

@@ -131,7 +131,7 @@ SWAGGER = $(LOCALBIN)/swag
131131
## Tool Versions
132132
ENVTEST_VERSION ?= release-0.19
133133
GOLANGCI_LINT_VERSION ?= v1.61.0
134-
SWAGGER_VERSION ?= v1.16.4
134+
SWAGGER_VERSION ?= v1.16.6
135135

136136
.PHONY: SWAGGER
137137
SWAGGER: $(SWAGGER)

workspaces/backend/go.mod

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ require (
1010
github.com/onsi/ginkgo/v2 v2.19.0
1111
github.com/onsi/gomega v1.33.1
1212
github.com/swaggo/http-swagger/v2 v2.0.2
13-
github.com/swaggo/swag v1.16.4
13+
github.com/swaggo/swag v1.16.6
1414
k8s.io/api v0.31.0
1515
k8s.io/apimachinery v0.31.0
1616
k8s.io/apiserver v0.31.0
@@ -80,6 +80,7 @@ require (
8080
go.uber.org/multierr v1.11.0 // indirect
8181
go.uber.org/zap v1.26.0 // indirect
8282
golang.org/x/exp v0.0.0-20230515195305-f3d0a9c9a5cc // indirect
83+
golang.org/x/mod v0.23.0 // indirect
8384
golang.org/x/net v0.35.0 // indirect
8485
golang.org/x/oauth2 v0.21.0 // indirect
8586
golang.org/x/sync v0.11.0 // indirect

workspaces/backend/go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,8 +128,8 @@ github.com/swaggo/files/v2 v2.0.2 h1:Bq4tgS/yxLB/3nwOMcul5oLEUKa877Ykgz3CJMVbQKU
128128
github.com/swaggo/files/v2 v2.0.2/go.mod h1:TVqetIzZsO9OhHX1Am9sRf9LdrFZqoK49N37KON/jr0=
129129
github.com/swaggo/http-swagger/v2 v2.0.2 h1:FKCdLsl+sFCx60KFsyM0rDarwiUSZ8DqbfSyIKC9OBg=
130130
github.com/swaggo/http-swagger/v2 v2.0.2/go.mod h1:r7/GBkAWIfK6E/OLnE8fXnviHiDeAHmgIyooa4xm3AQ=
131-
github.com/swaggo/swag v1.16.4 h1:clWJtd9LStiG3VeijiCfOVODP6VpHtKdQy9ELFG3s1A=
132-
github.com/swaggo/swag v1.16.4/go.mod h1:VBsHJRsDvfYvqoiMKnsdwhNV9LEMHgEDZcyVYX0sxPg=
131+
github.com/swaggo/swag v1.16.6 h1:qBNcx53ZaX+M5dxVyTrgQ0PJ/ACK+NzhwcbieTt+9yI=
132+
github.com/swaggo/swag v1.16.6/go.mod h1:ngP2etMK5a0P3QBizic5MEwpRmluJZPHjXcMoj4Xesg=
133133
github.com/x448/float16 v0.8.4 h1:qLwI1I70+NjRFUR3zs1JPUCgaCXSh3SW62uAKT1mSBM=
134134
github.com/x448/float16 v0.8.4/go.mod h1:14CWIYCyZA/cWjXOioeEpHeN/83MdbZDRQHoFcYsOfg=
135135
github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=

0 commit comments

Comments
 (0)