mirror of
https://github.com/zeromicro/go-zero.git
synced 2026-05-13 09:50:00 +08:00
fix(goctl): Fix getting swagger consume types (#4903)
This commit is contained in:
@@ -6,6 +6,7 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/go-openapi/spec"
|
"github.com/go-openapi/spec"
|
||||||
|
|
||||||
apiSpec "github.com/zeromicro/go-zero/tools/goctl/api/spec"
|
apiSpec "github.com/zeromicro/go-zero/tools/goctl/api/spec"
|
||||||
"github.com/zeromicro/go-zero/tools/goctl/internal/version"
|
"github.com/zeromicro/go-zero/tools/goctl/internal/version"
|
||||||
)
|
)
|
||||||
@@ -172,13 +173,12 @@ func sampleTypeFromGoType(ctx Context, tp apiSpec.Type) string {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func typeContainsTag(_ Context, structType apiSpec.DefineStruct, tag string) bool {
|
func typeContainsTag(ctx Context, structType apiSpec.DefineStruct, tag string) bool {
|
||||||
for _, field := range structType.Members {
|
members := expandMembers(ctx, structType)
|
||||||
tags, _ := apiSpec.Parse(field.Tag)
|
for _, member := range members {
|
||||||
for _, t := range tags.Tags() {
|
tags, _ := apiSpec.Parse(member.Tag)
|
||||||
if t.Key == tag {
|
if _, err := tags.Get(tag); err == nil {
|
||||||
return true
|
return true
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false
|
return false
|
||||||
|
|||||||
Reference in New Issue
Block a user