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

Swagger UI Not Picking Up Generated swagger.json #12

Closed
azzuwan opened this issue Mar 29, 2019 · 2 comments
Closed

Swagger UI Not Picking Up Generated swagger.json #12

azzuwan opened this issue Mar 29, 2019 · 2 comments
Labels

Comments

@azzuwan
Copy link

azzuwan commented Mar 29, 2019

After annotating the Echo handlers, swag init is able to generate the swagger.json and swagger.yaml file in the docs folder. However when I browse to
http://localhost:8080/swagger/index.html
or
http://localhost:8080/swagger/v1/index.html

is still showing the default example items. Here is my setup:

// @title Nexlife Reward
// @version 1.0
// @description This is API spec for Nexlife Reward.
// @termsOfService https://tm.com.my/

// @contact.name Azzuwan Aziz
// @contact.url https://tm.com.my/
// @contact.email azzuwan@gmail.com

// @license.name TM Proprietary
// @license.url https://tm.com.my

// @host https://tm.com.my/
// @BasePath /v1

e.GET("/swagger/*", echoSwagger.WrapHandler)

// Create godoc
// @Summary Create a reward transaction
// @Description post a reward transaction
// @Tags transaction
// @Accept  json
// @Produce  json
// @Param user_id body model.transaction.Transaction.UserID true "ID of the user performing the transaction"
// @Param outlet_id body model.transation.Transaction.OutletID true "ID of the outlet the user is getting the reward"
// @Param point body model.transaction.Transaction.Point true "The value of the reward"
// @Success 200 {object} model.transaction.Transaction
// @Failure 400 {object} config.api.ResponseMessage
// @Failure 404 {object} config.api.ResponseMessage
// @Failure 500 {object} config.api.ResponseMessage
// @Router /transactions [post]
@easonlin404
Copy link
Member

easonlin404 commented Mar 29, 2019

Please check your docs imported path:

_ "/path_to_your/docs" // docs is generated by Swag CLI, you have to import it.

Do not using:

_ "github.com/swaggo/echo-swagger/example/docs" // docs is generated by Swag CLI, you have to import it.

@easonlin404
Copy link
Member

please open it if you still have problems.

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

No branches or pull requests

2 participants