types.reference: calculate reference field name correctly #48
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description of your changes
This is currently blocking https://github.com/upbound/official-providers/pull/457 to go through.
Fixes #45
I have:
make reviewableto ensure this PR is ready for review.backport release-x.ylabels to auto-backport this PR if necessary.How has this code been tested
In https://github.com/upbound/official-providers/pull/457 , I've confirmed that the ref tags are produced as
apiIdRefinstead ofapiidRef.However, there is another change in some resources in AWS. In cases we give custom ref and selector field names, like

VpcSecurityGroupIdRefsso that it doesn't end up beingVpcSecurityGroupIdsRefs, we run into errors since with the new calculation we always default to using.Camelproperty of the name, which is in line with the CRD type builder but those custom overrides are given as camel computed, i.e. given asVpcSecurityGroupIdRefsinstead ofVPCSecurityGroupIDRefs. What we end up with without this change is the following:With this change we produce the fields with
.Camelbut then the reference comments don't match. So, we should either opt for.CamelComputedfor all fields or change the custom overrides and I'm leaning towards the latter. Azure and GCP are not affected since apparently they haven't overridden any ref or selector fields.