How can I provide a default value if a field is ONLY null? #2380
-
|
This seems like a basic question, but I can't seem to find a working solution. A search through the existing Q&A didn't yield the same question, so please excuse me if it's been asked before. I have a document that looks like: some-node:
enabled: falseI want to select the The problem is that the expression Some sources are suggesting instead using an It fails with an error like: $ yq '.some-node | if has("enabled") then .enabled else true end' document.yaml
Error: 1:14: invalid input text "if has(\"enabled\"..."I'm sure I'm overlooking something simple; this must be supported, right? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
|
Bit late, but for those looking for an answer you can do: |
Beta Was this translation helpful? Give feedback.
Bit late, but for those looking for an answer you can do: