go-zero icon indicating copy to clipboard operation
go-zero copied to clipboard

about swagger serve

Open MarcusBright opened this issue 1 month ago • 1 comments

Thanks for this amazing project. I am using goctl api swagger command to generate swagger file and notice that there is no comment or discribe about feild, defined in api file like PageData { //Total data count Total int64 `json:"total,example=1234"` //Number of items per page, consistent with the request Limit int `json:"limit,example=10"` //Data offset, consistent with the request Offset int `json:"offset,example=0,default=0"` }. And how to serve the swagger UI using go zero?

MarcusBright avatar Oct 27 '25 06:10 MarcusBright

For the first question, would you please describe what's the current generated content and what's your expected content?

For your second question about serving Swagger UI - that's not a go-zero feature. After generating the swagger.json file, you need to:

  • Use a separate tool like swagger-ui
  • Or serve it via a web server
  • Or use online tools like Swagger Editor

kevwan avatar Oct 27 '25 14:10 kevwan