Skip to content

Errors running tests: cannot use spec.NewSingleOrArray(OBJECT) etc #1980

@ainsleyclark

Description

@ainsleyclark

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

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions