Skip to content

Commit 6951473

Browse files
committed
BUG/MINOR: discovery: fix interface nil conversion
1 parent 2911c65 commit 6951473

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

misc/misc.go

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,14 @@ func DiscoverChildPaths(path string, spec json.RawMessage) (models.Endpoints, er
124124
for key, value := range paths {
125125
v := value.(map[string]interface{})
126126
if g, ok := v["get"].(map[string]interface{}); ok {
127-
title := g["summary"].(string)
128-
description := g["description"].(string)
127+
title := ""
128+
if titleInterface, ok := g["summary"]; ok && titleInterface != nil {
129+
title = titleInterface.(string)
130+
}
131+
description := ""
132+
if descInterface, ok := g["description"]; ok && descInterface != nil {
133+
description = descInterface.(string)
134+
}
129135

130136
if strings.HasPrefix(key, path) && key != path {
131137
resource := key[len(path):]

0 commit comments

Comments
 (0)