Search code examples
linuxbashcontinuous-integrationyq

yq compare only part of files


If I have two files, data1.yaml and data2.yaml.

I do not want to compare all conntent of data files. I need to compare only for example version part

---
openapi: 3.0.1
info:
  version: 0.0.1
  title: yaml validation example
  description: >-
    Some description here.

I tried

yq compare data1.yaml data2.yaml

but it compares whole files


Solution

  • May be something like this?

    yq eval-all '[.info.version] | .[0] == .[1]' data1.yaml data2.yaml