swagger-api / swagger-api/swagger-ui

Browser tab hangs and crashes when expanding operations with deeply nested oneOf schemas

Open
#10,917 1 comment 0 reactions 0 assignees View on GitHub

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: macOS (also reproduced on Linux/Windows)
  • Browser: Chrome, Firefox
  • Version: latest
  • Method of installation: dist assets
  • Swagger-UI version: 5.32.x (current master)
  • Swagger/OpenAPI version: OpenAPI 3.0.1
Content & configuration

The example schema below is an anonymized version of our internal application's OpenAPI document, hosted publicly (with permissive CORS) so it can be loaded directly for reproduction: https://wbou.dev/swagger-ui/latest-schema.anonymized.json

Describe the bug you're encountering

Expanding an operation whose schemas use many nested oneOf compositions causes the browser tab to freeze and eventually crash.

In the example schema (OpenAPI 3.0.1, 291 component schemas), the GET /v1/resource007 response references 219 schemas and contains 23 nested oneOf nodes. Simpler operations in the same document render fine.

To reproduce...

Steps to reproduce the behavior:

  1. Open any standard Swagger UI configured with the url above, e.g. https://petstore.swagger.io/?url=https://wbou.dev/swagger-ui/latest-schema.anonymized.json
  2. Click to expand the operation GET /v1/resource007.
  3. The tab becomes unresponsive and eventually crashes.
Expected behavior

Expanding such an operation should not freeze or crash the browser tab, regardless of how deeply nested the schema compositions are.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by loading the public anonymized schema and expanding GET /v1/resource007 in Swagger UI, then trace the schema-rendering path handling its nested oneOf compositions. Done means the operation expands without freezing or crashing the browser, while simpler operations continue to render normally.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, openapi
Domain
frontend, performance
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.