Skip to content

Merge array doens' work well. Replace always first position #796

@richard24se

Description

@richard24se

Describe the bug
A clear and concise description of what the bug is.

Note that any how to questions should be posted in the discussion board and not raised as an issue.

Version of yq: 4.7.1
Operating system: linux
Installed via: binary

Input Yaml
Concise yaml document(s) (as simple as possible to show the bug, please keep it to 10 lines or less)
s1.yml:

rules:
  - host: hooks.pe
    http:
      paths:
      - backend:
          serviceName: tes1
          servicePort: 5005
        pathType: ImplementationSpecific
  - host: hooks.pe2
    http:
      paths:
      - backend:
          serviceName: test2
          servicePort: 50052
        pathType: ImplementationSpecific
rules2:
  - host: hooks.pe2
    http:
      paths:
      - backend:
          serviceName: tes1
          servicePort: 5010
        pathType: ImplementationSpecific

Command
The command you ran:

yq eval '.rules *d .rules2' s1.yml

Actual behavior

- host: hooks.pe2
  http:
    paths:
      - backend:
          serviceName: tes1
          servicePort: 5010
        pathType: ImplementationSpecific
- host: hooks.pe2
  http:
    paths:
      - backend:
          serviceName: test2
          servicePort: 50052
        pathType: ImplementationSpecific

Expected behavior

- host: hooks.pe
  http:
    paths:
      - backend:
          serviceName: test1
          servicePort: 5005
        pathType: ImplementationSpecific
- host: hooks.pe2
  http:
    paths:
      - backend:
          serviceName: test1
          servicePort: 5010
        pathType: ImplementationSpecific

Additional context

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions