ahmetb / gen-crd-api-reference-docs

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

linkForType and typeDisplayName wrong when a field is a slice of pointers #49

Closed makkes closed 2 years ago

makkes commented 2 years ago

Given this CRD in Go:

type GitRepositoryStatus struct {
[...]
    // Conditions holds the conditions for the GitRepository.
    // +optional
    Conditions []metav1.Condition `json:"conditions,omitempty"`

    // Artifact represents the last successful GitRepository reconciliation.
    // +optional
    Artifact *Artifact `json:"artifact,omitempty"`

    // IncludedArtifacts contains a list of the last successfully included
    // Artifacts as instructed by GitRepositorySpec.Include.
    // +optional
    IncludedArtifacts []*Artifact `json:"includedArtifacts,omitempty"`
}

the output of gen-crd-api-reference-docs is something like

<a href="#source.toolkit.fluxcd.io/v1beta2.*./api/v1beta2.Artifact">[]*./api/v1beta2.Artifact</a>

where the href part is rendered using linkForType .Type and the text is rendered using typeDisplayName .Type.

You can see this happening in the Flux API docs but also in other projects like vitess (search for "[]*").

makkes commented 2 years ago

Hu, looks like this is a duplicate of #36. @ahmetb is there a chance of cutting a release anytime soon?