diff --git a/renderer/functions.go b/renderer/functions.go index ceb16a3..c1e50b2 100644 --- a/renderer/functions.go +++ b/renderer/functions.go @@ -71,14 +71,14 @@ func (f *Functions) SafeID(id string) string { } func (f *Functions) LinkForType(t *types.Type) (link string, local bool) { - if f.IsKubeType(t) { - return f.LinkForKubeType(t), false - } - if kt, ok := f.IsKnownType(t); ok { return f.LinkForKnownType(kt), false } + if f.IsKubeType(t) { + return f.LinkForKubeType(t), false + } + if t.IsBasic() || t.Imported { return "", false } diff --git a/test/api/v1/guestbook_types.go b/test/api/v1/guestbook_types.go index f6a2796..a6a9aee 100644 --- a/test/api/v1/guestbook_types.go +++ b/test/api/v1/guestbook_types.go @@ -19,6 +19,7 @@ package v1 import ( "github.com/elastic/crd-ref-docs/api/common" + "k8s.io/apimachinery/pkg/api/resource" apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -100,7 +101,9 @@ type GuestbookSpec struct { Headers []GuestbookHeader `json:"headers,omitempty"` // CertificateRef is a reference to a secret containing a certificate CertificateRef gwapiv1b1.SecretObjectReference `json:"certificateRef"` - String common.CommonString `json:"str"` + // Quantity is a k8s type, but config.yaml overrides its link + Quantity resource.Quantity `json:"quantity,omitempty"` + String common.CommonString `json:"str"` // Enumeration is an example of an aliased enumeration type Enumeration MyEnum `json:"enum"` // Digest is the content-addressable identifier of the guestbook diff --git a/test/config.yaml b/test/config.yaml index 2ebede7..342fc73 100644 --- a/test/config.yaml +++ b/test/config.yaml @@ -18,3 +18,6 @@ render: - name: SecretObjectReference package: sigs.k8s.io/gateway-api/apis/v1beta1 link: https://gateway-api.sigs.k8s.io/references/spec/#gateway.networking.k8s.io/v1beta1.SecretObjectReference + - name: Quantity + package: k8s.io/apimachinery/pkg/api/resource + link: https://kubernetes.io/docs/reference/kubernetes-api/common-definitions/quantity/ diff --git a/test/expected.asciidoc b/test/expected.asciidoc index db6cd7e..7ead35c 100644 --- a/test/expected.asciidoc +++ b/test/expected.asciidoc @@ -243,6 +243,7 @@ GuestbookSpec defines the desired state of Guestbook. UniqueItems: true + | *`certificateRef`* __link:https://gateway-api.sigs.k8s.io/references/spec/#gateway.networking.k8s.io/v1beta1.SecretObjectReference[$$SecretObjectReference$$]__ | CertificateRef is a reference to a secret containing a certificate + | | +| *`quantity`* __link:https://kubernetes.io/docs/reference/kubernetes-api/common-definitions/quantity/[$$Quantity$$]__ | Quantity is a k8s type, but config.yaml overrides its link + | | | *`str`* __xref:{anchor_prefix}-github-com-elastic-crd-ref-docs-api-common-commonstring[$$CommonString$$]__ | | | | *`enum`* __xref:{anchor_prefix}-github-com-elastic-crd-ref-docs-api-v1-myenum[$$MyEnum$$]__ | Enumeration is an example of an aliased enumeration type + | | Enum: [MyFirstValue MySecondValue] + diff --git a/test/expected.md b/test/expected.md index 5c739b5..f5fd41e 100644 --- a/test/expected.md +++ b/test/expected.md @@ -182,6 +182,7 @@ _Appears in:_ | `selector` _[LabelSelector](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.25/#labelselector-v1-meta)_ | Selector selects something | | | | `headers` _[GuestbookHeader](#guestbookheader) array_ | Headers contains a list of header items to include in the page | | MaxItems: 10
UniqueItems: true
| | `certificateRef` _[SecretObjectReference](https://gateway-api.sigs.k8s.io/references/spec/#gateway.networking.k8s.io/v1beta1.SecretObjectReference)_ | CertificateRef is a reference to a secret containing a certificate | | | +| `quantity` _[Quantity](https://kubernetes.io/docs/reference/kubernetes-api/common-definitions/quantity/)_ | Quantity is a k8s type, but config.yaml overrides its link | | | | `str` _[CommonString](#commonstring)_ | | | | | `enum` _[MyEnum](#myenum)_ | Enumeration is an example of an aliased enumeration type | | Enum: [MyFirstValue MySecondValue]
| | `digest` _string_ | Digest is the content-addressable identifier of the guestbook | | Pattern: `^sha256:[a-fA-F0-9]\{64\}$`
| diff --git a/test/hide.md b/test/hide.md index 873d536..5b46407 100644 --- a/test/hide.md +++ b/test/hide.md @@ -181,6 +181,7 @@ _Appears in:_ | `selector` _[LabelSelector](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.25/#labelselector-v1-meta)_ | Selector selects something | | | | `headers` _[GuestbookHeader](#guestbookheader) array_ | Headers contains a list of header items to include in the page | | MaxItems: 10
UniqueItems: true
| | `certificateRef` _[SecretObjectReference](https://gateway-api.sigs.k8s.io/references/spec/#gateway.networking.k8s.io/v1beta1.SecretObjectReference)_ | CertificateRef is a reference to a secret containing a certificate | | | +| `quantity` _[Quantity](https://kubernetes.io/docs/reference/kubernetes-api/common-definitions/quantity/)_ | Quantity is a k8s type, but config.yaml overrides its link | | | | `str` _[CommonString](#commonstring)_ | | | | | `enum` _[MyEnum](#myenum)_ | Enumeration is an example of an aliased enumeration type | | Enum: [MyFirstValue MySecondValue]
| | `digest` _string_ | Digest is the content-addressable identifier of the guestbook | | Pattern: `^sha256:[a-fA-F0-9]\{64\}$`
|