Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
KunalSin9h opened this issue Dec 9, 2023 · 4 comments
Closed

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

KunalSin9h opened this issue Dec 9, 2023 · 4 comments

Comments

@KunalSin9h
Copy link
Contributor

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
Copy link

Kerod-Fresenbet-Gebremedhin2660 commented Dec 11, 2023

@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
Copy link
Contributor Author

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

@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
Copy link
Contributor Author

thanks @Kerod-Fresenbet-Gebremedhin2660

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants