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

`signal SIGSEGV: segmentation violation code=0x1 addr=0x18 pc=0xb337d2` #128

Closed MartinX3 closed 5 months ago

MartinX3 commented 5 months ago

Using arch linux I downloaded https://github.com/pb33f/openapi-changes/releases/download/v0.0.61/openapi-changes_0.0.61_linux_x86_64.tar.gz

Then I executed ./openapi-changes report api-with-examples_2.0.yaml api-with-examples_3.0.yaml (The files are https://raw.githubusercontent.com/OAI/OpenAPI-Specification/main/examples/v2.0/yaml/api-with-examples.yaml and https://raw.githubusercontent.com/OAI/OpenAPI-Specification/main/examples/v3.0/api-with-examples.yaml)

Which resulted in

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x18 pc=0xb337d2]

goroutine 1 [running]:
github.com/pb33f/openapi-changes/cmd.GetReportCommand.func1(0xc0001d8908, {0xc00007cb00, 0x2, 0xd32e0b?})
    /home/runner/work/openapi-changes/openapi-changes/cmd/report.go:200 +0xe52
github.com/spf13/cobra.(*Command).execute(0xc0001d8908, {0xc00007caa0, 0x2, 0x2})
    /home/runner/go/pkg/mod/github.com/spf13/cobra@v1.8.0/command.go:983 +0xaca
github.com/spf13/cobra.(*Command).ExecuteC(0x1742420)
    /home/runner/go/pkg/mod/github.com/spf13/cobra@v1.8.0/command.go:1115 +0x3ff
github.com/spf13/cobra.(*Command).Execute(...)
    /home/runner/go/pkg/mod/github.com/spf13/cobra@v1.8.0/command.go:1039
github.com/pb33f/openapi-changes/cmd.Execute({0x10d1244?, 0x19?}, {0x10db760?, 0xd4155e?}, {0xc00002e840?, 0xc0000061c0?})
    /home/runner/work/openapi-changes/openapi-changes/cmd/root.go:51 +0x91
main.main()
    /home/runner/work/openapi-changes/openapi-changes/openapi-changes.go:29 +0x158

Using the console output it just results in an endless "generating model for commit bla".

This is a v2 vs v3 report. If I try a v3 vs a completely different v3.1 report it works.

daveshanley commented 5 months ago

This has been fixed in v0.0.62

However, it won't operate as expected, because you cannot compare a v2 spec and a v3 spec. openapi-changes will report an error regarding mis-matched versions.

MartinX3 commented 5 months ago

Thank you! That's perfect.

MartinX3 commented 5 months ago

Ah @daveshanley would it be possible to write openapi version instead of version in the error message? And also output it as a json like the "no-changes-found" message {"message": "No changes found between specifications"}? It would the output machine-readable.