Description
Is your feature request related to a problem?
Similar to being able to ignore certain resources or field paths during code generation by specifying them under ignore.resource_names
or ignore.field_paths
in a generator_config.yaml
file, is it/would it be possible to introduce new fields at specified paths with specified types & tags?
For example, while using the crossplane pipeline, we can have referencer fields that enable us to refer to another custom resource via a label selector or its name. The use case would be to introduce these extra "referencer" fields during code generation.
Describe the solution you'd like
To be able to define extra fields at specified paths with specified types (possibly a type unknown to the code-generator pipeline) and with specified tags.
Describe alternatives you've considered
One alternative might be to have the code-generator ignore the type/field which we need to expand and manually define those types/fields. But we would then not be utilizing the code generator. There are also other alternatives for the problem at hand in the crossplane context but it seems to be extending the code-generator with such functionality (if not already provided) will open up other possibilities.
For more context, the original context of the problem is a CloudFront Distribution can have multiple CacheBehaviors, each of which can refer to a (possibly distinct) CachePolicy. Now if we have a Distribution CR and multiple CachePolicy CRs to which we would like to refer to from the Distribution, I think it makes most sense to introduce the references fields (e.g., CachePolicy CR name and/or label selector) in the generated CacheBehavior struct. What I'm planning to implement for this PR at the moment is to introduce an index field that will point to the CacheBehavior object in the cacheBehaviors
array for which a reference is being defined (assuming cachePolicyID
is optional for a CacheBehavior).
Thank you very much.