homeport / dyff

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

`dyff yaml` incorrectly converts boolstring to bool #309

Closed ripta closed 1 year ago

ripta commented 1 year ago

Assuming in.yaml containing:

apiVersion: test/v1
kind: ReplicatedDatabase
metadata:
  name: customers
  annotations:
    prometheus.io/scrape: "true"
spec: {}

and then running dyff yaml in.yaml > out.yaml, I get the following content in out.yaml:

---
apiVersion: test/v1
kind: ReplicatedDatabase
metadata:
  name: customers
  annotations:
    prometheus.io/scrape: true
spec: {}

where unfortunately "true" (a string) is incorrectly converted into true (a bool). I'd have expected dyff to leave the type alone.

(Implementation detail: in Kubernetes, annotations are map[string]string, so the value must be treated as a string.)

HeavyWombat commented 1 year ago

Thanks for bringing it up. I did not have much time lately for the projects, so sorry for the belated response. It should be fixed in the newest release. Let me know whether this works for you.