pb33f / openapi-changes

The world's sexiest OpenAPI breaking changes detector. Discover what changed between two OpenAPI specs, or a single spec over time. Supports OpenAPI 3.1, 3.0 and Swagger
https://pb33f.io/openapi-changes/
Other
180 stars 16 forks source link

Does it need a fully-resolved schema? #65

Closed rao-anant closed 1 year ago

rao-anant commented 1 year ago

Hello, This looks awesome!

I have an OAS 3.x openapi.json file which has references, using "$ref", to small, external files like email.json, CC.json etc. Assume there is a breaking change in the referred-to file like CC.json. Can the tool be given the old and new (modified) CC.json? Or, does it only take openapi.json files as input?

The reason I'm asking is if it's the latter, wonder if the line numbers point to those in CC.json file, or the fully exploded (dereferenced) openapi.json, which makes it difficult to point the line # back to CC.json.

Please let me know if my question didn't make sense. Thanks so much!

daveshanley commented 1 year ago

Hi, This is actually supported in our underlying technology (https://pb33f.io/libopenapi/openapi/#documents-with-relative-or-remote-references)

This has also been enabled in my other tool (vacuum) https://quobix.com/vacuum/faq/#q-why-do-i-see-a-remote-lookups-are-not-permitted-warning

It just hasn't yet been wired up in openapi-changes. I'll add this as a feature, and if you'd like to do the wiring before I can get to it, then please feel free to contribute to the project.

daveshanley commented 1 year ago

I have added a new feature in v0.0.43 that satisfies this. Using the -p or --base flag, a base path or URL can be specified to set the base path or URL to where ever the external files are.

Documentation is available here: https://pb33f.io/openapi-changes/command-arguments/#unresolved-references