Skip to content
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

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

Open
AndrewDonkin-Gallagher opened this issue Mar 7, 2025 · 0 comments

Comments

@AndrewDonkin-Gallagher
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant