ahmetb / gen-crd-api-reference-docs

API Reference Docs generator for Kubernetes CRDs (used by Knative, Kubeflow and others)
Apache License 2.0
307 stars 99 forks source link

Incorrect display of map types #64

Closed theunrepentantgeek closed 1 month ago

theunrepentantgeek commented 1 year ago

In the generated documentation for Azure Service Operator (ASO), we noticed that the display names of fields with a map type weren't being simplified the same way that other types are.

For example,

On VirtualMachineIdentity_ARM we see a map type with a relative path for the type of map values:

userAssignedIdentities map[string]./api/compute/v1api20220301.UserAssignedIdentityDetails_ARM

We expected this to display with just the name of the type, given it's in the current package:

userAssignedIdentities map[string]UserAssignedIdentityDetails_ARM

Slice properties already use this simplified form - several examples can be seen on VirtualMachineInstanceView_STATUS_ARM:

disks []DiskInstanceView_STATUS_ARM

extensions []VirtualMachineExtensionInstanceView_STATUS_ARM

I've traced the cause of this to the typeDisplayName() function.