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

Swagger Docs: Add params to the swagger docs request URI #139

Open
joeflack4 opened this issue Dec 6, 2021 · 1 comment
Open

Swagger Docs: Add params to the swagger docs request URI #139

joeflack4 opened this issue Dec 6, 2021 · 1 comment
Assignees
Labels
documentation Improvements or additions to documentation ease:low enhancement New feature or request urgency:low

Comments

@joeflack4
Copy link
Collaborator

Description

In the swagger documentation UI, each endpoint automatically has at least two links: (1) a link to the part of the swagger interface for the given endpoint, and (2) a link to get a raw response from the API. Regarding (2), the swagger link that is generated will automatically include the parameters and their values that the user has provided in the swagger interface. It would be nice if the same params and their values coulda also be populated into the link referred to in (1).

To do this, we'd need to at least do 2 things:
(i) generate the URL
(ii) resolve these URLs

There is a way to do this, it appears, but it would require some time. For (ii), a way to resolve is outlined here:
https://stackoverflow.com/questions/31056771/swagger-ui-url-with-parameters

This answer involves some JavaScript. The main issue here is that the swagger docs are auto-generated by FastAPI. So it's not as simple as updating a single file with some JavaScript. This edit would likely have to be a hack around the FastAPI auto-generation. That is the main issue. After solving that, we could use the advice in the stackoverflow article to handle (ii). For (i), we could also likely solve that with some custom JavaScript.

@joeflack4
Copy link
Collaborator Author

joeflack4 commented Dec 6, 2021

@gaurav @turbomam Just sharing w/ you guys as an FYI. Hopefully what I wrote here makes sense. I looked into improving the URLs generated by in the docs / swagger UI, and this is what I've found / determined so far.

@joeflack4 joeflack4 self-assigned this Dec 6, 2021
@joeflack4 joeflack4 added enhancement New feature or request documentation Improvements or additions to documentation labels Dec 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation ease:low enhancement New feature or request urgency:low
Projects
None yet
Development

No branches or pull requests

1 participant