Commit 959eaa5
authored
Support custom nested fields that have path that contains types other than struct (#538)
Issue #, if available:
Description of changes:
Say we want to overwrite a nested field type e.g. for `WAFv2` controller (this is needed due to a cyclic dependency):
```
resources:
RuleGroup:
Rules.Statement.AndStatement:
type: string
```
Currently, the [overwrite code logic](https://github.com/aws-controllers-k8s/code-generator/blob/62466746500d0c01fcfa8e8e3ca6abd9386e4687/pkg/model/crd.go#L660-L687) does not work for the above scenario and it returns the following error:
```
Expected parent field to be of type structure, but found list
```
This happens because `Rules` is not of type `struct`, but `[]struct`, and the referenced code logic requires that all fields within the path (i.e. `Rules` and `Statement` to be of type `struct`).
This PR relaxes the logic to allow fields within the path to also be of types `[]struct` and `map[]struct`.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.1 parent bdf3f26 commit 959eaa5
1 file changed
+25
-12
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
656 | 656 | | |
657 | 657 | | |
658 | 658 | | |
659 | | - | |
660 | | - | |
661 | | - | |
662 | | - | |
| 659 | + | |
| 660 | + | |
663 | 661 | | |
664 | 662 | | |
665 | 663 | | |
666 | | - | |
667 | | - | |
668 | | - | |
669 | | - | |
| 664 | + | |
| 665 | + | |
| 666 | + | |
| 667 | + | |
| 668 | + | |
| 669 | + | |
| 670 | + | |
| 671 | + | |
| 672 | + | |
| 673 | + | |
| 674 | + | |
| 675 | + | |
670 | 676 | | |
671 | 677 | | |
672 | 678 | | |
| |||
676 | 682 | | |
677 | 683 | | |
678 | 684 | | |
679 | | - | |
680 | 685 | | |
681 | | - | |
682 | | - | |
683 | | - | |
| 686 | + | |
| 687 | + | |
| 688 | + | |
| 689 | + | |
| 690 | + | |
684 | 691 | | |
685 | 692 | | |
| 693 | + | |
| 694 | + | |
| 695 | + | |
| 696 | + | |
| 697 | + | |
| 698 | + | |
686 | 699 | | |
687 | 700 | | |
688 | 701 | | |
| |||
0 commit comments