Tufin / oasdiff

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

Add a flag to filter endpoints to raise issues on #599

Closed Nakeuh closed 3 months ago

Nakeuh commented 3 months ago

Is your feature request related to a problem? Please describe.

I generate an SDK from an OAS. I would love to integrate oasdiff in a gitlab pipeline to check if this OAS is still up to date with the source OAS (~30k lines with frequent changes). My issue is that I'm interested by only a subset of endpoints in my OAS.

As it is, oasdiff will raise pretty often warnings and errors on endpoints I don't care about.

Describe the solution you'd like

I would like to be able to specify base paths I'm interested in.

For example, oasdiff summary oas1.yaml oas2.yaml --ignore-endpoint 'path/to/ignore/' Would not raise any issues about endpoints starting by 'path/to/ignore/'

Or oasdiff summary oas1.yaml oas2.yaml --accept-endpoint'path/to/accept/' Would raise issues only for endpoints starting by 'path/to/accept/'

reuvenharrison commented 3 months ago

Hi @Nakeuh, You can use the --match-path flag with a regular expression to match paths beginning with a certain prefix: oasdiff changelog base.yaml revision.yaml --match-path="path/to/accept/

This flag doesn't allow you to ignore paths beginning with a certain prefix because of a golang regex limitation (no lookaheads).

Perhaps you can use the --filter-extension flag to exclude paths and operations with an OpenAPI Extension matching a certain regular expression.

Please let me know if these options answer your requirement or whether some enhancement is needed.

Nakeuh commented 3 months ago

Oh I missed that in doc, my bad. It is exactly what I am looking for !

Thanks for this amazing tool !