updated make to allow me to convert swagger into a api client with some tools
This commit is contained in:
parent
fa1e762f51
commit
3cf6afb39c
2
.gitignore
vendored
2
.gitignore
vendored
@ -3,6 +3,7 @@ dev.session.sql
|
|||||||
__debug_bin
|
__debug_bin
|
||||||
server
|
server
|
||||||
.vscode
|
.vscode
|
||||||
|
openapi.json
|
||||||
|
|
||||||
# Binaries for programs and plugins
|
# Binaries for programs and plugins
|
||||||
*.exe
|
*.exe
|
||||||
@ -12,6 +13,7 @@ server
|
|||||||
*.dylib
|
*.dylib
|
||||||
collector
|
collector
|
||||||
newsbot.db
|
newsbot.db
|
||||||
|
tmp/
|
||||||
|
|
||||||
# Test binary, built with `go test -c`
|
# Test binary, built with `go test -c`
|
||||||
*.test
|
*.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
|
goose -dir "./internal/database/migrations" sqlite3 ./cmd/newsbot.db down
|
||||||
|
|
||||||
swag: ## Generates the swagger documentation with the swag tool
|
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/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
|
install-tools: ## Installs the required tools for this project
|
||||||
sqlc generate
|
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