Open fabiante opened 1 year ago
One fix would be to support both path, which requires changing swagger-initializer.js
:
let basePrefixIndex = document.URL.indexOf("swagger-ui/");
if (basePrefixIndex == -1) {
basePrefixIndex = document.URL.indexOf("swaggerui/");
}
var openApiUrl = document.URL.substr(0, basePrefixIndex) + "openapi.yml";
The other option is to use an HTTP redirect from swaggerui
to swagger-ui
. That has the benefit of not having to modify the dist
directory which is better for maintenance.
Oops, the change in #3 wasn't properly tested. While the swagger ui correctly loads all assets under the new
swaggerui
path, it does not properly load the openAPI spec:swagger-ui
will try to loadhttp://localhost:8044/openapi.yml
swaggerui
will try to loadhttp://localhost:8044/swaggerui/openapi.yml
The issue is with https://github.com/DEXPRO-Solutions-GmbH/swaggerui/blob/5230764fa6007093f2e3e4d44aeeac5cf7526a71/dist/swagger-initializer.js#L6
Swagger UI expects to run under the
swagger-ui
path.