Skip to content

Errors while trying to use openapi-changes #66

@donquixote8

Description

@donquixote8

Hello,
I made changes to openapi-changes to allow local (-x) and remote (-y) refs. Will raise a PR soon.
I was testing using two simple openapi files each including another file (old/new_blah.json) via $ref.
GitHub didn't let me upload json files, hence renamed as .txt

$ diff old_test_openapi.json new_test_openapi.json
18c18
< "$ref": "old_blah.json"

                    "$ref": "new_blah.json"

####################

$ diff old_blah.json new_blah.json
7c7
< "type": "string",

        "type": "int",

Here are my results. I feel the errors are coming from openapilib, or if I'm doing something not right.

  1. openapi-changes report -x -y old_test_openapi.json new_test_openapi.json
    panic: runtime error: invalid memory address or nil pointer dereference
    [signal SIGSEGV: segmentation violation code=0x1 addr=0x8 pc=0x14949b4]

goroutine 1 [running]:
github.com/pb33f/libopenapi/what-changed/reports.CreateOverallReport(0x0)
/Users/XYZ/go/pkg/mod/github.com/pb33f/libopenapi@v0.9.4/what-changed/reports/summary.go:26 +0x34
github.com/pb33f/openapi-changes/cmd.createReport(...)
/Users/XYZ/generated_openapi/openapi-changes/cmd/report.go:349
github.com/pb33f/openapi-changes/cmd.runLeftRightReport({0x7ff7bfeff4d6, 0x15}, {0x7ff7bfeff4ec, 0x15}, 0x4?, 0x19b97a0?, 0x0?, 0x0?)
/Users/XYZ/generated_openapi/openapi-changes/cmd/report.go:345 +0x659
github.com/pb33f/openapi-changes/cmd.GetReportCommand.func1(0xc0001d8200?, {0xc000134c40, 0x2, 0x16b88d3?})
/Users/XYZ/generated_openapi/openapi-changes/cmd/report.go:197 +0xb4d
github.com/spf13/cobra.(*Command).execute(0xc000004900, {0xc000134c00, 0x4, 0x4})
/Users/XYZ/go/pkg/mod/github.com/spf13/cobra@v1.6.1/command.go:916 +0x87c
github.com/spf13/cobra.(*Command).ExecuteC(0x1ed2580)
/Users/XYZ/go/pkg/mod/github.com/spf13/cobra@v1.6.1/command.go:1044 +0x3a5
github.com/spf13/cobra.(*Command).Execute(...)
/Users/XYZ/go/pkg/mod/github.com/spf13/cobra@v1.6.1/command.go:968
github.com/pb33f/openapi-changes/cmd.Execute({0x16b95ac?, 0x10013f0?}, {0x16b95ac?, 0x16c2b29?}, {0xc00002c840?, 0xc0000061a0?})
/Users/XYZ/generated_openapi/openapi-changes/cmd/root.go:52 +0xb0
main.main()
/Users/XYZ/generated_openapi/openapi-changes/openapi-changes.go:26 +0x105

  1. openapi-changes summary -x -y old_test_openapi.json new_test_openapi.json

@@@@@@@ @@@@@@@ @@@@@@ @@@@@@ @@@@@@@@

openapi-changes version: latest | compiled: 2023-09-28 15:33:17 PDT

INFO printing summary

This is not showing any diffs, let alone breaking changes.

Just to let you know, the following worked perfectly:
openapi-changes console -x -y https://github.com/pb33f/openapi-changes/blob/main/sample-specs/petstorev3.json

old_test_openapi.json.txt
new_test_openapi.json.txt
new_blah.json.txt
old_blah.json.txt

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions