Skip to content

add docstrings to CRD fields #35

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 24, 2021
Merged
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
add docstrings to CRD fields
Uses the aws-sdk-go private/model/api.Shape.Documentation functionality
to write out docstrings for individual fields used in a CRD. Crossplane
was already doing this; ACK CRDs are now caught up.
  • Loading branch information
jaypipes committed Mar 20, 2021
commit 205979802e667edece37bfa29a272b21cfe22d66
6 changes: 6 additions & 0 deletions templates/apis/crd.go.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ import (
// {{ .CRD.Kind }}Spec defines the desired state of {{ .CRD.Kind }}
type {{ .CRD.Kind }}Spec struct {
{{- range $fieldName, $field := .CRD.SpecFields }}
{{- if $field.ShapeRef }}
{{ $field.ShapeRef.Documentation }}
{{- end }}
{{ if $field.IsRequired }} // +kubebuilder:validation:Required
{{ $field.Names.Camel }} {{ $field.GoType }} `json:"{{ $field.Names.CamelLower }}"`
{{- else }} {{ $field.Names.Camel }} {{ $field.GoType }} `json:"{{ $field.Names.CamelLower }},omitempty"` {{ end }}
Expand All @@ -34,6 +37,9 @@ type {{ .CRD.Kind }}Status struct {
// resource
Conditions []*ackv1alpha1.Condition `json:"conditions"`
{{- range $fieldName, $field := .CRD.StatusFields }}
{{- if $field.ShapeRef }}
{{ $field.ShapeRef.Documentation }}
{{- end }}
{{ $field.Names.Camel }} {{ $field.GoType }} `json:"{{ $field.Names.CamelLower }},omitempty"`
{{- end }}
}
Expand Down