Tufin / oasdiff

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

Add Diff for OpenAPI Extensions #515

Closed reuvenharrison closed 5 months ago

reuvenharrison commented 5 months ago

This PR adds diff support for OpenAPI Extensions. The Extension diff format conforms with JavaScript Object Notation (JSON) Patch, for example:

endpoints:
    modified:
        ?   method: POST
            path: /example/callback
        :   extensions:
                modified:
                    x-amazon-apigateway-integration:
                        - oldValue: "201"
                          value: "200"
                          op: replace
                          from: ""
                          path: /responses/default/statusCode
                        - oldValue: http://api.example.com/v1/example/callback
                          value: http://api.example.com/v1/example/calllllllllback
                          op: replace
                          from: ""
                          path: /uri

Behavior Change

Prior to this PR oasdiff diff command didn't report changes to OpenAPI Extensions. After this PR, the diff will include changes to OpenAPI Extensions by default. Users can revert to the old behavior (ignoring extensions), by setting --exclude-elements=extensions.

This PR also removes the --exclude-elements flag from oasdiff breaking and oasdiff changelog commands since allowing users to exclude elements in these commands may have unexpected effects like, for example, disabling the tests that depend on x-sunset.

codecov[bot] commented 5 months ago

Codecov Report

Attention: Patch coverage is 53.47044% with 181 lines in your changes are missing coverage. Please review.

Project coverage is 83.12%. Comparing base (05b7335) to head (1a24a95).

:exclamation: Current head 1a24a95 differs from pull request most recent head b60ac34. Consider uploading reports for the commit b60ac34 to get more accurate results

Files Patch % Lines
diff/json_diff.go 52.63% 18 Missing :warning:
diff/oauth_flows.go 47.05% 12 Missing and 6 partials :warning:
diff/info_diff.go 59.25% 7 Missing and 4 partials :warning:
diff/server_diff.go 47.61% 8 Missing and 3 partials :warning:
diff/diff.go 25.00% 6 Missing and 3 partials :warning:
diff/link_diff.go 35.71% 6 Missing and 3 partials :warning:
diff/schema_diff.go 25.00% 6 Missing and 3 partials :warning:
diff/security_scheme.go 52.63% 6 Missing and 3 partials :warning:
diff/variable_diff.go 53.33% 5 Missing and 2 partials :warning:
diff/contact.go 64.70% 4 Missing and 2 partials :warning:
... and 20 more
Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #515 +/- ## ========================================== - Coverage 84.17% 83.12% -1.05% ========================================== Files 232 234 +2 Lines 12973 13181 +208 ========================================== + Hits 10920 10957 +37 - Misses 1670 1790 +120 - Partials 383 434 +51 ``` | [Flag](https://app.codecov.io/gh/Tufin/oasdiff/pull/515/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Tufin) | Coverage Δ | | |---|---|---| | [unittests](https://app.codecov.io/gh/Tufin/oasdiff/pull/515/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Tufin) | `83.12% <53.47%> (-1.05%)` | :arrow_down: | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Tufin#carryforward-flags-in-the-pull-request-comment) to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.