Skip to content

Conversation

@jaypipes
Copy link
Collaborator

This patch completes earlier work that was done in the pkg/fieldpath
package that only uses a single dot notation to refer to a field with
type list or map within a field path.

We previously were using a double dot in field paths in generator.yaml
config files to refer to fields of type list or map. This was erroneous,
since referring to the field (not the value of the field) only
requires a single dot in order for the fieldpath to "locate" a field
within a path.

In this PR, we simplify and DRY up the inference code in
pkg/model/model.go's processing of "nested fields" so that the field
path added for all Field objects uses this single-dot notation only.

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.

This patch completes earlier work that was done in the `pkg/fieldpath`
package that only uses a single dot notation to refer to a *field* with
type *list* or *map* within a field path.

We previously were using a double dot in field paths in `generator.yaml`
config files to refer to fields of type list or map. This was erroneous,
since referring to the *field* (not the *value* of the field) only
requires a single dot in order for the fieldpath to "locate" a field
within a path.

In this PR, we simplify and DRY up the inference code in
`pkg/model/model.go`'s processing of "nested fields" so that the field
path added for all Field objects uses this single-dot notation only.

Signed-off-by: Jay Pipes <jaypipes@gmail.com>
Copy link
Contributor

@vijtrip2 vijtrip2 left a comment

Choose a reason for hiding this comment

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

Much cleaner now. Like it! LGTM.

@vijtrip2
Copy link
Contributor

Just curious that if we need to refer to value of a nested field in list/map, we will still use double-dot notation, correct?
(Late-Initialization code uses double-dot notation to copy field values for map types)

@jaypipes
Copy link
Collaborator Author

Just curious that if we need to refer to value of a nested field in list/map, we will still use double-dot notation, correct? (Late-Initialization code uses double-dot notation to copy field values for map types)

Maybe? I'd have to take a look at the code :)

Copy link
Contributor

@RedbackThomson RedbackThomson 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-bot ack-bot added the lgtm Indicates that a PR is ready to be merged. label Jan 11, 2022
@ack-bot
Copy link
Collaborator

ack-bot commented Jan 11, 2022

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: jaypipes, RedbackThomson, vijtrip2

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:
  • OWNERS [RedbackThomson,jaypipes,vijtrip2]

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

@ack-bot ack-bot merged commit b24c062 into aws-controllers-k8s:main Jan 12, 2022
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.

4 participants