Skip to content

Adding Diff command

Compare
Choose a tag to compare
@n3wscott n3wscott released this 07 Mar 18:13
· 2 commits to main since this release
3302931

diff compares two yaml event files.

cloudevents diff ./want.yaml ./got.yaml

want.yaml could have fewer fields specified to allow for fuzzy matching.

Example, if you only wanted to compare on type and ignore additional fields:

$ cat ./want.yaml
ContextAttributes:
  type: com.example.someevent
$ cat ./got.yaml
Mode: structured
ContextAttributes:
  specversion: 1.0
  type: com.example.someevent
  time: 2018-04-05T03:56:24Z
  id: 4321-4321-4321-a
  source: /mycontext/subcontext
  Extensions:
    comexampleextension1 : "value"
    comexampleextension2 : |
      {"othervalue": 5}
TransportExtensions:
  user-agent: "foo"
Data: |
  {"world":"hello"}

$ cloudevents diff ./want.yaml ./got.yaml --match type --ignore-additions

This validates that at least one event of type com.example.someevent is present in the got.yaml file.