No operations defined in spec!
lesnoyleshyi opened this issue · comments
Hi! I can't generate documentation to my project.
My project's structure looks like that:
- cmd
- api
main.go
- docs
docs.go
swagger.json
swagger.yaml
- internal
- domain
- handlers
users.go
...
I have the next annotation in /cmd/api/main.go:
// @title API for my application
// @version 0.1
// @description It's made for testing purposes only
// @host localhost:8080
// @BasePAth /
func main() { ... }
And this is in /internal/handlers/users.go:
// Returns full user info godoc
// @Description Returns lists
// @Summary Returns full user info
// @Tags Lists
// @Accept json
// @Produce json
// @Success default {object} domain.Response
// @Failure default {object} domain.Response
// @Router /users/full [get]
func (h userHandler) getFullUserInfo(w http.ResponseWriter, r *http.Request) { ... }
I'm running
swag init -g cmd/api/main.go --parseDependency --parseInternal
from the root directory of the project.
I'm getting
> Generate swagger docs....
> Generate general API Info, search dir:./
> warning: failed to get package name in dir: ./, error: execute go list command, exit status 1, stdout:, stderr:no Go files in /Users/stycho/GolandProjects/my_life
> create docs.go at docs/docs.go
> create swagger.json at docs/swagger.json
> create swagger.yaml at docs/swagger.yaml
and "No operations defined in spec!" when I enter http://localhost:8080/swagger/index.html .
I've tried different --parseDepth
values, no --parseDependency
or --parseInternal
. I've also tried to make blank import in /internal/handlers/users.go - all this doesn't help.
I tried to google the solution, but haven't find anything. I can't understand what I'm doing wrong. Could you help me please?