YAML Anchors and References
by
YAML Anchors and References
This is a post to help me remind how YAML Anchors and References work.
What?
In YAML you can make an Anchor:
- first_name: &me Michael
Now the Anchor me
contains Michael
. To refer to it, do something like this:
- first_name: &me Michael
give_name: *me
The value for given_name
has been set to Michael
.
You can also anchor to a whole list item:
people:
- person: &me
name: Michael
family_name: Buluma
No you may refer to the me
anchor:
access:
- person: *me
Now Michael
has access
.
Good to prevent dry.
tags: