swagger-api / swagger-api/swagger-ui

Add displayName to urls and use that in drop-down list

Open
#4,314 8 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

cat: user experience Hacktoberfest type: enhancement
Dominant language
JavaScript
Stars
29k
Forks
9.3k
Avg merge
2d 23h
Merged PRs (30d)
25

Description

Q A
Bug or feature request? Feature
Which Swagger/OpenAPI version? Any
Which Swagger-UI version? 3.23.1
How did you install Swagger-UI? Hosting the dist folder
Which browser & version? Any
Which operating system? Any

Thanks to #3649, now the API name is used to generate a direct link to that API, also fixing the deep linking problem when multiple APIs are present. The API name becomes a parameter in the URL, as it is visible in the drop-down list when the Swagger UI renders multiple API definitions.

I'm proposing to add a new optional property in the list of the API definitions, next to name or primaryName, called displayName (eventually also primaryDisplayName) to be solely used as visible text in the drop-down.

Having friendly API names like "Customer look-up v1" generates URLs with escaped characters. Changing the API name would also break links. The APIs should be named "customer-lookup-v1" to fix and make the URL more robust, but then the drop-down doesn't look as human-friendly as before.

My proposal is to introduce a new parameter to fix the (cosmetic) display issue.

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 locating the API definition list and drop-down rendering, then trace how name and primaryName are currently used for visible text and URL generation. The change is done when an optional displayName can control the drop-down label while the API name remains stable for links, with the existing behavior preserved when it is absent.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, openapi
Domain
api, frontend
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.