I have fields with example values.
EDIT: there are other nodes at the root level (siblings of fields) that I need to retain, too.
- If a value is empty, I want to remove the parent list item
- If there are no examples left, I want to remove the entire examples node
- The examples may have other fields of their own, but I just want to follow the two rules above no matter what
Input
project: people_ages
fields:
first_name:
examples:
- value: Jon
comment: A very common name
last_name:
examples:
- value: ''
comment: Where is his last name?
age:
examples:
- value: 22
comment: Just got out of college
- value:
comment: Not sure about his age
Desired output
project: people_ages
fields:
first_name:
examples:
- value: Jon
comment: A very common name
last_name:
age:
examples:
- value: 22
comment: Just got out of college
Using Go version of yq - mikefarah/yq