swagger-api / swagger-api/swagger-ui

`urls` config ignored when set in a config file provided through configURL

Open
#4,455 4 comments 4 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

cat: configuration type: bug
Dominant language
JavaScript
Stars
29k
Forks
9.3k
Avg merge
2d 23h
Merged PRs (30d)
25

Description

Q A
Bug or feature request? Bug
Which Swagger/OpenAPI version? NA
Which Swagger-UI version? 3.13.4
How did you install Swagger-UI? npm
Which browser & version? Firefox 59.0.2
Which operating system?
Demonstration API definition

Test using the petstore API def

Configuration (browser query string, constructor, config.yaml)

See below

Expected Behavior

When trying to configure the urls params provided in a configURL, it is ignored.
The following message is displayed: "No API definition provided."

Index HTML:

const ui = SwaggerUIBundle({
    configUrl: "./swagger-config.json"
});

JSON Configuration:

{
        dom_id: "#swagger-ui",
        deepLinking: true,
        presets: [SwaggerUIBundle.presets.apis, SwaggerUIStandalonePreset],
        plugins: [SwaggerUIBundle.plugins.DownloadUrl],
        layout: "StandaloneLayout",
        urls: [
            {
                name: "test",
                url: "http://petstore.swagger.io/v2/swagger.json"
            }
        ]
    }

When I use the same configuration directly in the HTML, the urls is well considered.

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

Start by tracing how the index HTML loads configUrl and how the external swagger-config.json is merged into Swagger UI settings. Verify the handling of the urls configuration by reproducing the issue with the provided petstore URL; done means the API selector loads and the definition is displayed when urls is supplied through configUrl.

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
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.