Skip to content

Diff --exclude-elements regression when using --format json #674

@fenuks

Description

@fenuks

Describe the bug
Excluding several comma-separated types of changes doesn't work in combination with --format json e.g. oasdiff diff --format json --exclude-elements=examples,description,title,summary spec1.yml spec2.yml

To Reproduce
Steps to reproduce the behavior:

  1. Save test files
cat << EOF >| spec1.yml
components:
  schemas:
    Int:
      type: int
      description: Integer
EOF
cat << EOF >| spec2.yml
components:
  schemas:
    Int:
      type: int
      description: Integer.
EOF
  1. Run oasdiff
$ oasdiff diff --format json --exclude-elements=description,title,summary
spec1.yml spec2.yml
{"extensions":{"modified":{"schemas":[{"oldValue":"Integer","value":"Integer.","op":"replace","from":"","path":"/Int/description"}]}},"components":{}}

Expected behavior
Description changes should be excluded. It worked last time I checked in oasdiff 1.10.16.

Desktop (please complete the following information):

  • OS: Linux, oasdiff v1.11.1

Additional context
Filtering works if you skip --format json or pass only description to
--exclude-elements, that is both commands below work as expected, and filter
description change:

  • oasdiff diff --exclude-elements description,title,summary spec1.yml spec2.yml
  • oasdiff diff --format json --exclude-elements description spec1.yml spec2.yml

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions