-
-
Notifications
You must be signed in to change notification settings - Fork 710
Open
Description
Describe the bug
The Unique operator exhibits unexpected behaviour when comments are present in between a list of yaml objects.
Version of yq: 4.47.2
Operating system: mac/linux
Installed via: binary release/homebrew
Input Yaml
Concise yaml document(s) (as simple as possible to show the bug, please keep it to 10 lines or less)
data1.yml:
- id: 1001
# Comment
- id: 1001Command
The command you ran:
yq 'unique' data1.yml
Actual behavior
- id: 1001
# Comment
- id: 1001Expected behavior
- id: 1001Additional context
In the following scenarios, the operator behaves as expected:
- Comments are just at the top or bottom.
- The duplicate items in the list are not yaml objects.
- If there is an object between the duplicate objects without another comment:
data1.yml:
- id: 1001
# Comment
- id: 1002
- id: 1001Output:
- id: 1001
# Comment
- id: 1002