yaml anchor extend object in list

Viewed 58

Suppose I had a yaml that looked like

common_animals: &common_animals
  animals:
    - name: "bird"
      can_swim: false
    - name: "fish"
      can_swim: true
extended_animals:
  <<: *common_animals
  # here I want to add attribute to the bird object in the list `can_fly: true` 
  # here I want to add attribute to the fish object in the list `can_fly: false`

How might I achieve this?

0 Answers
Related