Generate client code based on the Swagger > OpenApi document #13
2
.gitignore
vendored
2
.gitignore
vendored
@ -3,6 +3,7 @@ dev.session.sql
|
||||
__debug_bin
|
||||
server
|
||||
.vscode
|
||||
openapi.json
|
||||
|
||||
# Binaries for programs and plugins
|
||||
*.exe
|
||||
@ -12,6 +13,7 @@ server
|
||||
*.dylib
|
||||
collector
|
||||
newsbot.db
|
||||
tmp/
|
||||
|
||||
# Test binary, built with `go test -c`
|
||||
*.test
|
||||
|
3756
api/api.gen.go
Normal file
3756
api/api.gen.go
Normal file
File diff suppressed because it is too large
Load Diff
6
api/client.yaml
Normal file
6
api/client.yaml
Normal file
@ -0,0 +1,6 @@
|
||||
# yaml-language-server: $schema=https://raw.githubusercontent.com/deepmap/oapi-codegen/HEAD/configuration-schema.json
|
||||
package: api
|
||||
output: api.gen.go
|
||||
generate:
|
||||
models: true
|
||||
client: true
|
11
makefile
11
makefile
@ -19,8 +19,13 @@ migrate-dev-down: ## revert sql migrations to dev db
|
||||
goose -dir "./internal/database/migrations" sqlite3 ./cmd/newsbot.db down
|
||||
|
||||
swag: ## Generates the swagger documentation with the swag tool
|
||||
~/go/bin/swag f
|
||||
~/go/bin/swag f -g cmd/server.go
|
||||
~/go/bin/swag init -g cmd/server.go
|
||||
go run tools/swaggertoopenapi/main.go
|
||||
oapi-codegen -config api/client.yaml docs/openapi.json
|
||||
mv api.gen.go api/
|
||||
|
||||
gensql: ## Generates SQL code with sqlc
|
||||
sqlc generate
|
||||
install-tools: ## Installs the required tools for this project
|
||||
go install github.com/swaggo/swag/cmd/swag@v1.8.1
|
||||
go install github.com/pressly/goose/v3/cmd/goose@latest
|
||||
go install github.com/oapi-codegen/oapi-codegen/v2/cmd/oapi-codegen@v2.3.0
|
||||
|
Loading…
Reference in New Issue
Block a user