swagger-api / swagger-api/swagger-ui

Swagger-UI hangs when expanding operation

Open
#10,616 3 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

type: bug
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: Windows
  • Browser: Chrome
  • Version: 141
  • Method of installation: webjar
  • Swagger-UI version: 5.29.3
  • Swagger/OpenAPI version: OpenAPI 3.1
Content & configuration

We have a fairly large OpenAPI file (330 K) generated by springdoc-openapi, which I can't share for confidentiality reasons. The models are generated from complex Java classes that present indirect circular references.

No customization on the Swagger-UI side.

Describe the bug you're encountering

The Swagger-UI page loads normally (although slowly), but when expanding certain operations, the page becomes unresponsive until Chrome offers to kill it.

To reproduce...

Steps to reproduce the behavior:

  1. Load the Swagger-UI page
  2. Click on an operation to expand it
  3. page becomes unresponsive
Expected behavior

Obviously I expect the operation details to be displayed so I can interact with it, or a message that explains that there is an issue with my OpenAPI file, should it be the case.

Screenshots

View of the operation right after clicking on it:
Image

Chrome tasks panel:
Image

Additional context or thoughts

On a suggestion I checked "pause on exception" in the Chrome developer dev tools, I observe that the following two exceptions alternate.

Exception 1:
Image

Exception 2 (with a different value of s each time)
Image

I suspect the problem is related to the circular nature of the model, but I can't change it as it is part of a corporate shared library.

I've seen similar issues raised but not exactly the same, and none that offered a solution.

Thanks for any help.

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 reproducing the hang in the Swagger-UI page with a large OpenAPI 3.1 document containing indirect circular model references, then inspect the alternating exceptions in Chrome DevTools. Compare expanding an affected operation with a smaller document; done means the operation renders responsively or the UI reports the problematic OpenAPI content instead of becoming unresponsive.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.