swaggo / gin-swagger

gin middleware to automatically generate RESTful API documentation with Swagger 2.0.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Swagger comments in Go files are not recursively parsed by Swaggo

itoqsky opened this issue · comments

Issue Description
Swaggo fails to recursively parse Swagger comments in Go files when using the swag init command with multiple directories and the --parseDependency and --parseInternal flags. Only the comments in the main file specified with the -g flag are parsed, while the comments in other files within the specified directories are not considered.

commands I have run:
swag init -d cmd/app/ -g main.go --parseDependency --parseInternal

swag init -d cmd/app/,internal/transport/http/v1 -g main.go --parseDependency --parseInternal

All the commands above produces the same result

Files that contain swaggo comments are internal/transport/http/v1/auth.go, internal/transport/http/v1/trip.go, and cmd/app/main.go
Structure
Screenshot 2023-06-27 at 16 15 50

Results
Screenshot 2023-06-27 at 16 15 24

Comments in one of the files other than cmd/app/main.go
Screenshot 2023-06-27 at 16 16 10

swag version
e.g. 1.8.12

go version
e.g. 1.20.2

OS
OSX