swagger-api/swagger-ui

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

Open

#4314 aperta il 12 mar 2018

Vedi su GitHub
 (8 commenti) (0 reazioni) (0 assegnatari)JavaScript (8801 fork)batch import
Hacktoberfestcat: user experiencetype: enhancement

Metriche repository

Star
 (25.447 star)
Metriche merge PR
 (Merge medio 20h 34m) (14 PR mergiate in 30 g)

Descrizione

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.

Guida contributor