swagger-api / swagger-api/swagger-ui
Use of `oneOf` results in performance degradation
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 29k
- Forks
- 9.3k
- Avg merge
- 2d 23h
- Merged PRs (30d)
- 25
Description
Q&A (please complete the following information)
- OS: x64 Windows 10 Pro 21H2 19044.2486
- Browser: Chrome 109.0.5414.75
- Version:
"swagger-ui-dist": "4.15.5"in this file. - Method of installation: domaindrivendev/Swashbuckle.AspNetCore version 6.5.0 (latest)
- Swagger-UI version:
"swagger-ui-dist": "4.15.5"in this file. - Swagger/OpenAPI version:
"openapi": "3.0.1"
Content & configuration
swagger.json with fine performance: https://pastebin.com/nc84UZFL
swagger.json with performance degradation: https://pastebin.com/GFQLaL0a
Describe the bug you're encountering
Performance degradation when request/response schema contains oneOf and cyclic references.
To reproduce...
Create models with cyclic references, that use inheritence (animals + zoo). Expect performance degradation as new models are added.
Screenshots
Hang: https://snipboard.io/j679gT.jpg
And die: https://snipboard.io/xG7ATJ.jpg
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the slowdown in Swagger UI using the two linked swagger.json examples, focusing on schemas that combine oneOf, inheritance, and cyclic references. Compare behavior as models are added and define done as eliminating the degradation without breaking rendering of those schemas.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- frontend, performance
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100