| 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? |
Test using the petstore API聽def
See below
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.
This likely shares a root cause with https://github.com/swagger-api/swagger-ui/issues/4267
Is there any update / resolution of this issue?
Has anyone figured out a workaround for this ?
I don't know if anybody needs this, but I have got it to work. I am not sure if this is the intended way swagger wants to do or if this is a workaround, but here goes -
I have got most of the configuration in the index.html -
const ui = SwaggerUIBundle({
configUrl : "./swagger-config.json",
dom_id: '#swagger-ui',
deepLinking: true,
presets: [
SwaggerUIBundle.presets.apis,
SwaggerUIStandalonePreset
],
plugins: [
SwaggerUIBundle.plugins.DownloadUrl
],
layout: "StandaloneLayout"
})
The only thing I am picking from the configUrl is the urls themselves. This is the swagger-config.json -
urls: [
{
"url": "http://petstore.swagger.io/v2/swagger.json",
"name": "Petstore"
},
{
"url": "http://localhost:9002/api-docs/swagger-test",
"name": "Petstore2"
},
{
"url": "http://localhost:9002/api-docs/swagger-test",
"name": "Petstore3"
}
]
I have the same issue. Do you have any solution? I'm using a non-bundle version.
Most helpful comment
I don't know if anybody needs this, but I have got it to work. I am not sure if this is the intended way swagger wants to do or if this is a workaround, but here goes -
I have got most of the configuration in the
index.html-The only thing I am picking from the configUrl is the urls themselves. This is the swagger-config.json -