Skip to content

Support custom nested fields that have path that contains types other than struct #538

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

Conversation

TiberiuGC
Copy link
Contributor

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 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.

@ack-prow ack-prow bot requested review from a-hilaly and jlbutler August 9, 2024 11:31
Copy link
Member

@a-hilaly a-hilaly left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍
/lgtm

@ack-prow ack-prow bot added the lgtm Indicates that a PR is ready to be merged. label Aug 14, 2024
Copy link

ack-prow bot commented Aug 14, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: a-hilaly, TiberiuGC

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@ack-prow ack-prow bot added the approved label Aug 14, 2024
@a-hilaly
Copy link
Member

/retest

@ack-prow ack-prow bot merged commit 959eaa5 into aws-controllers-k8s:main Aug 14, 2024
17 of 18 checks passed
ack-prow bot pushed a commit that referenced this pull request Aug 16, 2024
Issue #, if available:

Description of changes:
New unit tests cover code-gen bugfixes and improvements, pre-requisites for WAFv2 controller:
- #539
- #538
- #536

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved lgtm Indicates that a PR is ready to be merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants