@@ -300,6 +300,16 @@ func (t *apiType) Link() string {
300
300
return ""
301
301
}
302
302
303
+ func stripPrefix (s string ) string {
304
+ // strip prefix if desired
305
+ for _ , prefix := range config .StripPrefix {
306
+ if strings .HasPrefix (s , prefix ) {
307
+ s = strings .Replace (s , prefix , "" , 1 )
308
+ }
309
+ }
310
+ return s
311
+ }
312
+
303
313
// DisplayName deterimines how a type is displayed in the docs.
304
314
func (t * apiType ) DisplayName () string {
305
315
s := t .typeId ()
@@ -318,18 +328,14 @@ func (t *apiType) DisplayName() string {
318
328
types .Slice ,
319
329
types .Builtin :
320
330
// noop
321
- case types .Map : // return original name
322
- return t .Name .Name
331
+ case types .Map :
332
+ elm := apiType {* t .Elem }
333
+ return strings .Join ([]string {"map[" , stripPrefix (t .Key .Name .Name ), "]" , elm .DisplayName ()}, "" )
323
334
default :
324
335
klog .Warningf ("Type '%s' has kind='%v' which is unhandled" , t .Name , t .Kind )
325
336
}
326
337
327
- // strip prefix if desired
328
- for _ , prefix := range config .StripPrefix {
329
- if strings .HasPrefix (s , prefix ) {
330
- s = strings .Replace (s , prefix , "" , 1 )
331
- }
332
- }
338
+ s = stripPrefix (s )
333
339
334
340
if t .Kind == types .Slice {
335
341
s = "[]" + s
0 commit comments