Skip to content
This repository has been archived by the owner on Aug 1, 2021. It is now read-only.

Skip definitions for well known types. #7

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 11 additions & 9 deletions genswagger/template.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,18 +177,20 @@ func findNestedMessagesAndEnumerations(message *descriptor.Message, reg *descrip
fieldType := t.GetTypeName()
// If the type is an empty string then it is a proto primitive
if fieldType != "" {
if _, ok := m[fieldType]; !ok {
msg, err := reg.LookupMsg("", fieldType)
if err != nil {
enum, err := reg.LookupEnum("", fieldType)
if _, ok := wktSchemas[fieldType]; !ok {
if _, ok := m[fieldType]; !ok {
msg, err := reg.LookupMsg("", fieldType)
if err != nil {
panic(err)
enum, err := reg.LookupEnum("", fieldType)
if err != nil {
panic(err)
}
e[fieldType] = enum
continue
}
e[fieldType] = enum
continue
m[fieldType] = msg
findNestedMessagesAndEnumerations(msg, reg, m, e)
}
m[fieldType] = msg
findNestedMessagesAndEnumerations(msg, reg, m, e)
}
}
}
Expand Down