homeport / dyff

/ˈdʏf/ - diff tool for YAML files, and sometimes JSON
MIT License
1.28k stars 60 forks source link

Duplicate keys in map lead to dyff finding a diff even if there's not #354

Open Alan-pad opened 5 months ago

Alan-pad commented 5 months ago

Hey !

Context

We're using dyff to check the difference between 2 rendered Helm template. With Helm you can end up with duplicate keys in a map if for some reason you set some default value in a map that can later be overriden through user input, those duplicate keys lead to dyff finding a diff where there should be none.

Issue

Rendered Helm file

# test.yaml
test:
  element1: test
  element1: test2

Dyff command

dyff between test.yaml test.yaml

Dyff result

     _        __  __
   _| |_   _ / _|/ _|  between test.yaml
 / _' | | | | |_| |_       and test.yaml
| (_| | |_| |  _|  _|
 \__,_|\__, |_| |_|   returned one difference
        |___/

test.element1
  ± value change
    - test2
    + test