-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Use of --keep-spec-order leads to empty response structs in v0.30.5 #2949
Comments
I can confirm we have the same issue and it looks like with |
+1! 👀 I can also confirm that using Can also confirm that the payload fields are there when generating the client with Environmentswagger version: v0.30.5 |
This PR moves the call to WithAutoXOrder _before_ we validate and flatten the spec for codegen purpose. * fixes go-swagger#2949 Other changes: * layout: moved all the spec massaging to a dedicated source * allowed WithAutoXOrder to report about errors rather than panicking Overall, WithAutoXOrder is simplistic and could be improved a lot: * supporting JSON * supporting remote $refs, circular $refs * removing the dependency to yaml.v2 * not producing a temporary file that hangs around * etc These improvements are beyond the scope of this PR, which is just to fix responses. Perhaps a follow up could bring a more general solution to this problem. Signed-off-by: Frédéric BIDON <fredbi@yahoo.com>
This PR moves the call to WithAutoXOrder _before_ we validate and flatten the spec for codegen purpose. * fixes go-swagger#2949 Other changes: * layout: moved all the spec massaging to a dedicated source * allowed WithAutoXOrder to report about errors rather than panicking Overall, WithAutoXOrder is simplistic and could be improved a lot: * supporting JSON * supporting remote $refs, circular $refs * removing the dependency to yaml.v2 * not producing a temporary file that hangs around * etc These improvements are beyond the scope of this PR, which is just to fix responses. Perhaps a follow up could bring a more general solution to this problem. Signed-off-by: Frédéric BIDON <fredbi@yahoo.com>
This PR moves the call to WithAutoXOrder _before_ we validate and flatten the spec for codegen purpose. * fixes go-swagger#2949 Other changes: * layout: moved all the spec massaging to a dedicated source * allowed WithAutoXOrder to report about errors rather than panicking Overall, WithAutoXOrder is simplistic and could be improved a lot: * supporting JSON * supporting remote $refs, circular $refs * removing the dependency to yaml.v2 * not producing a temporary file that hangs around * etc These improvements are beyond the scope of this PR, which is just to fix responses. Perhaps a follow up could bring a more general solution to this problem. Signed-off-by: Frédéric BIDON <fredbi@yahoo.com>
This PR moves the call to WithAutoXOrder _before_ we validate and flatten the spec for codegen purpose. * fixes go-swagger#2949 Other changes: * layout: moved all the spec massaging to a dedicated source * allowed WithAutoXOrder to report about errors rather than panicking Overall, WithAutoXOrder is simplistic and could be improved a lot: * supporting JSON * supporting remote $refs, circular $refs * removing the dependency to yaml.v2 * not producing a temporary file that hangs around * etc These improvements are beyond the scope of this PR, which is just to fix responses. Perhaps a follow up could bring a more general solution to this problem. Signed-off-by: Frédéric BIDON <fredbi@yahoo.com>
Problem statement
First off, thanks for
go-swagger
, it's a great tool and I'm sure it's not an easy one to maintain!I recently tried upgrading from
go-swagger
v0.30.4 to v0.30.5 and noticed that some of the generated response structs are now empty. I've tried to reduce it down to a minimal reproducible example below.Swagger specification
Steps to reproduce
Put the above spec in a file
swagger.yaml
and then run the following in the same directory as theswagger.yaml
file using a v0.30.4go-swagger
binary:open the file
gen/client/users/operations/get_api_v1_users_responses.go
and note that theGetAPIV1UsersOK
struct contains aPayload
field:Now, run the same command with a v0.30.5
go-swagger
binary:and open the same
gen/client/users/operations/get_api_v1_users_responses.go
file and note that theGetAPIV1UsersOK
struct is now empty:Finally, run the command with a v0.30.5
go-swagger
binary but omit the--keep-spec-order
option:open the file
gen/client/users/operations/get_api_v1_users_responses.go
and note that theGetAPIV1UsersOK
struct once again has aPayload
field:I am not by any means a Swagger expert but this behavior was very surprising to me. Is the spec I'm using invalid or is this a regression of some sort on the part of
go-swagger
? Please let me know if I can supply any more information that would be helpful.Environment
swagger version: 0.30.5
go version: 1.20
OS: CentOS 7
The text was updated successfully, but these errors were encountered: