#270·dasel

Validate doesn't correctly validate yaml files per the spec.

Author: endophageCreated Dec 9, 2022Updated Dec 28, 2022
Labelsbug

Describe the bug The yaml spec requires that all keys in a mapping are unique (spec for reference: https://yaml.org/spec/1.2.2/). dasel validate does not catch this issue in a yaml file

To Reproduce Steps to reproduce the behavior:

$> cat <<EOF | tee tmp.yaml
key:
        foo: "bar"
key:
        foo: "baz"
EOF

$> dasel validate tmp.yaml
pass tmp.yaml

Expected behavior Validation should fail because of the duplicate key key at the top level.

Desktop (please complete the following information):

  • OS: MacOS
  • Version: development-v1.27.4-0.20221207223452-2761f5761361

Additional context This would be useful for validating kubernetes yaml files as every now and again somebody unintentionally redeclares a key in a map and kubernetes doesn't error, it just takes the last assignment.