Repository navigation
Open
Description
Describe the bug
I'm getting some issues when running tests for v2@2.0.0-rc4 as shown below:
../../../go/pkg/mod/github.com/swaggo/swag/v2@v2.0.0-rc4/operationv3.go:178:23: cannot use spec.NewSingleOrArray(OBJECT) (value of type "github.com/sv-tools/openapi/spec".SingleOrArray[string]) as *"github.com/sv-tools/openapi/spec".SingleOrArray[string] value in assignment
../../../go/pkg/mod/github.com/swaggo/swag/v2@v2.0.0-rc4/operationv3.go:189:23: cannot use spec.NewSingleOrArray(STRING) (value of type "github.com/sv-tools/openapi/spec".SingleOrArray[string]) as *"github.com/sv-tools/openapi/spec".SingleOrArray[string] value in assignment
../../../go/pkg/mod/github.com/swaggo/swag/v2@v2.0.0-rc4/operationv3.go:192:23: cannot use spec.NewSingleOrArray(STRING) (value of type "github.com/sv-tools/openapi/spec".SingleOrArray[string]) as *"github.com/sv-tools/openapi/spec".SingleOrArray[string] value in assignment
../../../go/pkg/mod/github.com/swaggo/swag/v2@v2.0.0-rc4/operationv3.go:256:24: cannot use spec.NewSingleOrArray(OBJECT) (value of type "github.com/sv-tools/openapi/spec".SingleOrArray[string]) as *"github.com/sv-tools/openapi/spec".SingleOrArray[string] value in assignment
../../../go/pkg/mod/github.com/swaggo/swag/v2@v2.0.0-rc4/operationv3.go:267:24: cannot use spec.NewSingleOrArray(STRING) (value of type "github.com/sv-tools/openapi/spec".SingleOrArray[string]) as *"github.com/sv-tools/openapi/spec".SingleOrArray[string] value in assignment
../../../go/pkg/mod/github.com/swaggo/swag/v2@v2.0.0-rc4/operationv3.go:270:24: cannot use spec.NewSingleOrArray(STRING) (value of type "github.com/sv-tools/openapi/spec".SingleOrArray[string]) as *"github.com/sv-tools/openapi/spec".SingleOrArray[string] value in assignment
../../../go/pkg/mod/github.com/swaggo/swag/v2@v2.0.0-rc4/operationv3.go:350:53: invalid operation: cannot index schema.Spec.Type (variable of type *"github.com/sv-tools/openapi/spec".SingleOrArray[string])
../../../go/pkg/mod/github.com/swaggo/swag/v2@v2.0.0-rc4/operationv3.go:391:12: invalid argument: prop.Type (variable of type *"github.com/sv-tools/openapi/spec".SingleOrArray[string]) for built-in len
../../../go/pkg/mod/github.com/swaggo/swag/v2@v2.0.0-rc4/operationv3.go:398:19: invalid operation: cannot index prop.Type (variable of type *"github.com/sv-tools/openapi/spec".SingleOrArray[string])
../../../go/pkg/mod/github.com/swaggo/swag/v2@v2.0.0-rc4/operationv3.go:400:10: invalid argument: prop.Items.Schema.Spec.Type (variable of type *"github.com/sv-tools/openapi/spec".SingleOrArray[string]) for built-in len
../../../go/pkg/mod/github.com/swaggo/swag/v2@v2.0.0-rc4/operationv3.go:400:10: too many errors
I'm not sure what could be causing these errors, or if someone has encountered this before?
Expected behavior
No errors.
Screenshots
If applicable, add screenshots to help explain your problem.
Your swag version
github.com/swaggo/http-swagger v1.3.4
github.com/swaggo/swag/v2 v2.0.0-rc4
Your go version
1.23.0
Metadata
Metadata
Assignees
Labels
No labels
Activity
fix: Issue swaggo#1980
fix: Issue #1980 (#1985)
sdghchj commentedon Mar 24, 2025
field_parser_v3_test.go:187
schema.Spec.Type = []string{"string"}=>schema.Spec.Type = &spec.SingleOrArray[string]{STRING}