diff --git a/processor/processor.go b/processor/processor.go index ceeaf98..2da3a71 100644 --- a/processor/processor.go +++ b/processor/processor.go @@ -377,6 +377,7 @@ func (p *processor) loadType(pkg *loader.Package, t gotypes.Type, depth int) *ty if typeDef.UnderlyingType != nil && typeDef.UnderlyingType.Kind == types.BasicKind { typeDef.Package = "" } + return typeDef case *gotypes.Slice: typeDef.Kind = types.SliceKind @@ -384,6 +385,7 @@ func (p *processor) loadType(pkg *loader.Package, t gotypes.Type, depth int) *ty if typeDef.UnderlyingType != nil && typeDef.UnderlyingType.Kind == types.BasicKind { typeDef.Package = "" } + return typeDef case *gotypes.Array: typeDef.Kind = types.ArrayKind @@ -391,6 +393,7 @@ func (p *processor) loadType(pkg *loader.Package, t gotypes.Type, depth int) *ty if typeDef.UnderlyingType != nil && typeDef.UnderlyingType.Kind == types.BasicKind { typeDef.Package = "" } + return typeDef case *gotypes.Map: typeDef.Kind = types.MapKind diff --git a/test/api/v1/guestbook_types.go b/test/api/v1/guestbook_types.go index 487bcfb..c24df25 100644 --- a/test/api/v1/guestbook_types.go +++ b/test/api/v1/guestbook_types.go @@ -29,6 +29,8 @@ type GuestbookSpec struct { Entries []GuestbookEntry `json:"entries,omitempty"` // Selector selects something Selector metav1.LabelSelector `json:"selector,omitempty"` + // Headers contains a list of header items to include in the page + Headers []GuestbookHeader `json:"headers,omitempty"` } // GuestbookEntry defines an entry in a guest book. @@ -46,6 +48,9 @@ type GuestbookStatus struct { Status string `json:"status"` } +// GuestbookHeaders are strings to include at the top of a page. +type GuestbookHeader string + // +kubebuilder:object:root=true // Guestbook is the Schema for the guestbooks API. diff --git a/test/api/v1/zz_generated.deepcopy.go b/test/api/v1/zz_generated.deepcopy.go index ae2a760..bde5968 100644 --- a/test/api/v1/zz_generated.deepcopy.go +++ b/test/api/v1/zz_generated.deepcopy.go @@ -116,6 +116,11 @@ func (in *GuestbookSpec) DeepCopyInto(out *GuestbookSpec) { } } in.Selector.DeepCopyInto(&out.Selector) + if in.Headers != nil { + in, out := &in.Headers, &out.Headers + *out = make([]GuestbookHeader, len(*in)) + copy(*out, *in) + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GuestbookSpec. diff --git a/test/expected.asciidoc b/test/expected.asciidoc index 276ae3a..571a98f 100644 --- a/test/expected.asciidoc +++ b/test/expected.asciidoc @@ -43,7 +43,7 @@ Guestbook is the Schema for the guestbooks API. [id="{anchor_prefix}-github-com-elastic-crd-ref-docs-api-v1-guestbookentry"] ==== GuestbookEntry - +GuestbookEntry defines an entry in a guest book. .Appears In: **** @@ -59,6 +59,18 @@ Guestbook is the Schema for the guestbooks API. |=== +[id="{anchor_prefix}-github-com-elastic-crd-ref-docs-api-v1-guestbookheader"] +==== GuestbookHeader (string) + + + +.Appears In: +**** +- xref:{anchor_prefix}-github-com-elastic-crd-ref-docs-api-v1-guestbookspec[$$GuestbookSpec$$] +**** + + + [id="{anchor_prefix}-github-com-elastic-crd-ref-docs-api-v1-guestbooklist"] ==== GuestbookList @@ -93,6 +105,7 @@ GuestbookSpec defines the desired state of Guestbook. | *`page`* __integer__ | Page indicates the page number | *`entries`* __xref:{anchor_prefix}-github-com-elastic-crd-ref-docs-api-v1-guestbookentry[$$GuestbookEntry$$] array__ | Entries contain guest book entries for the page | *`selector`* __link:https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.15/#labelselector-v1-meta[$$LabelSelector$$]__ | Selector selects something +| *`headers`* __xref:{anchor_prefix}-github-com-elastic-crd-ref-docs-api-v1-guestbookheader[$$GuestbookHeader$$] array__ | Headers contains a list of header items to include in the page |=== diff --git a/types/types.go b/types/types.go index ce819e1..b3a1542 100644 --- a/types/types.go +++ b/types/types.go @@ -115,7 +115,7 @@ func (t *Type) IsBasic() bool { switch t.Kind { case BasicKind: return true - case AliasKind, SliceKind, ArrayKind, PointerKind: + case SliceKind, ArrayKind, PointerKind: return t.UnderlyingType != nil && t.UnderlyingType.IsBasic() case MapKind: return t.KeyType != nil && t.KeyType.IsBasic() && t.ValueType != nil && t.ValueType.IsBasic()