Description
Q&A (please complete the following information)
- OS: Linux
- Browser: chrome
- Version: 4.7.1 (but all versions supporting OAS 3.1 are affected)
- Method of installation:
swaggerapi/swagger-ui
docker image - Swagger-UI version: 4.7.1 (but all versions supporting OAS 3.1 are affected)
- Swagger/OpenAPI version: OpenAPI 3.1
Content & configuration
Example Swagger/OpenAPI definition: https://drive.google.com/file/d/1ysjjWAy-1_Xxhf4LBN4nLasMZSCm0EUa/view?usp=drive_link
Swagger-UI configuration options: Whatever is set in swaggerapi/swagger-ui
docker image
Describe the bug you're encountering
After updating my OAS spec from v3.0 to v3.1 I have noticed swagger-ui renders a "servers" block for every endpoint, when clicking "Try it out", but only if an Authorization has been set before.
This wouldn't bother me if it wasn't because it does not inherit the value set on the global "Servers", meaning you have to set the value for every endpoint you want to test, instead of just once globally.
I could not reproduce this in https://editor-next.swagger.io/ though.
To reproduce...
Steps to reproduce the behavior:
- Download the oas spec provided avobe and call it swagger.json
- Spin up a docker container using
swaggerapi/swagger-ui
and mounting the swagger.json file
docker run --rm -p 8888:8080 -v ${PWD}/swagger.json:/app/swagger.json swaggerapi/swagger-ui:v5.9.4
- Visit http://localhost:8888
- Fill in server details with any value.
- Set an Authorization value (also anything should work).
- Click on any endpoint to uncollapse it, then click on "Try it out".
- You'll notice the Servers block is rendered as shown in the screenshot, even though no
servers
is defined for the endpoints in the spec.
Expected behavior
Servers block is not rendered, and the endpoint uses the value set in the global servers.