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

global basepath #836

Open
dseynaev opened this issue Oct 15, 2021 · 3 comments · May be fixed by #977
Open

global basepath #836

dseynaev opened this issue Oct 15, 2021 · 3 comments · May be fixed by #977
Labels
theme: OpenAPI pertains to OpenAPI type: bug Maintainers have validated that it is a real bug in the project code

Comments

@dseynaev
Copy link

dseynaev commented Oct 15, 2021

It would be helpful to be able to specify a global base path e.g. as an argument to pr_run(), which would be taken into account by all routers including the documentation and spec urls.

I'm currently working around this by just creating an empty root router pr() and using pr_mount() to add my actual router under a base path. This is not a complete solution since I would also like to serve my documentation under that same base path.

I found options(plumber.apiPath), which looks like it's working, but the docs are actually served under http://127.0.0.1:5297/__docs__/

>  plumber::options_plumber(apiPath = "/x")
>  plumber::pr() %>% plumber::pr_run()
Running plumber API at http://127.0.0.1:5297
Running swagger Docs at http://127.0.0.1:5297/x/__docs__/
@schloerke schloerke added theme: OpenAPI pertains to OpenAPI type: bug Maintainers have validated that it is a real bug in the project code labels Oct 18, 2021
@schloerke
Copy link
Collaborator

Correct. The docs are only mounted for the root router.

The message and the documentation do not align

@aaronbrezel
Copy link

Any update on this bug? Currently looking for an easy way to add a base path prefix to the default swagger documentation.

E.g.: http://127.0.0.1:8000/base_path/__docs__/

Otherwise, a suggested workaround would also be much appreciated!

@JosiahParry
Copy link
Contributor

This bug still exists. I am able to recreate it today. How can we fix this?

@thomasp85 thomasp85 linked a pull request Jan 24, 2025 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
theme: OpenAPI pertains to OpenAPI type: bug Maintainers have validated that it is a real bug in the project code
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants