Skip to content

Commit 485604a

Browse files
authored
Merge pull request #35 from jaypipes/doc-gen
add docstrings to CRD fields
2 parents 692d8c8 + 2059798 commit 485604a

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

templates/apis/crd.go.tpl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ import (
1616
// {{ .CRD.Kind }}Spec defines the desired state of {{ .CRD.Kind }}
1717
type {{ .CRD.Kind }}Spec struct {
1818
{{- range $fieldName, $field := .CRD.SpecFields }}
19+
{{- if $field.ShapeRef }}
20+
{{ $field.ShapeRef.Documentation }}
21+
{{- end }}
1922
{{ if $field.IsRequired }} // +kubebuilder:validation:Required
2023
{{ $field.Names.Camel }} {{ $field.GoType }} `json:"{{ $field.Names.CamelLower }}"`
2124
{{- else }} {{ $field.Names.Camel }} {{ $field.GoType }} `json:"{{ $field.Names.CamelLower }},omitempty"` {{ end }}
@@ -34,6 +37,9 @@ type {{ .CRD.Kind }}Status struct {
3437
// resource
3538
Conditions []*ackv1alpha1.Condition `json:"conditions"`
3639
{{- range $fieldName, $field := .CRD.StatusFields }}
40+
{{- if $field.ShapeRef }}
41+
{{ $field.ShapeRef.Documentation }}
42+
{{- end }}
3743
{{ $field.Names.Camel }} {{ $field.GoType }} `json:"{{ $field.Names.CamelLower }},omitempty"`
3844
{{- end }}
3945
}

0 commit comments

Comments
 (0)