Is there a way to use placeholders in yaml like this:
foo: &FOO
<<propname>>:
type: number
default: <<default>>
bar:
- *FOO
propname: "some_prop"
default: "some default"
This question is related to
yaml
computed-properties
indirection
template-variables
With Yglu Structural Templating, your example can be written:
foo: !()
!? $.propname:
type: number
default: !? $.default
bar:
!apply .foo:
propname: "some_prop"
default: "some default"
Disclaimer: I am the author or Yglu.
I suppose https://get-ytt.io/ would be an acceptable solution to your problem
Source: Stackoverflow.com