RapiDoc icon indicating copy to clipboard operation
RapiDoc copied to clipboard

[Feature request] When allow-try is false, query parameter examples should show URL strings

Open AndrewDonkin-Gallagher opened this issue 7 months ago • 0 comments

First the fanservice: Rapidoc is awesome. It is the best out there. Superb work.

One of the very few areas that Redoc edges out Rapidoc for my particular use is in query parameter examples. While Rapidoc's curl command line is terrific, it is a long scroll down for a complex endpoint and if allow-try is false--which it will be in my case, for reasons--it isn't there at all.

Redoc renders query parameter examples merely as an <ul> of text that you can copy out.

Example: Redoc, explode false

  • query_param=1 - first example's summary
  • query_param=1,2 - second example's summary

...when the style is comma-separated and explode is false.

Example: Redoc, explode true

  • query_param=1 - first example's summary
  • query_param=1&query_param=2 - second example's summary

You do not have the neat ability to add example query parameters to your curl invocation, but with allow-try turned off curl isn't even there so Rapidoc's examples are confusing.

Example: Rapidoc, for all styles

  • [ 1 ](first example's summary) first example's description
  • [ 1, 2 ](first example's summary)

What you see in the examples is confusing to some readers. They need to see query_param=1,2. But square brackets, comma-separated and non-exploded regardless of the API's style, what appears to be leading space if the value is narrower than 24 pixels, and the same style for example and summary? It throws them.

So I started hacking a similar thing into Rapidoc and immediately ran out of scripting talent. I need the part of buildFetchURL() that builds a parameter from its example values and style while heeding separators, explode, and allowReserved. My patch only handles one combination of those so I won't even submit it as a PR.

What I'd like to see is a text-only representation of what a client would add to a URL to achieve the example given in the spec, in a <pre> or code style to distinguish it from its summary and description, when allow-try is false. No change when allow-try is true, because it's brilliant.

[It would be even better to have the raw URL text as well as the current display, no matter what allow-try is set to, but maybe that is a bridge too far]

Thanks for considering this feature request. In my opinion it will push Rapidoc even higher.

AndrewDonkin-Gallagher avatar Mar 07 '25 02:03 AndrewDonkin-Gallagher