Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] The parameters section can't be generate under go1.20 #2913

Closed
cuizhaoyue opened this issue Mar 16, 2023 · 11 comments
Closed

[Bug] The parameters section can't be generate under go1.20 #2913

cuizhaoyue opened this issue Mar 16, 2023 · 11 comments

Comments

@cuizhaoyue
Copy link

Problem statement

After execute the generate command, the value of body is always "string"
image

And then I downgrading the version of Go to 1.19.5 and try to re-generate the swagger files successfully.

Environment

swagger version: 0.30.3
go version: 1.20.2
OS: MacOS

@esdrasbeleza
Copy link

Same here

@rafi0101
Copy link

Yes, same problem

@ToJuMaLe
Copy link

+1

@rafi0101
Copy link

Is there any chance that this problem will be fixed in near future?

@WinnerOK
Copy link

Possible duplicate of #2897
Yet, no fix found

@WinnerOK
Copy link

Apparently, the issue I mentioned includes a possible workaround.
TL;DR: the issue relates to the platform and Go version which were used to build a swagger binary.
go-swagger were not generating definitions, when I was using old binary (built for go 1.19) and $GOROOT pointing to a version 1.20

Once I rebuilt go-swagger from sources using go 1.20, the swagger binary started working properly
Tested go-swagger v0.30.3 at M1 Mac

@fascari-meli
Copy link

Any fix for this issue?

Still happens on:

Swagger version: 0.30.4
go version: 1.20.4
OS: MacOS

@Quikr
Copy link

Quikr commented Jun 24, 2023

My observation is with the latest version of GoLand (2023.1.2) is changing the swagger yaml in the comments via its linter. Thus breaking the request body format and responses

  • looking for a fix on the linter
    Follow up: GoLand by default is using Go Fmt and as such Go Fmt is behaving differently in 1.20.x

@rafi0101
Copy link

rafi0101 commented Sep 4, 2023

Seems to be fixed in v0.30.5
https://github.com/go-swagger/go-swagger/releases/tag/v0.30.5

#2904

@cuizhaoyue
Copy link
Author

It's fixed in v0.30.5.

@juburr
Copy link

juburr commented Sep 19, 2023

I can still reproduce in v0.30.5. Works great with Go 1.19, but fails to generate properly with both Go 1.20 and Go 1.21.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants