swagger2markup icon indicating copy to clipboard operation
swagger2markup copied to clipboard

query parameter incorrectly shown as json in request example

Open mihbor opened this issue 7 years ago • 15 comments

Using v1.3.1

Given parameters are defined as query parameters in the swagger, the generated example request should show them as query parameters.

Currently the generated example suggest they are passed in as json, e.g.:

==== Example HTTP request

===== Request path
----
/exchange-rate
----


===== Request query
[source,json]
----
{
  "from" : "string",
  "to" : "string"
}
----

Since these are defined as query parameters, the example request should show them as such, e.g.:

==== Example HTTP request

===== Request path
----
/exchange-rate?from=string&to=string
----

mihbor avatar Jul 12 '17 09:07 mihbor

Similar issue to https://github.com/Swagger2Markup/swagger2markup/issues/266 ?

alkemann avatar Jul 14 '17 08:07 alkemann

Yup, they're the same issue I think.

mihbor avatar Jul 14 '17 08:07 mihbor

Instead of this JSON string (which is obviously wrong), would you prefer to see a table of possible query parameters, or an example URL with the query parameters in them?

cascer1 avatar Jul 20 '17 14:07 cascer1

Btw when you use and like Swagger2Markup, we would love to get your GitHub stars :tada:

RobWin avatar Jul 20 '17 14:07 RobWin

I think a table would be more readable but a URL is more useful as that can be copy pasted into the browser, curl etc. So overall, I'd prefer the URL.

mihbor avatar Jul 20 '17 14:07 mihbor

I have created the following expected result, based on the example in issue #266 :

https://github.com/Swagger2Markup/swagger2markup/blob/issue/264/src/test/resources/expected/asciidoc/query_params/paths.adoc

cascer1 avatar Jul 24 '17 07:07 cascer1

Nice. And the spec limits us from getting the ability to set example values right?

alkemann avatar Jul 24 '17 08:07 alkemann

@cascer1 Thx. Do we still need the table which shows Request Query parameters? We should only add required query parameters to the URL and skip optional parameters.

RobWin avatar Jul 24 '17 08:07 RobWin

@alkemann I do think that you can't explicitly define query parameter examples.

@RobWin I guess we can get rid of the table, since it's already in the operation description.

cascer1 avatar Jul 24 '17 08:07 cascer1

Yes, then let's get rid of the table.

RobWin avatar Jul 24 '17 08:07 RobWin

Personally I would prefer the table. Can we make it an option?

On 24 Jul 2017, at 10:34, Robert Winkler [email protected] wrote:

Yes, then let's get rid of the table.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

alkemann avatar Jul 24 '17 09:07 alkemann

@alkemann Sorry for the late reply (more than 2 months ;-;), I guess it could be added as configuration variable.

cascer1 avatar Oct 02 '17 16:10 cascer1

Welcome back @cascer1 :)

alkemann avatar Oct 03 '17 07:10 alkemann

Has this issue been fixed? I've tried using the docker image swagger2markup/swagger2markup:1.3.2, but I still see query parameters being shown in examples as JSON

ChrisCGH avatar Mar 05 '18 11:03 ChrisCGH

I'm very sorry, life has been super busy and I haven't had the time to work on this still. It might be better if someone else picked up this issue.

cascer1 avatar Mar 05 '18 14:03 cascer1