swagger-api / swagger-api/swagger-ui

UI hangs when typing in request body

Open
#5,113 6 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

cat: performance P3 type: enhancement
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 10 Education]
  • Browser: [Chrome]
  • Version: [71.0.3578.98 (Official Build) (64-bit)]
  • Method of installation: [NSwag, Swagger editor]
  • Swagger-UI version: [3.19.0-3.20.3]
  • Swagger/OpenAPI version: [OpenAPI 3.0.0]
Content & configuration

Example Swagger/OpenAPI definition:
https://pastebin.com/raw/Zh5ZGN17
Note: This spec is obfuscated

Swagger-UI configuration options:
Swagger editor default settings

Describe the bug you're encountering

Every key press in the request body takes about ~800 ms to process. The ui hangs and freezes while typing and opening operations also takes a very long time.

To reproduce...

Steps to reproduce the behavior:

  1. Go to any post operation
  2. Click on try it out
  3. Type in the request body field
  4. The UI will hang for a while for each keystroke, the more keystrokes the longer
Expected behavior

The UI does not hang or only for a very short time when entering words in the request body text field.

Additional information

Callstack of a single key press event:
image

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

Reproduce the slowdown in Swagger UI 3.19.0–3.20.3 using the provided OpenAPI definition, a POST operation, and the request body field in Chrome. Start with the reported keypress call stack and browser profiling; done means typing and opening operations no longer incur the reported per-keystroke hangs.

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.