Add multiple inheritance and mixins for components. Add metadata.component
and metadata.inherits
settings
#101
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.
what
metadata.component
andmetadata.inherits
settingswhy
Allow a component to inherit from many base components or mixins, each base component having its own inheritance chain, effectively making it an inheritance matrix. It uses a method similar to Method Resolution Order (MRO), which is how Python supports multiple inheritance.
metadata.component
points to the component implementation (e.g. incomponents/terraform
folder).It does not specify inheritance. It overrides the deprecated top-level
component
attribute, which performed two roles: 1) point to a component implementation; 2) specify a base component to inherit from (only one) .metadata.inherits
is a list of component or mixins names from which the current component inherits. In the case of multiple base components, it is processed left to right, in the order by which it was declared.For example:
metadata.inherit: [componentA, componentB]
will deep-merge all the base components ofcomponentA
(each component overriding its base), then all the base components ofcomponentB
(each component overriding its base), then the two results are deep-merged together (componentB
inheritance chain will override values fromcomponentA
inheritance chain).related
test
Given this component config
Results in