swagger-api / swagger-api/swagger-ui

When using both CONFIG_URL and API_URLS, the API_URLS are ignored.

Open
#4,942 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

cat: configuration cat: docker type: bug
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: all
  • Browser: chrome
  • Version: most recent
  • Method of installation: docker image
  • Swagger-UI version: 3.19.3
  • Swagger/OpenAPI version: OpenAPI 3.0
Content & configuration

Example Swagger/OpenAPI definition:
I tested this with the petstore OpenAPI doc also.

Swagger-UI configuration options:
This is what my config.json looks like

{
    "dom_id": "#swagger-ui",
    "deepLinking": true,
    "docExpansion": "none"
}
Describe the bug you're encountering

When I launch swagger UI with the API_URLS environment set, I get the expected behavior with 2 API docs returned. When I launch swagger UI with the CONFIG_URL environment set, I get the expected behavior with regards to the doc expansion, etc. If I have both API_URLS and CONFIG_URL set, then the CONFIG is used, but no API doc is loaded.

To reproduce...

You can use this docker-compose file to launch the service with the same options I'm using:

version: '3'

services:
  swagger-ui:
    image: swaggerapi/swagger-ui
    ports:
      - "8080:8080"
    environment:
      - CONFIG_URL=https://hostname/path/config.json
      - API_URLS=[{"name":"v2","url":"https://petstore.swagger.io/v2/swagger.json"},{"name":"v3","url":"https://petstore.swagger.io/v2/swagger.json"}]

Steps to reproduce the behavior:
Once Swagger UI is launched you will see a blank page is loaded. You can manually explore an API doc by putting in the URL and it will use the settings from the config.json file as defined.

You can alternate back and forth removing one or the other and see that the settings are working independently, just not together.

Expected behavior

I would expect it to use both the settings from the config file found from the CONFIG_URL and also to load the API docs from the API_URLS.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the issue with the supplied docker-compose configuration, first setting CONFIG_URL and API_URLS independently and then together. Trace how the Swagger UI Docker image handles these environment variables and verify that the config settings and both API documents are loaded together without leaving a blank page.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, javascript
Domain
devops, frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.