openapi-changes icon indicating copy to clipboard operation
openapi-changes copied to clipboard

Unable to open the rolodex file if using external ref and git history

Open Fab1n opened this issue 8 months ago • 2 comments

This tool, and libopenapi respectively, cannot (to my knowledge) handle a very common case, which is:

  • define an OpenAPI schema with external references (pointing to local files relative to the schema file)
  • push that schema
  • remove any of the $ref'ed schemas from the repo and push the new changes
  • do any changes afterwards that do not bring back this $ref file from the past

Whenever openapi-changes checks the git history and compares file changes there will always be this error:

https://github.com/pb33f/libopenapi/blob/1f17c502e78acf5984a49a3459fcc37ce316c0c8/index/find_component.go#L161 Image

I tried --ext-refs and -p with different path combinations, no success.

I'd contribute to the project, but Go is not my lang of expertise and I also read @daveshanley is rewriting it.

Here is a sample project that perfectly demonstrates the issue in its simplest form: openapi-changes-ref-bug.zip

  • unzip the folder
  • cd into it
  • execute openapi-changes html-report . openapi.yaml
  • also try `openapi-changes html-report --ext-refs -p . . openapi.yaml

Fab1n avatar Jun 05 '25 15:06 Fab1n

Hi,

I'm not rewriting this tool, but I will upgrade it over time to bring it in line with pb33f's product powered by the OSS tooling.

This is a strange issue and I'll look into this. Thanks for the reproduction, it makes my life so much easier.

daveshanley avatar Jun 05 '25 17:06 daveshanley

I am going to rewrite this, but not rewrite, more completely refactor.

daveshanley avatar Jul 16 '25 14:07 daveshanley