Breaking changes in `kin-openapi` v0.122.0 - change of map definitions
grokify opened this issue · 3 comments
grokify commented
Build fails on v0.122.
% go test -v ./...
# github.com/grokify/spectrum/openapi3
openapi3/merge.go:150:29: cannot range over specExtra.Paths (variable of type *"github.com/getkin/kin-openapi/openapi3".Paths)
openapi3/merge.go:151:44: invalid operation: cannot index specMaster.Paths (variable of type *"github.com/getkin/kin-openapi/openapi3".Paths)
openapi3/merge.go:152:20: invalid operation: cannot index specMaster.Paths (variable of type *"github.com/getkin/kin-openapi/openapi3".Paths)
openapi3/merge.go:155:23: invalid operation: cannot index specMaster.Paths (variable of type *"github.com/getkin/kin-openapi/openapi3".Paths)
openapi3/merge.go:156:21: invalid operation: cannot index specMaster.Paths (variable of type *"github.com/getkin/kin-openapi/openapi3".Paths)
openapi3/merge.go:157:67: invalid operation: cannot index specMaster.Paths (variable of type *"github.com/getkin/kin-openapi/openapi3".Paths)
openapi3/merge.go:162:23: invalid operation: cannot index specMaster.Paths (variable of type *"github.com/getkin/kin-openapi/openapi3".Paths)
openapi3/merge.go:163:21: invalid operation: cannot index specMaster.Paths (variable of type *"github.com/getkin/kin-openapi/openapi3".Paths)
openapi3/merge.go:164:66: invalid operation: cannot index specMaster.Paths (variable of type *"github.com/getkin/kin-openapi/openapi3".Paths)
openapi3/merge.go:169:23: invalid operation: cannot index specMaster.Paths (variable of type *"github.com/getkin/kin-openapi/openapi3".Paths)
openapi3/merge.go:169:23: too many errors
grokify commented
Paths struct definition has changed:
v0.122.0
type Paths struct {
Extensions map[string]interface{} `json:"-" yaml:"-"`
// contains filtered or unexported fields
}
https://pkg.go.dev/github.com/getkin/kin-openapi@v0.122.0/openapi3#Paths
v0.121.0
type Paths map[string]*PathItem
https://pkg.go.dev/github.com/getkin/kin-openapi@v0.121.0/openapi3#Paths
Diff:
grokify commented
Solution is to use Paths.Map()
:
func (paths *Paths) Map() map[string]*PathItem
https://pkg.go.dev/github.com/getkin/kin-openapi@v0.122.0/openapi3#Paths.Map
grokify commented
Operation.Responses
has breaking changes as well:
v0.122.0
https://pkg.go.dev/github.com/getkin/kin-openapi@v0.122.0/openapi3#Operation
v0.121.0
https://pkg.go.dev/github.com/getkin/kin-openapi@v0.121.0/openapi3#Operation
Diff