swagger-api / swagger-api/swagger-ui
Loading new URL does not reset schemes value if schemes unset
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 29k
- Forks
- 9.3k
- Avg merge
- 2d 23h
- Merged PRs (30d)
- 25
Description
Q&A (please complete the following information)
- OS: CentOS 7
- Browser: Vivaldi
- Version: 2.3.1440.60
- Method of installation: git clone, using dist directory
- Swagger-UI version: 604c7b420f069b132a3d8b4636afe91a4f473fe2
- Swagger/OpenAPI version: Swagger 2.0
Content & configuration
I'm just loading dist/index.html directly in my browser and pointing UI at my server.
Example Swagger/OpenAPI definition:
Sorry, proprietary, but all you need to know is no host, basePath, or schemes value is defined.
Swagger-UI configuration options:
git repository is completely unmodified and clean.
Describe the bug you're encountering
When I first open dist/index.html, it shows the Petstore API. If I point UI at my HTTP (not HTTPS) server then it successfully loads but any attempt to "Try It Out" does the request over HTTPS.
Through trial and error, I have found that this is caused by the schemes value in the Petstore API. If I modify index.html to point directly to my HTTP URL, it works fine. If I add a schemes entry to my swagger.json, it works fine. If I remove the UI url field so that nothing is loaded initially, it works fine. If I load the Petstore API over HTTP instead, it doesn't work, which indicates that the schemes value takes precedence, as you would expect.
To reproduce...
Steps to reproduce the behavior:
- Fire up UI with it pointing at the Petstore API.
- Point UI to a HTTP URL with no
schemesvalue defined. - Try It Out.
Expected behavior
The request should be made with HTTP, not HTTPS.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the behavior from dist/index.html by first loading the Petstore API, then loading an HTTP definition without a schemes value and using Try It Out. Read the URL-loading and request setup paths responsible for carrying the previous Petstore configuration. Done means the second definition sends requests over HTTP when schemes is absent.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100