js-yaml
js-yaml copied to clipboard
YAML merge tag results in bad indentation of a mapping entry
I'm trying to process a Kubernetes CRD YAML file, and js-yaml is failing when trying to parse it. The error is:
Error: YAMLException: bad indentation of a mapping entry (279:29)
276 | - ""
277 | - "RollingUpdate"
278 | troubleshoot:
279 | !!merge <<: *TypeStringBool
-----------------------------------^
280 | description: "allows troubleshoot Pods du ...
281 | namespaceDomainPattern:
Error: bad indentation of a mapping entry (279:29)
I've extracted the problematic section:
troubleshoot:
!!merge <<: *TypeStringBool
description: "allows troubleshoot Pods during CrashLoopBack state, when you apply wrong configuration, `clickhouse-server` wouldn't startup"
The TypeStringBool
is defined earlier in the same YAML:
stop: &TypeStringBool
type: string
description: |
Allow stop all ClickHouse clusters described in current chi.
Stop mechanism works as follows:
- When `stop` is `1` then setup `Replicas: 0` in each related to current `chi` StatefulSet resource, all `Pods` and `Service` resources will desctroy, but PVCs still live
- When `stop` is `0` then `Pods` will created again and will attach retained PVCs and `Service` also will created again
enum:
# List StringBoolXXX constants from model
- ""
- "0"
- "1"
- "False"
- "false"
- "True"
- "true"
- "No"
- "no"
- "Yes"
- "yes"
- "Off"
- "off"
- "On"
- "on"
- "Disable"
- "disable"
- "Enable"
- "enable"
- "Disabled"
- "disabled"
- "Enabled"
- "enabled"
I've tried it with other YAML parsers and they seem to handle it fine.