-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Swag ignores package path if it starts with vendor #1880
Comments
As Would be happy to raise a PR to get this fixed. |
swag init --parseVendor |
@sdghchj I had tried this config but it didn't help with my issue. From what I could tell, the if !parseVendor && f.Name() == "vendor" || // ignore "vendor"
f.Name() == "docs" || // exclude docs
len(f.Name()) > 1 && f.Name()[0] == '.' && f.Name() != ".." { // exclude all hidden folder
return filepath.SkipDir
} But if the file name starts with "vendor" like in my case ("vendor-service"), the skip dir doesn't happen with or without the for _, info := range pkgDefs.files {
// ignore package path prefix with 'vendor' or $GOROOT,
// because the router info of api will not be included these files.
if strings.HasPrefix(info.PackagePath, "vendor") || strings.HasPrefix(info.Path, runtime.GOROOT()) {
continue
}
sortedFiles = append(sortedFiles, info)
} |
Hi @sdghchj, just following up on this issue. Let me know if there's anything else needed from my side. Thanks for your time! |
Describe the bug
I was running swag in my package -> vendor-service. But due to a vendor prefix check, all the files are being ignored and swagger docs are not generated.
To Reproduce
Steps to reproduce the behavior:
swag init
docs/swagger.json
does not have the swagger documentation dataExpected behavior
Swagger documentation should get generated similar to packages that don't start with "vendor"
Your swag version
v1.16.3
Your go version
1.21.6
The text was updated successfully, but these errors were encountered: