-
Notifications
You must be signed in to change notification settings - Fork 115
Description
What problem are you facing?
For multiple code generation pipelines of upjet, we need to traverse the Terraform resource schema to extract information about the resources (to calculate field names, to generate references, etc.). The main site that does this object (schema) traversal as of now is the CRD generator pipeline's types.buildResource function. However, for generating example manifests with the pipeline being introduced with #4, we also need to extract information from the same object structure (schema). In #4, we have cached the information needed for the example generation pipeline with types.Transformation objects while traversing the schema for CRD generation, to further utilize it in the new pipeline being introduced.
Currently for implementing new pipelines, we need to either duplicate the schema traversal logic, or as stated above, cache the needed information extracted from an existing pipeline to utilize it in a new pipeline.
How could Terrajet help solve your problem?
We may consider implementing a pattern like the visitor pattern to abstract the schema object traversal from the pipeline implementation itself. This would allow us to share the recursive traversal logic currently implemented in types.buildResource and types.buildSchema functions between the pipelines by abstracting the schema traversal logic from the pipeline traversal logic.