Skip to content

Commit

Permalink
Fix panic in code generator when generating lambda controller (aws-co…
Browse files Browse the repository at this point in the history
…ntrollers-k8s#384)

The recent patch ([PR 383](aws-controllers-k8s#383)) introduced a regression that caused the
code generator to panic when generating the lambda controller.
This commit addresses the issue by adding a check to ensure that
the shapeRef reference is not nil before accessing the
Documentation field. This prevents the panic from occurring and
allows the code generator to function correctly.

By submitting this pull request, I confirm that my contribution is
made under the terms of the Apache 2.0 license.
  • Loading branch information
a-hilaly authored Dec 19, 2022
1 parent e661ce9 commit 8d843f4
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion templates/apis/crd.go.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import (
{{ .CRD.Documentation }}
type {{ .CRD.Kind }}Spec struct {
{{ range $fieldName, $field := .CRD.SpecFields }}
{{ if $field.ShapeRef.Documentation -}}
{{ if $field.ShapeRef -}}
{{ $field.ShapeRef.Documentation }}
{{ end -}}
{{- if and ($field.IsRequired) (not $field.HasReference) -}}
Expand Down

0 comments on commit 8d843f4

Please sign in to comment.