Skip to content

Swagger get query param documentation shows repeated fields incorrectly #756

Closed
@veqryn

Description

@veqryn

Bug reports:

The swagger documentation generated for query parameters shows repeated fields incorrectly.

Steps you follow to reproduce the error:

Proto file example:

service Foo {
	rpc Bar (Params) returns (Series) {
		option (google.api.http) = {
			get: "/v2/foo/bar"
		};
	}
}
message Params {
	repeated string tags = 1;
}

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 and blah=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"]

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions