You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
collect Field structs for members of structures (#258)
When inferring the structure of a CRD and its fields, we create a
`pkg/model.Field` struct for each *top-level* field in the CRD's Spec or
Status. The `pkg/model.GetCRDs()` function ends up calling
`pkg/model.CRD:AddSpecField()` and `pkg/model.CRD:AddStatusField()` for
those field definitions that the API inference stage of the generation
pipeline discovers in the aws-sdk-go API model.
Because we were creating `pkg/model.Field` objects for only the
top-level fields in Spec and Status and the `pkg/model.Field` object is
what was tied to a `pkg/generate/config.FieldConfig` object, this meant
that only the top-level field definitions were able to be *configured*
via the generator.yaml file. This is a problem for more complex APIs
like EC2 which have resources with top-level fields that are structures
themselves. We were not able to configure nested fields properly because
we were not actually constructing a `pkg/model.Field` object for these
nested fields.
This PR enhances the API inference process inside the code generator to
detect when a new `pkg/model.Field` refers to an
`aws-sdk-go/private/model.Shape` that is of type "structure" and recurse
through that Shape's MemberRefs collection, building a map of
`pkg/model.Field` objects for each member field along with a fieldpath
that allows these nested struct member fields to later be "found" by the
code generator.
Issue: aws-controllers-k8s/community#1100
Signed-off-by: Jay Pipes <[email protected]>
By submitting this pull request, I confirm that my contribution is made
under the terms of the Apache 2.0 license.
0 commit comments