swagger-api / swagger-api/swagger-ui

Add collapsible feature for curl display in SwaggerUI

Open
#8,939 1 comment 4 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

Currently, SwaggerUI provides a curl syntax display for API requests making it easy for users to copy and run the request from the UI. However, for requests with a large number of parameters, the curl syntax can be quite long and difficult to read.

To improve usability, I propose adding a collapsible feature for the curl display in SwaggerUI. This would allow users to easily fold and expand the sections of the curl syntax they are interested in, making it easier to read and work with.

Overall, I believe that this feature would enhance the user experience of SwaggerUI and make it even more user-friendly for those working with complex API requests.

In previous versions, content was automatically folded, while in the newer version, it is expanded. It would be great to have a button that allows users to quickly switch between the two, to avoid excessively long pages caused by too much expanded content.

previous versions(v2.x):
image

latest version(v5.0):
image

Can we have an option to toggle automatic folding with a button or configure it as per our preferences?

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 comparing the curl display behavior shown for SwaggerUI v2.x and v5.0, then locate the current curl display in the SwaggerUI frontend. Define how a button or preference should toggle folding and expansion for long requests, and verify that the display can switch between both states without making pages excessively long.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend
Issue type
Feature
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.