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

[Bug] Can't change the openapi endpoint url due to hard coding in html #16

Closed
rocknet opened this issue Dec 6, 2021 · 1 comment · Fixed by #17
Closed

[Bug] Can't change the openapi endpoint url due to hard coding in html #16

rocknet opened this issue Dec 6, 2021 · 1 comment · Fixed by #17

Comments

@rocknet
Copy link
Contributor

rocknet commented Dec 6, 2021

Describe the bug
Setting OAS_URL_PREFIX to anything other than /docs causes redoc and swagger to fail, because the html looks for /docs/openapi.json (and swagger-config for swagger)

Screenshots
image
image

To Reproduce
Initialize Sanic-ext like this:

cfg = Config(oas_ui_default="swagger", oas_url_prefix='/swagger')
Extend(app, config=cfg)

Expected behavior
Swagger UI functions at hostname/swagger

Environment (please complete the following information):

  • OS: Windows
  • Browser Chrome
  • Version 21.9.3 (really pip install -e /main from this repo)

Additional context
This is fixed in a branch in my fork. Let me know if you want a PR. I also fixed / enhanced with the ability to use the root as the openapi endpoint. Tested with redoc and swagger with the default of no prefix set (so default of /docs) and url prefixes ['/docs', '/swagger', '']. I only tested with the base of my installed sanic, which is 21.9.1
rocknet@ec1f277

@ahopkins
Copy link
Member

ahopkins commented Dec 6, 2021

This is fixed in a branch in my fork. Let me know if you want a PR.

Yes please! 😎

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

Successfully merging a pull request may close this issue.

2 participants