Commit e661ce9
authored
ensure attribute fields have a ShapeRef (#383)
When attempting to generate the SNS controller, I was getting the following failure:
```
[jaypipes@thelio code-generator]$ make build-controller SERVICE=sns
building ack-generate ... ok.
==== building sns-controller ====
Copying common custom resource definitions into sns
Building Kubernetes API objects for sns
Generating deepcopy code for sns
Generating custom resource definitions for sns
Building service controller for sns
Error: template: /home/jaypipes/go/src/github.com/aws-controllers-k8s/code-generator/templates/pkg/resource/delta.go.tpl:34:3: executing "/home/jaypipes/go/src/github.com/aws-controllers-k8s/code-generator/templates/pkg/resource/delta.go.tpl" at <GoCodeCompare .CRD "delta" "a.ko" "b.ko" 1>: error calling GoCodeCompare: runtime error: invalid memory address or nil pointer dereference
make: *** [Makefile:41: build-controller] Error 1
```
This failure turned out to be due to attribute-based API fields that do not have a `type: XXX` generator.yaml configuration option specified (as they do in the sqs-controller's generator.yaml) would end up getting a `pkg/model.Field` object created that had a `nil` ShapeRef. This caused problems in certain Go code generator functions (such as `pkg/generate/code.CompareResource`) that rely on `Field.ShapeRef` being non-nil.
Signed-off-by: Jay Pipes <jaypipes@gmail.com>
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.1 parent 16f0e20 commit e661ce9
2 files changed
+18
-8
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
28 | 36 | | |
29 | 37 | | |
30 | 38 | | |
| |||
323 | 331 | | |
324 | 332 | | |
325 | 333 | | |
| 334 | + | |
326 | 335 | | |
327 | 336 | | |
328 | 337 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
18 | | - | |
19 | | - | |
20 | | - | |
21 | | - | |
22 | | - | |
23 | | - | |
24 | | - | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
25 | 26 | | |
26 | 27 | | |
27 | 28 | | |
| |||
39 | 40 | | |
40 | 41 | | |
41 | 42 | | |
42 | | - | |
| 43 | + | |
43 | 44 | | |
44 | 45 | | |
45 | 46 | | |
| |||
0 commit comments