swagger-api/swagger-ui

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

Open

#4,314 建立於 2018年3月12日

在 GitHub 查看
 (8 留言) (0 反應) (0 負責人)JavaScript (8,801 fork)batch import
Hacktoberfestcat: user experiencetype: enhancement

倉庫指標

Star
 (25,447 star)
PR 合併指標
 (平均合併 20小時 34分鐘) (30 天內合併 14 個 PR)

描述

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.

貢獻者指南