-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Closed
Labels
Description
Problem statement
Command "go-swagger diff" crashes when comparing two simple Swagger schema files. The output is:
2023/06/26 09:52:14 Run Config:
2023/06/26 09:52:14 Spec1: ref.yaml
2023/06/26 09:52:14 Spec2: new.yaml
2023/06/26 09:52:14 ReportOnlyBreakingChanges (-c) :false
2023/06/26 09:52:14 OutputFormat (-f) :txt
2023/06/26 09:52:14 IgnoreFile (-i) :none specified
2023/06/26 09:52:14 Diff Report Destination (-d) :stdout
panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xc0000005 code=0x0 addr=0x0 pc=0x78571c]
goroutine 1 [running]:
github.com/go-swagger/go-swagger/cmd/swagger/commands/diff.getSchemaDiffNode(0xbeb29d, 0x4, 0xbdb2a0, 0x0, 0xc000406c00)
/app/cmd/swagger/commands/diff/node.go:68 +0x49c
github.com/go-swagger/go-swagger/cmd/swagger/commands/diff.(*SpecAnalyser).analyseResponseParams(0xc000871b18)
/app/cmd/swagger/commands/diff/spec_analyser.go:225 +0x28b
github.com/go-swagger/go-swagger/cmd/swagger/commands/diff.(*SpecAnalyser).Analyse(0xc000871b18, 0xc000120200, 0xc000120100, 0x90, 0x0)
/app/cmd/swagger/commands/diff/spec_analyser.go:57 +0x109
github.com/go-swagger/go-swagger/cmd/swagger/commands/diff.Compare(0xc000120200, 0xc000120100, 0x0, 0x0, 0x0, 0xc0002e4280, 0x0)
/app/cmd/swagger/commands/diff/reporting.go:22 +0x7e
github.com/go-swagger/go-swagger/cmd/swagger/commands.(*DiffCommand).getDiffs(0xc0002d9560, 0xc0004a3c10, 0x79d0ce, 0xc000513900, 0xc0004a3c30, 0x3)
/app/cmd/swagger/commands/diff.go:135 +0x111
github.com/go-swagger/go-swagger/cmd/swagger/commands.(*DiffCommand).Execute(0xc0002d9560, 0xc0007a9110, 0x0, 0x3, 0x0, 0x0)
/app/cmd/swagger/commands/diff.go:58 +0x185
github.com/jessevdk/go-flags.(*Parser).ParseArgs(0xc000184850, 0xc0000d2010, 0x3, 0x3, 0x10, 0xc2d313, 0x2a, 0xac9be0, 0xc00003f240)
/go/pkg/mod/github.com/jessevdk/go-flags@v1.5.0/parser.go:335 +0x88f
github.com/jessevdk/go-flags.(*Parser).Parse(...)
/go/pkg/mod/github.com/jessevdk/go-flags@v1.5.0/parser.go:191
main.main()
/app/cmd/swagger/swagger.go:140 +0xc05
Swagger specification
ref.yaml:
swagger: "2.0"
info: {}
basePath: /
paths:
/api/datamodel/v2/get-api-version:
get:
responses:
"200":
description: Version
"404":
description: project does not exist
new.yaml:
swagger: "2.0"
info: {}
basePath: /
paths:
/api/datamodel/v2/get-api-version:
get:
responses:
"200":
description: Version
Steps to reproduce
> go-swagger diff ref.yaml new.yaml
Environment
swagger version: 30.0.5
go version: 1.18.1
OS: Windows 10 Pro 22H2 AMD64