Description
Q&A (please complete the following information)
- OS: macOS (also Windows)
- Browser: chromium (Brave - but any browser)
- Version: 131.0.6778.69 (1.73.89)
- Method of installation: npm
- Swagger-UI version: 5.1.0 - 5.18.2
- Swagger/OpenAPI version: OpenAPI 3.1.0
Content & configuration
Angular project using swagger-ui-dist:5.18.2
Example Swagger/OpenAPI definition:
N/A - large definition (11mb)
Swagger-UI configuration options:
import {SwaggerUIBundle} from 'swagger-ui-dist';
SwaggerUIBundle({
spec: spec,
domNode: this.swaggerEle.nativeElement,
deepLinking: false,
docExpansion: 'none',
defaultModelExpandDepth: 3
})
Describe the bug you're encountering
UI performance issue when clicking on each endpoint and viewing its contents.
To reproduce...
Steps to reproduce the behavior:
- On Swagger UI
- Click to open a service
- Click to open an endpoint
- Loading icon hangs for ~6 seconds
Expected behavior
Endpoint information displays promptly without excessive delays.
Screenshots
Additional context or thoughts
Updating to swagger-ui-dist:5.18.2 (from 4.19.1) there is a UI performance issue when clicking on each endpoint and viewing its contents. Loading icon hangs for ~6 seconds, see screenshot. Once content loads, performance for that expansion is good. Issue persists on OpenAPI 3.1.0 spec but not OpenAPI spec < 3.1.0. I've reviewed a similar issue thread here: #8606 - tested swapping our spec for twitter's (https://gist.github.com/char0n/0623cf602c23de8628b7e06012cfbf00) but issue still persists. We've tested swagger-ui-dist versions between 5.1.0 to 5.18.2 and the performance seems to degrade as the version increases. Oddly enough, as a workaround, we've discovered by manually overriding the 'openapi' value within the spec before initializing, the performance issued is resolved and the UI operates as expected.
Eg.
SwaggerUIBundle({
spec: {
...spec,
openapi: '3.0.3'
},
domNode: this.swaggerEle.nativeElement,
deepLinking: false,
docExpansion: 'none',
defaultModelExpandDepth: 3
})
Is there some configuration flag to handle this performance issue? Are there unforeseen consequences for overriding the openapi version?