Describe the bug
A clear and concise description of what the bug is.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
A clear and concise description of what you expected to happen.
Screenshots
If applicable, add screenshots to help explain your problem.
swag version
1.6.7
go version
if use:
swag init --parseVendor true
output:
cannot find type definition: sql.NullTime.
I see issues 808, but I don't think I should modify Gorm's source code to add "swagger type"
@ruanhailiang I'm afraid we can't help you if you don't use/fill the bug template so we can use a use case example.
鎶撶揣瑙e喅杩欎釜闂
I have the same probleme using the web framework fiber. My struct model was like that,
type Movie struct {
title string `json:"title"`
tagline string `json:"tagline"`
released int `json:"released"`
}
then I put like that,
type Movie struct {
Title string `json:"title"`
Tagline string `json:"tagline"`
Released int `json:"released"`
}
@zhaojingadmin
鎶撶揣瑙e喅杩欎釜闂
Of course, this is an open-source project and contributions are always welcome.
I see issues 808, but I don't think I should modify Gorm's source code to add "swagger type"
Well, this is a code design pattern problem, not a swag problem. (You are exposing to the API some data that you are not in control of and this may lead to wrong output when external package API definitions may change)
Solution: You can use a DTO pattern to solve this issue.
Why: In real-life applications, you don't want to expose your database structure directly to the API for various security reasons so this pattern may be a good approach.
I am having the same issue:
2020/10/28 13:52:34 ParseComment error in file /file/path/.go **:cannot find type definition: gorm.Model
I am having the same issue:
2020/10/28 13:52:34 ParseComment error in file _/file/path/_.go **:cannot find type definition: gorm.Model
try swag init --parseDependency --parseInternal
I am having the same issue:
2020/10/28 13:52:34 ParseComment error in file _/file/path/_.go **:cannot find type definition: gorm.Modeltry
swag init --parseDependency --parseInternal
Wow thank you! This worked for me.
Most helpful comment
try
swag init --parseDependency --parseInternal