-
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
Version 1.6.9 - cannot find type definition #817
Comments
Same here: type used in
With 1.6.9, I get "ParseComment error in file internal/handlers/headers.go :cannot find type definition: http.Header". If I change the annotation to
which is the definition of At the moment I've reverted to 1.6.7 Edit: ok, the answer is actually in closed issue #808 Parsing of external types has been disabled, because it was an incomplete feature, as far as I understand, it went only one level deep, and when the external type was a field of an internal struct, it also wouldn't work. Apart from the fact, that this is a pretty breaking change and obviously a lot of people missed the issue, what exactly is the supported way to handle my situation? I want to return an external type. I can't annotate anything with Basically |
For those who need a quick solution: |
I'm here with same problem. |
swag > 1.67 version need add --parseDependency swaggo/swag#817
Same problem, this seems to be a pretty breaking change that also possibly conflicts with the examples in the repository currently. Downgrading to 1.6.7 caused other issues. |
@amanessinger @agzuniverse @psyhonut
|
@amanessinger
You need to run:
|
En, the usage of --parseDependency and --parseInternal needs to be included in readme.md in future, I think. |
@sdghchj |
thanks! it works for me |
Unfortunately doesn't really work for me. That is how I set up the route for the swagger documentation after hitting app.Get("/swagger/*", swagger.New(swagger.Config{
URL: "/swagger/doc.json",
DeepLinking: false,
})) Serves correctly with For me the |
swag init --parseDependency --parseInternal works for my |
@Abszissex I add |
|
It work for me, thx! |
swag init --parseDependency --parseInternal |
golang:1.16 |
I meet the same question: // @Success 200 {object} srv.Result{data=respmodel.AnswerItem} and swag init error: cannot find type definition: respmodel.AnswerItem I tried finally, I find the true reason, There has some same name struct in respmodel packages。
I changed those names, it works。 hope this has helped. |
it is quite difficult to make it find type definitions swaggo/swag#817
This solved the issue for me. Thank you @lixd |
Thanks a lot!!!! |
Go version : 1.15.2 (1.15.3 gives installation error)
Swag version: 1.6.9
Error : ParseComment error in file app/services/api/v1/models.go :cannot find type definition: models.ResponseType
Import:
import models "rest-api/app/models/api/v1"
Usage :
// @failure 400 {object} models.ResponseType
This works fine on version 1.6.8.
The text was updated successfully, but these errors were encountered: