gofiber / swagger

🧬 fiber middleware to automatically generate RESTful API documentation with Swagger
MIT License
402 stars 28 forks source link

need to run `swag init` every time to update schema #73

Closed KunalSin9h closed 9 months ago

KunalSin9h commented 9 months ago

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 9 months ago

@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 9 months ago

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 9 months ago

@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 9 months ago

thanks @Kerod-Fresenbet-Gebremedhin2660