Tufin / oasdiff

OpenAPI Diff and Breaking Changes
https://www.oasdiff.com
Apache License 2.0
763 stars 63 forks source link

`--err-ignore` – How to completely ignore a path? #612

Closed m-graf closed 1 month ago

m-graf commented 2 months ago

Describe the bug I am unable to grok the documentation for --err-ignore – specifically, the requirement that the error message itself be included in the file in which the exceptions are held. For example,

An exception file like this...

post /rest/v2.0/companies/{company_id}/projects/{project_id}/foo/{bar_id}/pdf *

Does not prevent the exception

oasdiff breaking --err-ignore ~/Desktop/ignore-me.txt --fail-on ERR /var/folders/r4/d72rchy525x6n8gx91y3592m0000gp/T/tmp-56211-bJLf58HbMEEA/foo-export-pdf_2.0.json __compiled_oas/oas/rest_v2/foo-pdf_2.0.json
1 changes: 1 error, 0 warning, 0 info
error   [response-success-status-removed] at __compiled_oas/oas/rest_v2/foo-pdf_2.0.json
    in API POST /rest/v2.0/companies/{company_id}/projects/{project_id}/foo/{foo_id}/pdf
        removed the success response with the status '202'

Rather, the following is required:

post /rest/v2.0/companies/{company_id}/projects/{project_id}/foo/{foo_id}/pdf removed the success response with the status '202'

How does one ignore breaking changes for any reason, without specifying the error? Is a wild card available?

reuvenharrison commented 2 months ago

Hi @m-graf, Thanks for your contribution. The logic of err-ignore is a bit vague, and this change makes it even worse. For example, you introduced a new constraint that the err line must begin with the operation name, but only if a wild-card is used. Perhaps we can satisfy the requirement in a simpler way by adding a new flag:

--unmatch-path string              exclude paths that match this regular expression

What do you think?

m-graf commented 2 months ago

Your comment resonates with me; I agree the current implementation is vague... and this contribution may make it even worse... I like your idea 👍👍

As a go noobie; I'm more than happy to contribute!