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

The "url" configuration parameter is not being ignored when "urls" is provided via "configUrl" #5019

Closed
jlw0 opened this issue Nov 12, 2018 · 3 comments

Comments

@jlw0
Copy link

jlw0 commented Nov 12, 2018

Q&A

  • OS: Windows 10 Enterprise
  • Browser: Chrome
  • Version: 70.0.3538.77
  • Method of installation: Dist Assets
  • Swagger-UI version: 3.19.3
  • Swagger/OpenAPI version: OpenAPI 3.0

Content & configuration

JavaScript Swagger-UI Configuration:

SwaggerUI({
  // this is the default configuration
  url: "https://petstore.swagger.io/v2/swagger.json",
  dom_id: '#swagger-ui',
  deepLinking: true,
  presets: [
    SwaggerUIBundle.presets.apis,
      SwaggerUIStandalonePreset
    ],
    plugins: [
      SwaggerUIBundle.plugins.DownloadUrl
    ],
    layout: "StandaloneLayout"
})

Query Parameter Swagger-UI Configuration:

?configUrl=/someUrl/swagger-config.json

Swagger-UI Configuration Endpoint Response Body:

{
  "urls": "/someUrl/openapi.json"
}

Describe the bug you're encountering

The documentation states that the url parameter will be ignored if urls or spec is used. The UI has a race condition which causes it to load the pet store example even though the urls configuration parameter is provided.

To reproduce...

Steps to reproduce the behavior:

  1. Open the Swagger-UI in a browser with the configUrl query parameter
  2. Refresh the page to verify the Swagger-UI will load either the pet store example or the urls OpenAPI definition.

Expected behavior

Since the url configuration parameter is supposed to be ignored, the page should load with the first URL listed by the urls configuration parameter.

Additional context or thoughts

You can workaround this bug by providing a blank url configuration parameter in the configuration endpoint's response body:

{
  "url": "",
  "urls": "/someUrl/openapi.json"
}
@dlmiddlecote
Copy link

Any updates on this?

@jlw0
Copy link
Author

jlw0 commented Mar 21, 2019

It appears this issue may have been fixed by #5161

@jlw0
Copy link
Author

jlw0 commented Mar 21, 2019

I confirmed that I no longer experience this issue with Swagger UI 3.21.0.

@jlw0 jlw0 closed this as completed Mar 21, 2019
@lock lock bot locked and limited conversation to collaborators Mar 21, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants