You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
kind: Deploymentmetadata:
name: a
---
kind: Servicemetadata:
name: b
---
---
kind: ConfigMapmetadata:
name: d
---
kind: ConfigMapmetadata:
name: e
Expected behavior
---
kind: ConfigMapmetadata:
name: d
---
kind: ConfigMapmetadata:
name: e
---
kind: Deploymentmetadata:
name: a
---
kind: Servicemetadata:
name: b
Additional context
It appears that empty documents behave like an ordering boundary, where everything before it is sorted correctly, as is everything after, but not across. Curiously, if instead of sort_by(.kind, .metadata.name) I do sort_by("\(.kind), \(.metadata.name)") everything is sorted correctly.
My actual motivation is to compare Kubernetes manifests as in #1101. In my case, the manifests are produced by Helm, which can sometimes emit empty documents if the manifest is not needed.
The text was updated successfully, but these errors were encountered:
Describe the bug
If there are empty documents passed into eval-all, sorting only works before and after the empty document.
Version of yq: 4.43.1
Operating system: Ubuntu 20.04
Installed via: wget https://github.com/mikefarah/yq/releases/download/v4.43.1/yq_linux_amd64
Input Yaml
data1.yml:
Command
The command you ran:
Actual behavior
Expected behavior
Additional context
It appears that empty documents behave like an ordering boundary, where everything before it is sorted correctly, as is everything after, but not across. Curiously, if instead of
sort_by(.kind, .metadata.name)
I dosort_by("\(.kind), \(.metadata.name)")
everything is sorted correctly.My actual motivation is to compare Kubernetes manifests as in #1101. In my case, the manifests are produced by Helm, which can sometimes emit empty documents if the manifest is not needed.
The text was updated successfully, but these errors were encountered: