You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When a type is declared in a dependency, swag init fails with "cannot find type definition: ..."
To successfully generate docs, dependencies must be vendored with go mod vendor and then use swag init -parseVendor
Is this intended/an unmentioned limitation?
Thanks!!
To Reproduce
Setup project: example.com/swagmodtest (within or outside of GOPATH): ~/swagmodtest/main.go or $GOPATH/example.com/swagmodtest/main.go
package main
import (
"fmt"
"go.mongodb.org/mongo-driver/bson/primitive"
)
// @id test
// @Router /test [get]
// @Success 200 {array} primitive.Binary
func main() {
var t primitive.Binary
fmt.Println(t)
}
go mod init example.com/swagmodtest
go mod tidy
swag init [...]/main.go :cannot find type definition: primitive.Binary
When a type is declared in a dependency,
swag init
fails with "cannot find type definition: ..."To successfully generate docs, dependencies must be vendored with
go mod vendor
and then useswag init -parseVendor
Is this intended/an unmentioned limitation?
Thanks!!
To Reproduce
~/swagmodtest/main.go
or$GOPATH/example.com/swagmodtest/main.go
[...]/main.go :cannot find type definition: primitive.Binary
Fix with vendoring
swagger.yaml:
Your swag version
Your go version
Desktop:
Additional context
The code builds/runs fine with go modules and no vendoring
The text was updated successfully, but these errors were encountered: