need to run `swag init` every time to update schema
Closed this issue · 4 comments
KunalSin9h commented
When i run my app using go run main.go serve
(i am using cobra cli framework) then the swagger.json is not update with the updated code (comments). I have to run swag init everytime.
Kerod-Fresenbet-Gebremedhin2660 commented
@KunalSin9h This is clearly outlined in the documentation. You could use any number of task runners to run the swagger generation before running the server.
KunalSin9h commented
thanks,
task runners? i am using husky
for generating swagger specs before commiting.
but i manually run swag --init
before running the application.
Kerod-Fresenbet-Gebremedhin2660 commented
@KunalSin9h you could use a makefile for instance and create an instruction to run swag init first before running go as so.
run:
@swag init
@go run main.go
KunalSin9h commented