Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions renderer/functions.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
5 changes: 4 additions & 1 deletion test/api/v1/guestbook_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions test/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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/
1 change: 1 addition & 0 deletions test/expected.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -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] +

Expand Down
1 change: 1 addition & 0 deletions test/expected.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 <br />UniqueItems: true <br /> |
| `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] <br /> |
| `digest` _string_ | Digest is the content-addressable identifier of the guestbook | | Pattern: `^sha256:[a-fA-F0-9]\{64\}$` <br /> |
Expand Down
1 change: 1 addition & 0 deletions test/hide.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 <br />UniqueItems: true <br /> |
| `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] <br /> |
| `digest` _string_ | Digest is the content-addressable identifier of the guestbook | | Pattern: `^sha256:[a-fA-F0-9]\{64\}$` <br /> |
Expand Down