-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Swagger get query param documentation shows repeated fields incorrectly #756
Comments
Thanks for raising this issue! I think this is actually just an incompatibility between Swagger and the Gateways expectations. The gateway generates a correct swagger file and there's no way that I know to tell swagger to put these parameters in separate query parameters. If you know of a different solution to this, please let me know, but I think this might just be a matter of documenting the problem. I think the gateway is doing the sensible thing here and Swagger is generating a nonsensical query. |
Having looked into it, I think we might be able to fix this by emitting a |
I guess I could try at least.
|
I think we'd add a new field to the schema type, |
Hello, guys! We are using gRPC with Node.js and generating swagger documentation by protoc-gen-swagger. Our REST gateway is hosted by express and we met the same problem, as was described. @johanbrandhorst, do you have plans to implement configurable behavior for option |
@litichevskiydv I don't personally have the time to implement this, but I think mine and @veqryn's previous discussion is good enough for anyone with the determination to get a pull request started, with or without Go experience! What can I do to help you bring this contribution in? |
Solves grpc-ecosystem#756 . Also formats protoc-gen-swagger/genswagger/template_test.go according to go fmt.
Solves grpc-ecosystem#756 . Also formats protoc-gen-swagger/genswagger/template_test.go according to go fmt.
Reopening due to #906. |
@johanbrandhorst I would like to take a look. My first guess is that we don't want to be setting a |
Solves grpc-ecosystem#756 . Also formats protoc-gen-swagger/genswagger/template_test.go according to go fmt.
…ecosystem#902) * Use collectionFormat multi for query params of repeated fields Fixes grpc-ecosystem#756 . Also formats protoc-gen-swagger/genswagger/template_test.go according to go fmt.
…osystem#909) * Use collectionFormat multi for query params of repeated fields Fixes grpc-ecosystem#756 . Also formats protoc-gen-swagger/genswagger/template_test.go according to go fmt. * regenerate the files * only specify multi in the method queryParams Fixes grpc-ecosystem#906. * deep equal checks in TestSchemaOfField
Bug reports:
The swagger documentation generated for query parameters shows repeated fields incorrectly.
Steps you follow to reproduce the error:
Proto file example:
This generates swagger documentation that looks correct at first glance, but if you hit "Try It Now" and then fill in multiple "tags", then select execute, it gives you a curl command like this.
(This was done with me filling in the following tags:
foo=bar
andblah=blarg
.)curl -X GET "http://editor.swagger.io/v2/foo/bar?tags=foo%3Dbar,blah%3Dblarg" -H "accept: application/json"
That is, it asks the user to comma separate the individual tags:
tags=foo%3Dbar,blah%3Dblarg
When my function runs, it receives a single element in the array equal to:
["foo=bar,blah=blarg"]
What did you expect to happen instead:
The documentation should actually generate an example like this:
curl -X GET "http://editor.swagger.io/v2/foo/bar?tags=foo%3Dbar&tags=blah%3Dblarg" -H "accept: application/json"
This correctly gives my function two elements:
["foo=bar", "blah=blarg"]
The text was updated successfully, but these errors were encountered: